<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# core

```go
import "github.com/pingcap/test-infra/sdk/core"
```

## Index

- [func ArchivePath() string](<#func-archivepath>)
- [func Cancelled(reason ...string)](<#func-cancelled>)
- [func CreateFileForArchive(path string) (*os.File, error)](<#func-createfileforarchive>)
- [func Fail(reason ...string)](<#func-fail>)
- [func Fail2(reason ...string)](<#func-fail2>)
- [func RegisterProvider(name string, provider ResourceProvider)](<#func-registerprovider>)
- [func Skip(reason ...string)](<#func-skip>)
- [func Timeout(reason ...string)](<#func-timeout>)
- [type ExecutionInfo](<#type-executioninfo>)
- [type Resource](<#type-resource>)
  - [func ResolveResourceHandle(handle *ResourceHandle) (Resource, error)](<#func-resolveresourcehandle>)
- [type ResourceGetter](<#type-resourcegetter>)
- [type ResourceProvider](<#type-resourceprovider>)
  - [func GetProvider(name string) (provider ResourceProvider, exists bool)](<#func-getprovider>)
- [type TestContext](<#type-testcontext>)
  - [func BuildContext() (TestContext, error)](<#func-buildcontext>)


## func [ArchivePath](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L100>)

```go
func ArchivePath() string
```

## func [Cancelled](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L95>)

```go
func Cancelled(reason ...string)
```

## func [CreateFileForArchive](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L102>)

```go
func CreateFileForArchive(path string) (*os.File, error)
```

## func [Fail](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L75>)

```go
func Fail(reason ...string)
```

## func [Fail2](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L80>)

```go
func Fail2(reason ...string)
```

## func [RegisterProvider](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L62>)

```go
func RegisterProvider(name string, provider ResourceProvider)
```

## func [Skip](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L85>)

```go
func Skip(reason ...string)
```

## func [Timeout](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L90>)

```go
func Timeout(reason ...string)
```

## type [ExecutionInfo](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L37-L45>)

```go
type ExecutionInfo struct {
    CaseID     string
    CaseExecID string
    PlanID     string
    PlanExecID string

    RMSEndpoint  string
    TCMSEndpoint string
}
```

## type [Resource](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L47-L49>)

```go
type Resource interface {
    Handle() ResourceHandle
}
```

### func [ResolveResourceHandle](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L196>)

```go
func ResolveResourceHandle(handle *ResourceHandle) (Resource, error)
```

## type [ResourceGetter](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L51-L53>)

```go
type ResourceGetter interface {
    Get() (Resource, error)
}
```

## type [ResourceProvider](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L55>)

```go
type ResourceProvider func(handle ResourceHandle) ResourceGetter
```

### func [GetProvider](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L68>)

```go
func GetProvider(name string) (provider ResourceProvider, exists bool)
```

## type [TestContext](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L28-L35>)

```go
type TestContext interface {
    context.Context
    Logger() *zap.Logger

    ExecInfo() ExecutionInfo
    Param(name string, optionalDefault ...string) string
    Resource(name string) Resource
}
```

### func [BuildContext](<https://github.com/pingcap/test-infra/blob/main/sdk/core/context.go#L126>)

```go
func BuildContext() (TestContext, error)
```

# resource

```go
import "github.com/pingcap/test-infra/sdk/resource"
```

Package resource defines api to manipulate on resources provided by the test\-infra.

```
Resource:
	TiDBCluster	the tidbcluster, for example a basic tidb cluster, a tidb cluster with tiflash or cdc
	DMCluster	the dmcluster, including the master and worker nodes
	Lightning	the tidb-lightning node, it's a tool used for fast full import of large amounts of data into a TiDB cluster
	BR		is a command-line tool for distributed backup and restoration of the TiDB cluster data
	WorkloadNode	is the workload node which wrap external workloads(eg. sysbench, go-tpc etc)
	MySQL		is a single MySQL node
	KafkaCluster  is the kafka cluster

ExperimentSpec:
	FailureExperimentSpec	injects the downtime error
	NetworkPartitionSpec	injects the network partition(or split brain) error
	NetworkLatencySpec	specifies the network latency. inject latency: Latency ± Jitter with Correlation% correlation
	NetworkLossSpec		specifies the network packets to drop randomly.
	IODelaySpec		specifies the IO delay.

ChaosClient is the client to create an delete a chaos experiment.

For example, to inject a failure error on the first tidb-server:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterTiDBSelectorSpec: &resource.TiDBClusterTiDBSelectorSpec{
			Peer: &[]int{0}[0],
		},
	})

	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector:       selector,
		ExperimentSpec: &resource.FailureExperimentSpec{},
	})

Inject a failure error on pd leader:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterPDSelectorSpec: &resource.TiDBClusterPDSelectorSpec{
			IsLeader: &[]bool{true, false}[0],
		},
	})

	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector:       selector,
		ExperimentSpec: &resource.FailureExperimentSpec{},
	})

Or the CDC owner:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterCDCSelectorSpec: &resource.TiDBClusterCDCSelectorSpec{
			IsOwner: &[]bool{true, false}[0],
		},
	})
	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector:       selector,
		ExperimentSpec: &resource.FailureExperimentSpec{},
	})

Network partition between tidb/pd and tikv/tiflash servers:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterPDSelectorSpec: &resource.TiDBClusterPDSelectorSpec{
			All: true,
		},
		TiDBClusterTiDBSelectorSpec: &resource.TiDBClusterTiDBSelectorSpec{
			All: true,
		},
	})
	target, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterTiKVSelectorSpec: &resource.TiDBClusterTiKVSelectorSpec{
			// All: true,
			StoreLabelSelector: &metav1.LabelSelector{
				MatchLabels: map[string]string{},
			},
		},
		TiDBClusterTiFlashSelectorSpec: &resource.TiDBClusterTiFlashSelectorSpec{
			StoreLabelSelector: &metav1.LabelSelector{
				MatchLabels: map[string]string{},
			},
		},
	})

Network delay on tikv-servers:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterTiKVSelectorSpec: &resource.TiDBClusterTiKVSelectorSpec{
			All: true,
		},
	})
	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector: selector,
		ExperimentSpec: &resource.NetworkLatencySpec{
			Latency:     "20ms",
			Jitter:      "5ms",
			Correlation: "25",
		},
	})

Or network loss:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterTiKVSelectorSpec: &resource.TiDBClusterTiKVSelectorSpec{
			All: true,
		},
	})
	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector: selector,
		ExperimentSpec: &resource.NetworkLossSpec{
			Loss:        "25",
			Correlation: "25",
		},
	})
Or IO delay:
	selector, err := tc.ChaosSelect(resource.TiDBClusterSelectorOpts{
		TiDBClusterTiKVSelectorSpec: &resource.TiDBClusterTiKVSelectorSpec{
			All: true,
		},
	})
	chaosId, err := tc.ChaosClient().Create(resource.InjectChaosOptions{
		Selector: selector,
		ExperimentSpec: &resource.IODelaySpec{
			VolumePath: "/var/lib/tikv",
			Path:       "/var/lib/tikv/data/**\/*",
			Delay:      "100ms",
			Percent:    100,
		},
	})
```

## Index

- [Constants](<#constants>)
- [Variables](<#variables>)
- [func BuildDSN(a *url.URL, db string, params ...string) string](<#func-builddsn>)
- [func FQDN(x interface{}) string](<#func-fqdn>)
- [func GenResourceName(name, generateName string) string](<#func-genresourcename>)
- [func IsResourceNotFoundError(err error) bool](<#func-isresourcenotfounderror>)
- [func NopCloser(writer io.Writer) io.WriteCloser](<#func-nopcloser>)
- [func UniqueStr() string](<#func-uniquestr>)
- [type Addressable](<#type-addressable>)
- [type ArchiverFunc](<#type-archiverfunc>)
- [type BR](<#type-br>)
- [type CDCSink](<#type-cdcsink>)
- [type CPUStressor](<#type-cpustressor>)
- [type ChaosClient](<#type-chaosclient>)
- [type ChaosIdentifier](<#type-chaosidentifier>)
- [type ChaosSelector](<#type-chaosselector>)
- [type Client](<#type-client>)
- [type DMCluster](<#type-dmcluster>)
- [type DMClusterMasterSelectorSpec](<#type-dmclustermasterselectorspec>)
- [type DMClusterSelectorOpts](<#type-dmclusterselectoropts>)
- [type DMClusterUpgradeOptions](<#type-dmclusterupgradeoptions>)
- [type DMClusterWorkerSelectorSpec](<#type-dmclusterworkerselectorspec>)
- [type DMCompType](<#type-dmcomptype>)
  - [func (d DMCompType) String() string](<#func-dmcomptype-string>)
- [type DMExecOptions](<#type-dmexecoptions>)
- [type ErrorResourceNotFound](<#type-errorresourcenotfound>)
  - [func (e ErrorResourceNotFound) Error() string](<#func-errorresourcenotfound-error>)
- [type ExperimentKind](<#type-experimentkind>)
- [type ExperimentScheduler](<#type-experimentscheduler>)
  - [func (f *ExperimentScheduler) GoString() string](<#func-experimentscheduler-gostring>)
- [type ExperimentSpec](<#type-experimentspec>)
- [type FailureExperimentSpec](<#type-failureexperimentspec>)
  - [func (f *FailureExperimentSpec) GoString() string](<#func-failureexperimentspec-gostring>)
  - [func (f *FailureExperimentSpec) Kind() ExperimentKind](<#func-failureexperimentspec-kind>)
- [type IODelaySpec](<#type-iodelayspec>)
  - [func (i IODelaySpec) GoString() string](<#func-iodelayspec-gostring>)
  - [func (i IODelaySpec) Kind() ExperimentKind](<#func-iodelayspec-kind>)
- [type InjectChaosOptions](<#type-injectchaosoptions>)
- [type KafkaCluster](<#type-kafkacluster>)
- [type KafkaClusterExecOptions](<#type-kafkaclusterexecoptions>)
- [type KafkaClusterSelectorOpts](<#type-kafkaclusterselectoropts>)
- [type KafkaCompType](<#type-kafkacomptype>)
  - [func (_ KafkaCompType) FromString(str string) (KafkaCompType, error)](<#func-kafkacomptype-fromstring>)
  - [func (t KafkaCompType) String() string](<#func-kafkacomptype-string>)
- [type Lightning](<#type-lightning>)
- [type LoadBalancer](<#type-loadbalancer>)
- [type MemoryStressor](<#type-memorystressor>)
- [type MySQL](<#type-mysql>)
- [type MySQLCompatible](<#type-mysqlcompatible>)
- [type NetworkLatencySpec](<#type-networklatencyspec>)
  - [func (n *NetworkLatencySpec) GoString() string](<#func-networklatencyspec-gostring>)
  - [func (n *NetworkLatencySpec) Kind() ExperimentKind](<#func-networklatencyspec-kind>)
- [type NetworkLossSpec](<#type-networklossspec>)
  - [func (n *NetworkLossSpec) GoString() string](<#func-networklossspec-gostring>)
  - [func (n *NetworkLossSpec) Kind() ExperimentKind](<#func-networklossspec-kind>)
- [type NetworkPartitionSpec](<#type-networkpartitionspec>)
  - [func (n *NetworkPartitionSpec) GoString() string](<#func-networkpartitionspec-gostring>)
  - [func (n *NetworkPartitionSpec) Kind() ExperimentKind](<#func-networkpartitionspec-kind>)
- [type OOMEvent](<#type-oomevent>)
- [type RemoteCommandErr](<#type-remotecommanderr>)
- [type RemoteCommander](<#type-remotecommander>)
- [type RemoteCommanderInterruptible](<#type-remotecommanderinterruptible>)
- [type SchedulerExperimentSpecWrapper](<#type-schedulerexperimentspecwrapper>)
  - [func (s SchedulerExperimentSpecWrapper) Kind() ExperimentKind](<#func-schedulerexperimentspecwrapper-kind>)
- [type StressChaosSpec](<#type-stresschaosspec>)
  - [func (t StressChaosSpec) GoString() string](<#func-stresschaosspec-gostring>)
  - [func (t StressChaosSpec) Kind() ExperimentKind](<#func-stresschaosspec-kind>)
- [type Stressor](<#type-stressor>)
- [type Stressors](<#type-stressors>)
- [type Testbed](<#type-testbed>)
- [type TiDBAddrType](<#type-tidbaddrtype>)
  - [func (t TiDBAddrType) String() string](<#func-tidbaddrtype-string>)
- [type TiDBCloudBackupOptions](<#type-tidbcloudbackupoptions>)
- [type TiDBCloudCluster](<#type-tidbcloudcluster>)
- [type TiDBCloudImportDataFormat](<#type-tidbcloudimportdataformat>)
- [type TiDBCloudImportOptions](<#type-tidbcloudimportoptions>)
- [type TiDBCloudInplaceRestoreBackupType](<#type-tidbcloudinplacerestorebackuptype>)
- [type TiDBCloudInplaceRestoreOptions](<#type-tidbcloudinplacerestoreoptions>)
- [type TiDBCloudRestoreOptions](<#type-tidbcloudrestoreoptions>)
- [type TiDBCluster](<#type-tidbcluster>)
- [type TiDBClusterCDCSelectorSpec](<#type-tidbclustercdcselectorspec>)
- [type TiDBClusterComponentUpgradeOption](<#type-tidbclustercomponentupgradeoption>)
- [type TiDBClusterExecOptions](<#type-tidbclusterexecoptions>)
- [type TiDBClusterOOMWatchOptions](<#type-tidbclusteroomwatchoptions>)
- [type TiDBClusterPDSelectorSpec](<#type-tidbclusterpdselectorspec>)
- [type TiDBClusterScaleOptions](<#type-tidbclusterscaleoptions>)
- [type TiDBClusterSearchLogOptions](<#type-tidbclustersearchlogoptions>)
- [type TiDBClusterSelectorOpts](<#type-tidbclusterselectoropts>)
- [type TiDBClusterTiDBSelectorSpec](<#type-tidbclustertidbselectorspec>)
- [type TiDBClusterTiFlashSelectorSpec](<#type-tidbclustertiflashselectorspec>)
- [type TiDBClusterTiKVSelectorSpec](<#type-tidbclustertikvselectorspec>)
- [type TiDBClusterUpdateConfigOptions](<#type-tidbclusterupdateconfigoptions>)
- [type TiDBClusterUpdateConfigsOptions](<#type-tidbclusterupdateconfigsoptions>)
- [type TiDBClusterUpgradeOptions](<#type-tidbclusterupgradeoptions>)
- [type TiDBCompType](<#type-tidbcomptype>)
  - [func (_ TiDBCompType) FromString(str string) (TiDBCompType, error)](<#func-tidbcomptype-fromstring>)
  - [func (t TiDBCompType) String() string](<#func-tidbcomptype-string>)
- [type TiDBComponentNode](<#type-tidbcomponentnode>)
- [type TiDBDrainer](<#type-tidbdrainer>)
- [type TiDBDrainerExecOptions](<#type-tidbdrainerexecoptions>)
- [type TimeChaosSpec](<#type-timechaosspec>)
  - [func (t TimeChaosSpec) GoString() string](<#func-timechaosspec-gostring>)
  - [func (t TimeChaosSpec) Kind() ExperimentKind](<#func-timechaosspec-kind>)
- [type WorkloadNode](<#type-workloadnode>)
- [type WorkloadNodeExecOptions](<#type-workloadnodeexecoptions>)
- [type WorkloadNodeSelectorOpts](<#type-workloadnodeselectoropts>)
- [type WorkloadNodeWriteFileOptions](<#type-workloadnodewritefileoptions>)


## Constants

```go
const (
    ExperimentFailureKind          = ExperimentKind("failure")
    ExperimentNetworkPartitionKind = ExperimentKind("network-partition")
    ExperimentNetworkDelayKind     = ExperimentKind("network-delay")
    ExperimentNetworkLossKind      = ExperimentKind("network-loss")
    ExperimentIODelayKind          = ExperimentKind("io-delay")
    ExperimentTimeChaosKind        = ExperimentKind("time-chaos")
    ExperimentStressChaosKind      = ExperimentKind("stress-chaos")
    ExperimentSchedulesKind        = ExperimentKind("schedules")
)
```

```go
const (
    DMMaster
    DMWorker
)
```

```go
const (
    TiDBCloudImportDataFormatSQL            = TiDBCloudImportDataFormat(1)
    TiDBCloudImportDataFormatAuroraSnapshot = TiDBCloudImportDataFormat(2)
)
```

## Variables

```go
var (
    DMMasterContainerName = "dm-master"
    DMWorkerContainerName = "dm-worker"
)
```

## func [BuildDSN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L387>)

```go
func BuildDSN(a *url.URL, db string, params ...string) string
```

## func [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L49>)

```go
func FQDN(x interface{}) string
```

## func [GenResourceName](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/common.go#L18>)

```go
func GenResourceName(name, generateName string) string
```

### GenResourceName generates a name ONLY IF the name parameter is empty

```
example 1:
name := GenResourceName("", "tc-")

example 2:
name := GenResourceName("tc-wj8kp", "")
```

## func [IsResourceNotFoundError](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/errors.go#L22>)

```go
func IsResourceNotFoundError(err error) bool
```

## func [NopCloser](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/workloadnode.go#L48>)

```go
func NopCloser(writer io.Writer) io.WriteCloser
```

## func [UniqueStr](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/common.go#L7>)

```go
func UniqueStr() string
```

## type [Addressable](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L105-L108>)

```go
type Addressable interface {
    ServiceURL(typ TiDBAddrType) (*url.URL, error)
    PeerURLs(typ TiDBAddrType) ([]*url.URL, error)
}
```

## type [ArchiverFunc](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L33>)

ArchiverFunc is a type alias, extract it for easy when refactor

```go
type ArchiverFunc func(objectName string, reader io.Reader) (*url.URL, error)
```

## type [BR](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/br.go#L4-L6>)

BR is the br node interface, it wraps the WorkloadNode interfaces

```go
type BR interface {
    WorkloadNode
}
```

## type [CDCSink](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L13-L15>)

CDCSink is the interface for cdc to get sink endpoint Such as kafka://localhost:9092

```go
type CDCSink interface {
    SinkEndpoint() (*url.URL, error)
}
```

## type [CPUStressor](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L311-L317>)

CPUStressor defines how to stress CPU out

```go
type CPUStressor struct {
    Stressor `json:",inline"`
    // Load specifies P percent loading per CPU worker. 0 is effectively a sleep (no load) and 100
    // is full loading.
    // +optional
    Load int64 `json:"load,omitempty"`
}
```

## type [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L161-L164>)

ChaosClient is the client to create or delete a chaos experiment.

```go
type ChaosClient interface {
    Create(opts InjectChaosOptions) (id ChaosIdentifier, err error)
    Delete(id ChaosIdentifier) error
}
```

## type [ChaosIdentifier](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L156-L158>)

```go
type ChaosIdentifier interface {
    HumanReadableName() string
}
```

## type [ChaosSelector](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L20-L23>)

```go
type ChaosSelector interface {
    // HumanReadableName is the human-readable name of the chaos target
    HumanReadableName() string
}
```

## type [Client](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L15-L30>)

Client defines apis every resource need to impl

```go
type Client interface {
    // Create creates resource
    Create(spec json.RawMessage) (core.Resource, error)
    // Get gets resource
    Get(handle apiresource.ResourceHandle) (core.Resource, error)
    // GetEndpoints gets Endpoints of a resource
    GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
    // Delete deletes resources
    Delete(handle apiresource.ResourceHandle) error
    // ReserveEnv reserves environment without the loss of debugging on resource
    ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
    // Artifact archives logs for debugging on resource
    Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver ArchiverFunc) (map[string]*url.URL, error)
    // FQDN return the fully qualified domain name of the Client
    FQDN() string
}
```

## type [DMCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L35-L41>)

DMCluster is the dm cluster interface

```go
type DMCluster interface {
    core.Resource
    Exec(podName, containerName string, cmd ...string) (stdout string, stderr string, exitCode int, err error)
    Upgrade(opts DMClusterUpgradeOptions) error
    ChaosClient() ChaosClient
    ChaosSelect(selector DMClusterSelectorOpts) ([]ChaosSelector, error)
}
```

## type [DMClusterMasterSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L71-L74>)

DMClusterMasterSelectorSpec specifies how to filter the dm\-master instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select alls: All: true

```go
type DMClusterMasterSelectorSpec struct {
    Peer *int
    All  bool
}
```

## type [DMClusterSelectorOpts](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L58-L61>)

DMClusterSelectorOpts specifies how to filter the dm cluster instances.

```go
type DMClusterSelectorOpts struct {
    *DMClusterMasterSelectorSpec
    *DMClusterWorkerSelectorSpec
}
```

## type [DMClusterUpgradeOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L49-L55>)

DMClusterUpgradeOptions wraps a version wants to upgrade to on target component node

```go
type DMClusterUpgradeOptions struct {
    // Version is like: v5.2.0 style or release-5.0, master, nightly etc.
    // For TiUP, only the Version field is needed
    Version string
    // Timeout wait for scaling, a timeout of 0 is interpreted as an infinity
    Timeout time.Duration
}
```

## type [DMClusterWorkerSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L84-L87>)

DMClusterWorkerSelectorSpec specifies how to filter the dm\-worker instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select alls: All: true

```go
type DMClusterWorkerSelectorSpec struct {
    Peer *int
    All  bool
}
```

## type [DMCompType](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L21>)

```go
type DMCompType int
```

### func \(DMCompType\) [String](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L23>)

```go
func (d DMCompType) String() string
```

## type [DMExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/dmcluster.go#L44-L46>)

DMExecOptions wraps a command which wants to execute to current dm master

```go
type DMExecOptions struct {
    Command string
}
```

## type [ErrorResourceNotFound](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/errors.go#L14-L16>)

ErrorResourceNotFound means the test resource not found

```go
type ErrorResourceNotFound struct {
    resource.ResourceHandle
}
```

### func \(ErrorResourceNotFound\) [Error](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/errors.go#L18>)

```go
func (e ErrorResourceNotFound) Error() string
```

## type [ExperimentKind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L7>)

```go
type ExperimentKind string
```

## type [ExperimentScheduler](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L49-L59>)

```go
type ExperimentScheduler struct {
    // Cron defines a cron job rule.
    //
    // Some rule examples:
    // "0 30 * * * *" means to "Every hour on the half hour"
    // "@hourly"      means to "Every hour"
    // "@every 1h30m" means to "Every hour thirty"
    //
    // More rule info: https://godoc.org/github.com/robfig/cron
    Cron string
}
```

### func \(\*ExperimentScheduler\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L61>)

```go
func (f *ExperimentScheduler) GoString() string
```

## type [ExperimentSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L26-L29>)

ExperimentSpec defines the chaos experiment spec

```go
type ExperimentSpec interface {
    fmt.GoStringer
    Kind() ExperimentKind
}
```

## type [FailureExperimentSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L75-L85>)

FailureExperimentSpec injects the downtime error

```go
type FailureExperimentSpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler
}
```

### func \(\*FailureExperimentSpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L87>)

```go
func (f *FailureExperimentSpec) GoString() string
```

### func \(\*FailureExperimentSpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L91>)

```go
func (f *FailureExperimentSpec) Kind() ExperimentKind
```

## type [IODelaySpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L194-L218>)

IODelaySpec specifies the IO Delay.

```go
type IODelaySpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler

    // The mount path of the target volume
    //
    // for tikv, it's /var/lib/tikv
    VolumePath string
    // Defines the path of files for injecting IOChaos actions. It should be a glob for the files which you want to inject fault or delay. It is base on glob pattern and should be in the volumePath directory.
    //
    // for tikv, it's /var/lib/tikv/data/**/*
    Path string

    // Specifies the latency of the fault injection. The duration might be a string with a signed sequence of decimal numbers, each with an optional fraction and a unit suffix. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", and "h".
    Delay string
    // Defines the probability of injecting errors in percentage, max 100
    Percent int64
}
```

### func \(IODelaySpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L220>)

```go
func (i IODelaySpec) GoString() string
```

### func \(IODelaySpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L224>)

```go
func (i IODelaySpec) Kind() ExperimentKind
```

## type [InjectChaosOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L32-L36>)

InjectChaosOptions defines the chaos source and target\(optional\) with a ExperimentSpec

```go
type InjectChaosOptions struct {
    Selector []ChaosSelector
    Target   *[]ChaosSelector
    ExperimentSpec
}
```

## type [KafkaCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L18-L24>)

KafkaCluster is the kafka cluster interface

```go
type KafkaCluster interface {
    core.Resource
    Exec(opts KafkaClusterExecOptions) (stdout string, stderr string, exitCode int, err error)
    ChaosSelect(selector KafkaClusterSelectorOpts) ([]ChaosSelector, error)
    ChaosClient() ChaosClient
    ServiceURL() (*url.URL, error)
}
```

## type [KafkaClusterExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L35-L39>)

KafkaClusterExecOptions wraps a command which wants to execute to Kafka pod

```go
type KafkaClusterExecOptions struct {
    Command string
    Target  KafkaCompType
    Peer    int
}
```

## type [KafkaClusterSelectorOpts](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L27-L32>)

KafkaClusterSelectorOpts defines how to select kafka cluster node

```go
type KafkaClusterSelectorOpts struct {
    Peer          int
    All           bool
    RandomSameOne bool
    Controller    bool
}
```

## type [KafkaCompType](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L46>)

```go
type KafkaCompType int
```

```go
const (
    Zookeeper KafkaCompType = iota
    Kafka
)
```

### func \(KafkaCompType\) [FromString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L48>)

```go
func (_ KafkaCompType) FromString(str string) (KafkaCompType, error)
```

### func \(KafkaCompType\) [String](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/kafka.go#L59>)

```go
func (t KafkaCompType) String() string
```

## type [Lightning](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/lightning.go#L4-L6>)

Lightning is the lightning node interface, it wraps the WorkloadNode interfaces

```go
type Lightning interface {
    WorkloadNode
}
```

## type [LoadBalancer](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/loadbalancer.go#L5-L8>)

```go
type LoadBalancer interface {
    core.Resource
    Endpoint() (domainName string, port int)
}
```

## type [MemoryStressor](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L300-L308>)

MemoryStressor defines how to stress memory out

```go
type MemoryStressor struct {
    Stressor `json:",inline"`

    // Size specifies N bytes consumed per vm worker, default is the total available memory.
    // One can specify the size as % of total available memory or in units of B, KB/KiB,
    // MB/MiB, GB/GiB, TB/TiB.
    // +optional
    Size string `json:"size,omitempty" webhook:"Bytes"`
}
```

## type [MySQL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/mysql.go#L8-L11>)

MySQL is the mysql node interface, it wraps the WorkLoadNode interfaces

```go
type MySQL interface {
    WorkloadNode
    MySQLCompatible
}
```

## type [MySQLCompatible](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/mysql.go#L13-L16>)

```go
type MySQLCompatible interface {
    Addressable
    GetDB(dbName string) (db *sql.DB, err error)
}
```

## type [NetworkLatencySpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L132-L146>)

NetworkLatencySpec specifies the network latency. inject latency: Latency ± Jitter with Correlation% correlation For example if Latency = 90ms, Jitter = 20ms, then the network latency is 90ms ± 20ms.

Correlation refers to correlation, because network conditions change smoothly and the delays of adjacent messages over a short period of time should be approximate rather than completely random.

This value is a percentage and degenerates to the fixed delay case if it is 100.

Or to the random delay case if it is 0

```go
type NetworkLatencySpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler

    Latency     string
    Correlation string
    Jitter      string
}
```

### func \(\*NetworkLatencySpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L148>)

```go
func (n *NetworkLatencySpec) GoString() string
```

### func \(\*NetworkLatencySpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L152>)

```go
func (n *NetworkLatencySpec) Kind() ExperimentKind
```

## type [NetworkLossSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L167-L183>)

NetworkLossSpec specifies the network packets to drop randomly.

```go
type NetworkLossSpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler

    // Loss defines the percentage of packet loss
    Loss string

    // NetworkChaos variation is not purely random, so to emulate that there is a correlation value as well.
    Correlation string
}
```

### func \(\*NetworkLossSpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L185>)

```go
func (n *NetworkLossSpec) GoString() string
```

### func \(\*NetworkLossSpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L189>)

```go
func (n *NetworkLossSpec) Kind() ExperimentKind
```

## type [NetworkPartitionSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L97-L112>)

NetworkPartitionSpec injects the network partition\(or split brain\) error A network partition refers to network decomposition into relatively independent subnets for their separate optimization as well as network split due to the failure of network devices. In both cases the partition\-tolerant behavior of subnets is expected. This means that even after the network is partitioned into multiple sub\-systems, it still works correctly.

```go
type NetworkPartitionSpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string

    // Direction indicate the network partition can be directional.
    // Valid Direction are `from`, `to`, `both`.
    Direction string

    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler
}
```

### func \(\*NetworkPartitionSpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L114>)

```go
func (n *NetworkPartitionSpec) GoString() string
```

### func \(\*NetworkPartitionSpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L118>)

```go
func (n *NetworkPartitionSpec) Kind() ExperimentKind
```

## type [OOMEvent](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L255-L259>)

```go
type OOMEvent struct {
    InstanceName string
    InstanceIP   string
    HappenedAt   time.Time
}
```

## type [RemoteCommandErr](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L44-L47>)

```go
type RemoteCommandErr struct {
    Err      error
    ExitCode int
}
```

## type [RemoteCommander](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L35-L37>)

```go
type RemoteCommander interface {
    Wait() RemoteCommandErr
}
```

## type [RemoteCommanderInterruptible](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/types.go#L39-L42>)

```go
type RemoteCommanderInterruptible interface {
    RemoteCommander
    Interrupt() error
}
```

## type [SchedulerExperimentSpecWrapper](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L66-L68>)

SchedulerExperimentSpecWrapper wraps a ExperimentSpec with ExperimentSchedulesKind kind

```go
type SchedulerExperimentSpecWrapper struct {
    ExperimentSpec
}
```

### func \(SchedulerExperimentSpecWrapper\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L70>)

```go
func (s SchedulerExperimentSpecWrapper) Kind() ExperimentKind
```

## type [StressChaosSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L254-L270>)

StressChaosSpec specifies the \*\*\*\*\*\*\*\*\*\*

```go
type StressChaosSpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler

    // Stressors defines plenty of stressors supported to stress system components out.
    // You can use one or more of them to make up various kinds of stresses. At least
    // one of the stressors should be specified.
    // +optional
    Stressors *Stressors `json:"stressors,omitempty"`
}
```

### func \(StressChaosSpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L272>)

```go
func (t StressChaosSpec) GoString() string
```

### func \(StressChaosSpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L276>)

```go
func (t StressChaosSpec) Kind() ExperimentKind
```

## type [Stressor](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L292-L297>)

Stressor defines common configurations of a stressor

```go
type Stressor struct {
    // Workers specifies N workers to apply the stressor.
    // Maximum 8192 workers can run by stress-ng
    // +kubebuilder:validation:Maximum=8192
    Workers int64 `json:"workers"`
}
```

## type [Stressors](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L282-L289>)

Stressors defines plenty of stressors supported to stress system components out. You can use one or more of them to make up various kinds of stresses

```go
type Stressors struct {
    // MemoryStressor stresses virtual memory out
    // +optional
    MemoryStressor *MemoryStressor `json:"memory,omitempty"`
    // CPUStressor stresses CPU out
    // +optional
    CPUStressor *CPUStressor `json:"cpu,omitempty"`
}
```

## type [Testbed](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/testbed.go#L9-L12>)

Testbed is the testbed interface

```go
type Testbed interface {
    core.Resource
    GetSpec() (*request.CreateTestbedRequest, error)
}
```

## type [TiDBAddrType](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L22>)

```go
type TiDBAddrType int
```

```go
const (
    PDAddr TiDBAddrType = iota
    KVAddr
    KVStatus
    DBAddr
    DBStatus
    CDCAddr
    PDApi
    TiFlashAddr
    Prometheus
    Alertmanager
    Grafana
)
```

### func \(TiDBAddrType\) [String](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L38>)

```go
func (t TiDBAddrType) String() string
```

## type [TiDBCloudBackupOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L50-L52>)

TiDBCloudBackupOptions backup name should be unique

```go
type TiDBCloudBackupOptions struct {
    BackupName string
}
```

## type [TiDBCloudCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L21-L41>)

```go
type TiDBCloudCluster interface {
    core.Resource
    GetDB(dbName string) (db *sql.DB, err error)
    ServiceURL(typ TiDBAddrType) (*url.URL, error)
    GetSpec() apiresource.TiDBCloudClusterSpec
    GetStatus() (*apiresource.TiDBCloudClusterStatus, error)
    PrometheusAPI() (prometheus_api.API, error)
    Import(ctx context.Context, options TiDBCloudImportOptions) error
    Backup(ctx context.Context, opts TiDBCloudBackupOptions) (backupID string, err error)
    // Restore creates a new cluster then restores data into that cluster
    // (in contrast, InplaceRestore() will not create a new cluster before restoring data)
    Restore(ctx context.Context, opts TiDBCloudRestoreOptions) (TiDBCloudCluster, error)
    // InplaceRestore restores data into current cluster, without creating a new cluster
    // (in contrast, Restore() will create a new cluster before restoring data)
    InplaceRestore(ctx context.Context, opts TiDBCloudInplaceRestoreOptions) error
    // ResetCluster deletes all data of components(i.e. rm -rf data of tikv, pd...), then restarts cluster.
    // It's to simulate a fresh deployed cluster
    ResetCluster() error
    ChaosClient() ChaosClient
    ChaosSelect(selector TiDBClusterSelectorOpts) ([]ChaosSelector, error)
}
```

## type [TiDBCloudImportDataFormat](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L14>)

```go
type TiDBCloudImportDataFormat int64
```

## type [TiDBCloudImportOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L43-L47>)

```go
type TiDBCloudImportOptions struct {
    SourceURL  string
    DataFormat TiDBCloudImportDataFormat
    AwsRoleArn string
}
```

## type [TiDBCloudInplaceRestoreBackupType](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L62>)

```go
type TiDBCloudInplaceRestoreBackupType string
```

```go
const (
    TiDBCloudInplaceRestoreBackupTypeFull  TiDBCloudInplaceRestoreBackupType = "full"
    TiDBCloudInplaceRestoreBackupTypeDB    TiDBCloudInplaceRestoreBackupType = "db"
    TiDBCloudInplaceRestoreBackupTypeTable TiDBCloudInplaceRestoreBackupType = "table"
    TiDBCloudInplaceRestoreBackupTypeRaw   TiDBCloudInplaceRestoreBackupType = "raw"
)
```

## type [TiDBCloudInplaceRestoreOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L71-L78>)

```go
type TiDBCloudInplaceRestoreOptions struct {
    BackupType TiDBCloudInplaceRestoreBackupType
    DBName     *string
    TableName  *string

    BucketName   string
    ObjectPrefix string
}
```

## type [TiDBCloudRestoreOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcloud_cluster.go#L56-L60>)

TiDBCloudRestoreOptions wraps only support override password here, and we will support to set the profile of restore cluster in future

```go
type TiDBCloudRestoreOptions struct {
    ClusterName string
    BackupID    string
    Password    string
}
```

## type [TiDBCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L268-L287>)

TiDBCluster is the tidb cluster interface

```go
type TiDBCluster interface {
    core.Resource
    MySQLCompatible
    Exec(opts TiDBClusterExecOptions) (stdout string, stderr string, exitCode int, err error)
    UpdateConfig(opts TiDBClusterUpdateConfigOptions) error
    UpdateConfigs(opts TiDBClusterUpdateConfigsOptions) error
    Upgrade(opts TiDBClusterUpgradeOptions) error
    Scale(opts TiDBClusterScaleOptions) error
    SearchLog(ctx context.Context, opts TiDBClusterSearchLogOptions) ([]string, error)
    GetSpec(comp TiDBCompType) (*apiresource.TiDBClusterComponentSpec, error)
    GetStatus(comp TiDBCompType) (*apiresource.TiDBClusterComponentStatus, error)
    WatchOOM(ctx context.Context, opts TiDBClusterOOMWatchOptions) (<-chan OOMEvent, error)
    ChaosSelect(selector TiDBClusterSelectorOpts) ([]ChaosSelector, error)
    ChaosClient() ChaosClient
    PrometheusClient() (prometheus.Client, error)
    PrometheusAPI() (prometheus_api.API, error)
    PDClient() (*pdutil.Client, error)
    GetNodes(TiDBCompType) ([]TiDBComponentNode, error)
}
```

## type [TiDBClusterCDCSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L214-L223>)

### TiDBClusterCDCSelectorSpec specifies how to filter the cdc\-server instances

Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select the only owner instance: IsOwner: &\[\]bool\{true, false\}\[0\] Or select all: All: true

```go
type TiDBClusterCDCSelectorSpec struct {
    // Peer specifies the cdc-server instance
    Peer *int
    // IsOwner filters leader or not cdc-server instance
    IsOwner *bool
    // RandomSameOne selects a random cdc-server instance
    RandomSameOne bool
    // All selects all cdc-server instances
    All bool
}
```

## type [TiDBClusterComponentUpgradeOption](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L345-L353>)

```go
type TiDBClusterComponentUpgradeOption struct {
    Target TiDBCompType
    // Version is like: v5.2.0 style or release-5.0, master, nightly etc.
    //
    // For K8s, the full image for a component is: <pd/tidb/tikv/pump/tiflash/ticdc>.baseImage + version
    //
    // For TiUP, only the Version field is needed
    Version string
}
```

## type [TiDBClusterExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L290-L294>)

TiDBClusterExecOptions wraps a command which wants to execute on target component node

```go
type TiDBClusterExecOptions struct {
    Target  TiDBCompType
    Command string
    Peer    int
}
```

## type [TiDBClusterOOMWatchOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L251-L253>)

```go
type TiDBClusterOOMWatchOptions struct {
    Target TiDBCompType
}
```

## type [TiDBClusterPDSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L195-L202>)

TiDBClusterPDSelectorSpec specifies how to filter the pd\-server instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select the only leader instance: IsLeader: &\[\]bool\{true, false\}\[0\] Or select all: All: true

```go
type TiDBClusterPDSelectorSpec struct {
    // Peer specifies the pd-server instance
    Peer *int
    // IsLeader filters leader or not leader pd-server instances
    IsLeader *bool
    // All selects all pd-server instances
    All bool
}
```

## type [TiDBClusterScaleOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L355-L361>)

```go
type TiDBClusterScaleOptions struct {
    Target TiDBCompType
    // Replicas the replica number expect
    Replicas uint32
    // Timeout wait for scaling, a timeout of 0 is interpreted as an infinity
    Timeout time.Duration
}
```

## type [TiDBClusterSearchLogOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L363-L371>)

```go
type TiDBClusterSearchLogOptions struct {
    Target TiDBCompType
    // LogLevelDebug, LogLevelInfo, LogLevelWarn, LogLevelTrace, LogLevelCritical, LogLevelError
    Levels             []logsearch.LogLevel
    StartTime, EndTime time.Time
    Patterns           []string
    // Limits set the total line count returns
    Limit int
}
```

## type [TiDBClusterSelectorOpts](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L243-L249>)

TiDBClusterSelectorOpts is the instance selector options.

For example to select the pd leader: resource.TiDBClusterSelectorOpts\{ TiDBClusterPDSelectorSpec: &resource.TiDBClusterPDSelectorSpec\{ IsLeader: &\[\]bool\{true, false\}\[0\], \}, \}

Select all tidbs and pds: resource.TiDBClusterSelectorOpts\{ TiDBClusterPDSelectorSpec: &resource.TiDBClusterPDSelectorSpec\{ All: true, \}, TiDBClusterTiDBSelectorSpec: &resource.TiDBClusterTiDBSelectorSpec\{ All: true, \}, \}

```go
type TiDBClusterSelectorOpts struct {
    *TiDBClusterTiDBSelectorSpec
    *TiDBClusterTiKVSelectorSpec
    *TiDBClusterPDSelectorSpec
    *TiDBClusterTiFlashSelectorSpec
    *TiDBClusterCDCSelectorSpec
}
```

## type [TiDBClusterTiDBSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L118-L121>)

TiDBClusterTiDBSelectorSpec specifies how to filter the tidb\-server instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select alls: All: true

```go
type TiDBClusterTiDBSelectorSpec struct {
    Peer *int
    All  bool
}
```

## type [TiDBClusterTiFlashSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L168-L183>)

TiDBClusterTiFlashSelectorSpec specifies how to filter the tikv\-server instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select the only leader instance: StoreLabelSelector: &metav1.LabelSelector\{ MatchLabels: map\[string\]string\{ "zone": "zone3", \}, \}, Or select alls: All: true

```go
type TiDBClusterTiFlashSelectorSpec struct {
    Peer *int
    // TODO mahjonp: create a LabelSelector
    //  mysql> select ADDRESS, LABEL from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  | ADDRESS                                                     | LABEL                                                                                                            |
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  | tc1-tikv-1.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-26"}, {"key": "zone", "value": "zone1"}]                                        |
    //  | tc1-tikv-0.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-28"}, {"key": "zone", "value": "zone2"}]                                        |
    //  | tc1-tikv-2.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-72"}, {"key": "zone", "value": "zone3"}]                                        |
    //  | tc1-tiflash-0.tc1-tiflash-peer.testbed-h2r9w.svc:3930 | [{"key": "engine", "value": "tiflash"}, {"key": "zone", "value": "zone3"}, {"key": "host", "value": "idc-4-71"}] |
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  4 rows in set (0.05 sec)
    StoreLabelSelector *v1.LabelSelector
    All                bool
}
```

## type [TiDBClusterTiKVSelectorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L137-L152>)

TiDBClusterTiKVSelectorSpec specifies how to filter the tikv\-server instances.

### Note that can only set one field one time

For example, to select the first instance: Peer: 0 Or select the only leader instance: StoreLabelSelector: &metav1.LabelSelector\{ MatchLabels: map\[string\]string\{ "zone": "zone3", \}, \}, Or select alls: All: true

```go
type TiDBClusterTiKVSelectorSpec struct {
    Peer *int
    // TODO mahjonp: create a LabelSelector
    //  mysql> select ADDRESS, LABEL from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  | ADDRESS                                                     | LABEL                                                                                                            |
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  | tc1-tikv-1.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-26"}, {"key": "zone", "value": "zone1"}]                                        |
    //  | tc1-tikv-0.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-28"}, {"key": "zone", "value": "zone2"}]                                        |
    //  | tc1-tikv-2.tc1-tikv-peer.testbed-h2r9w.svc:20160      | [{"key": "host", "value": "idc-4-72"}, {"key": "zone", "value": "zone3"}]                                        |
    //  | tc1-tiflash-0.tc1-tiflash-peer.testbed-h2r9w.svc:3930 | [{"key": "engine", "value": "tiflash"}, {"key": "zone", "value": "zone3"}, {"key": "host", "value": "idc-4-71"}] |
    //  +-------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
    //  4 rows in set (0.05 sec)
    StoreLabelSelector *v1.LabelSelector
    All                bool
}
```

## type [TiDBClusterUpdateConfigOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L304-L310>)

### TiDBClusterUpdateConfigOptions wraps config which needs to be applied to a component

For example to update a component's config: resource.TiDBClusterUpdateConfigOptions\{ Target:  sdkresource.TiKV, Config:  "\[rocksdb\]\\nmax\-open\-files = 128\\n\[storage\]\\nreserve\-space = \\"150MB\\"", Timeout: \<int\> \* time.Minute/time.Hour, \}

```go
type TiDBClusterUpdateConfigOptions struct {
    Target TiDBCompType
    // New configs that will override with the old config to a component
    Config string
    // Timeout wait for updating config, a timeout of 0 is interpreted as an infinity
    Timeout time.Duration
}
```

## type [TiDBClusterUpdateConfigsOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L319-L324>)

### TiDBClusterUpdateConfigsOptions wraps configs which needs to be applied to components

For example to update tidb and tikv configs: TiDBClusterUpdateConfigsOptions\{ Configs: map\[TiDBCompType\]string\{TiKV: "\[rocksdb\]\\\\nmax\-open\-files = 128\\\\n\[storage\]\\\\nreserve\-space = \\\\\\"150MB\\\\\\"", TiDB: "\[log\]\\nlevel = \\"debug\\""\}, Timeout: 5\*time.Minute, \}

```go
type TiDBClusterUpdateConfigsOptions struct {
    // New configs that will override with the old config to components
    Configs map[TiDBCompType]string
    // Timeout wait for updating config, a timeout of 0 is interpreted as an infinity
    Timeout time.Duration
}
```

## type [TiDBClusterUpgradeOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L327-L343>)

TiDBClusterUpgradeOptions wraps a version wants to upgrade to on target component node

```go
type TiDBClusterUpgradeOptions struct {
    // ComponentUpgradeOption is used to specify the single component to upgrade, cannot set ComponentUpgradeOption with Version the same time
    ComponentUpgradeOption *TiDBClusterComponentUpgradeOption

    // Version is like: v5.2.0 style or release-5.0, master, nightly etc.
    //
    // For K8s, the full image for a component is: <pd/tidb/tikv/pump/tiflash/ticdc>.baseImage + version
    //
    // For TiUP, only the Version field is needed
    Version string
    // OverrideComponentsUpgradeOption supports a way to set the specific component version(eg: the hotfix upgrade scenario)
    OverrideComponentsUpgradeOption []TiDBClusterComponentUpgradeOption

    // Timeout wait for scaling, a timeout of 0 is interpreted as an infinity
    // Remember that the timeout is affected by the duration of tikv EvictLeaderTimeout, don't forget to set the spec.tikv.EvictLeaderTimeout on the testbed
    Timeout time.Duration
}
```

## type [TiDBCompType](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L69>)

```go
type TiDBCompType int
```

```go
const (
    PD  TiDBCompType = iota
    TiKV
    TiDB
    TiCDC
    TiFlash
)
```

### func \(TiDBCompType\) [FromString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L71>)

```go
func (_ TiDBCompType) FromString(str string) (TiDBCompType, error)
```

### func \(TiDBCompType\) [String](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L88>)

```go
func (t TiDBCompType) String() string
```

## type [TiDBComponentNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/tidbcluster.go#L262-L265>)

TiDBComponentNode is the tidb component, tikv, pd, ticdc

```go
type TiDBComponentNode interface {
    Restart() error
    CleanData() error
}
```

## type [TiDBDrainer](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/drainer.go#L6-L9>)

TiDBDrainer is the tidb\-binlog drainer component interface

```go
type TiDBDrainer interface {
    core.Resource
    Exec(opts TiDBDrainerExecOptions) (stdout string, stderr string, exitCode int, err error)
}
```

## type [TiDBDrainerExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/drainer.go#L12-L15>)

TiDBDrainerExecOptions wraps the drainer execution option

```go
type TiDBDrainerExecOptions struct {
    Peer    int
    Command string
}
```

## type [TimeChaosSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L229-L243>)

TimeChaosSpec specifies the time skew

```go
type TimeChaosSpec struct {
    // A duration string is a possibly signed sequence of
    // decimal numbers, each with optional fraction and a unit suffix,
    // such as "300ms", "-1.5h" or "2h45m".
    // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    //
    // empty value means last until it's deleted
    Duration string
    // Scheduler and Duration should be omitted or defined at the same time
    Scheduler *ExperimentScheduler

    // TimeOffset specifies the time offset.
    // It is a duration string with specified unit, such as 300ms, -1.5h. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
    TimeOffset string
}
```

### func \(TimeChaosSpec\) [GoString](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L245>)

```go
func (t TimeChaosSpec) GoString() string
```

### func \(TimeChaosSpec\) [Kind](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/chaos.go#L249>)

```go
func (t TimeChaosSpec) Kind() ExperimentKind
```

## type [WorkloadNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/workloadnode.go#L11-L21>)

WorkloadNode is the workload node interface which is created pending and to exec\(\) when available

```go
type WorkloadNode interface {
    core.Resource
    Exec(opts WorkloadNodeExecOptions) (stdout string, stderr string, exitCode int, err error)
    // ExecAsync and ExecAsyncInterruptible will close stdout and stderr writer
    // if you use external writer such as os.stdout, add resource.NopCloser to wrap it
    ExecAsync(stdout io.WriteCloser, stderr io.WriteCloser, opts WorkloadNodeExecOptions) (remote RemoteCommander, err error)
    ExecAsyncInterruptible(stdout io.WriteCloser, opts WorkloadNodeExecOptions) (remote RemoteCommanderInterruptible, err error)
    WriteFile(opts WorkloadNodeWriteFileOptions) error
    ChaosSelect(selector WorkloadNodeSelectorOpts) ([]ChaosSelector, error)
    ChaosClient() ChaosClient
}
```

## type [WorkloadNodeExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/workloadnode.go#L23-L26>)

```go
type WorkloadNodeExecOptions struct {
    Command string
    Peer    int
}
```

## type [WorkloadNodeSelectorOpts](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/workloadnode.go#L35-L38>)

WorkloadNodeSelectorOpts defines how to select workload\_node

```go
type WorkloadNodeSelectorOpts struct {
    Peer int
    All  bool
}
```

## type [WorkloadNodeWriteFileOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/workloadnode.go#L28-L32>)

```go
type WorkloadNodeWriteFileOptions struct {
    Content  io.Reader
    FilePath string
    Peer     int
}
```

# k8s

```go
import "github.com/pingcap/test-infra/sdk/resource/impl/k8s"
```

## Index

- [Constants](<#constants>)
- [Variables](<#variables>)
- [func AddOwnerReference(obj *metav1.ObjectMeta, owner *unstructured.Unstructured)](<#func-addownerreference>)
- [func GetOwnerReferenceFromTestbed(k *KubeClientSet, testbed string) (*metav1.OwnerReference, error)](<#func-getownerreferencefromtestbed>)
- [func LoadConfig(kubeConfig string) (config *rest.Config, err error)](<#func-loadconfig>)
- [func MustUnmarshalYaml(b []byte, o interface{})](<#func-mustunmarshalyaml>)
- [func SetConfig(c Config)](<#func-setconfig>)
- [func TiDBCloudShootName(projectID string, cloudProvider string, region string) string](<#func-tidbcloudshootname>)
- [type BR](<#type-br>)
- [type BRClient](<#type-brclient>)
  - [func NewBRClient(k *KubeClientSet) BRClient](<#func-newbrclient>)
  - [func (t BRClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-brclient-artifact>)
  - [func (t BRClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-brclient-create>)
  - [func (t BRClient) Delete(handle apiresource.ResourceHandle) error](<#func-brclient-delete>)
  - [func (t BRClient) FQDN() string](<#func-brclient-fqdn>)
  - [func (t BRClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-brclient-get>)
  - [func (t BRClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-brclient-getendpoints>)
  - [func (t BRClient) ReserveEnv(_ apiresource.ResourceHandle, _ apiresource.GcReserveEnvAction) error](<#func-brclient-reserveenv>)
- [type BRGetter](<#type-brgetter>)
  - [func (t *BRGetter) Get() (core.Resource, error)](<#func-brgetter-get>)
- [type ChaosClient](<#type-chaosclient>)
  - [func (c *ChaosClient) Create(opts resource.InjectChaosOptions) (resource.ChaosIdentifier, error)](<#func-chaosclient-create>)
  - [func (c *ChaosClient) Delete(id resource.ChaosIdentifier) error](<#func-chaosclient-delete>)
- [type ChaosClientV2](<#type-chaosclientv2>)
  - [func (c *ChaosClientV2) Create(opts resource.InjectChaosOptions) (resource.ChaosIdentifier, error)](<#func-chaosclientv2-create>)
  - [func (c *ChaosClientV2) Delete(id resource.ChaosIdentifier) error](<#func-chaosclientv2-delete>)
- [type ChaosIdentifier](<#type-chaosidentifier>)
  - [func (c *ChaosIdentifier) HumanReadableName() string](<#func-chaosidentifier-humanreadablename>)
- [type Config](<#type-config>)
  - [func (c Config) Validate() error](<#func-config-validate>)
- [type DMCluster](<#type-dmcluster>)
  - [func (d *DMCluster) ChaosClient() resource.ChaosClient](<#func-dmcluster-chaosclient>)
  - [func (d *DMCluster) ChaosSelect(selector resource.DMClusterSelectorOpts) ([]resource.ChaosSelector, error)](<#func-dmcluster-chaosselect>)
  - [func (d *DMCluster) Exec(podName, containerName string, cmd ...string) (stdout string, stderr string, exitCode int, err error)](<#func-dmcluster-exec>)
  - [func (d *DMCluster) Handle() apiresource.ResourceHandle](<#func-dmcluster-handle>)
  - [func (d *DMCluster) Name() string](<#func-dmcluster-name>)
  - [func (d *DMCluster) Namespace() string](<#func-dmcluster-namespace>)
  - [func (d *DMCluster) Ready() bool](<#func-dmcluster-ready>)
  - [func (d *DMCluster) Sync() error](<#func-dmcluster-sync>)
  - [func (d *DMCluster) Upgrade(opts resource.DMClusterUpgradeOptions) error](<#func-dmcluster-upgrade>)
  - [func (d *DMCluster) WaitForReady(timeout time.Duration) error](<#func-dmcluster-waitforready>)
- [type DMClusterClient](<#type-dmclusterclient>)
  - [func NewDMClusterClient(k *KubeClientSet) DMClusterClient](<#func-newdmclusterclient>)
  - [func (d DMClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)](<#func-dmclusterclient-artifact>)
  - [func (d DMClusterClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-dmclusterclient-create>)
  - [func (d DMClusterClient) Delete(handle apiresource.ResourceHandle) error](<#func-dmclusterclient-delete>)
  - [func (d DMClusterClient) FQDN() string](<#func-dmclusterclient-fqdn>)
  - [func (d DMClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-dmclusterclient-get>)
  - [func (d DMClusterClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-dmclusterclient-getendpoints>)
  - [func (d DMClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-dmclusterclient-reserveenv>)
- [type ExecOptions](<#type-execoptions>)
- [type Images](<#type-images>)
  - [func (i Images) Validate() error](<#func-images-validate>)
- [type KafkaCluster](<#type-kafkacluster>)
  - [func (t *KafkaCluster) ChaosClient() resource.ChaosClient](<#func-kafkacluster-chaosclient>)
  - [func (t *KafkaCluster) ChaosSelect(selector resource.KafkaClusterSelectorOpts) ([]resource.ChaosSelector, error)](<#func-kafkacluster-chaosselect>)
  - [func (t *KafkaCluster) Exec(opts resource.KafkaClusterExecOptions) (stdout string, stderr string, exitCode int, err error)](<#func-kafkacluster-exec>)
  - [func (t *KafkaCluster) GetController() (*brokerInfo, error)](<#func-kafkacluster-getcontroller>)
  - [func (t *KafkaCluster) Handle() apiresource.ResourceHandle](<#func-kafkacluster-handle>)
  - [func (t *KafkaCluster) PeerURLs() ([]*url.URL, error)](<#func-kafkacluster-peerurls>)
  - [func (t *KafkaCluster) Ready() bool](<#func-kafkacluster-ready>)
  - [func (t *KafkaCluster) ServiceURL() (*url.URL, error)](<#func-kafkacluster-serviceurl>)
  - [func (t *KafkaCluster) SinkEndpoint() (*url.URL, error)](<#func-kafkacluster-sinkendpoint>)
  - [func (t *KafkaCluster) Sync() error](<#func-kafkacluster-sync>)
  - [func (t *KafkaCluster) ZookeeperURL() (*url.URL, error)](<#func-kafkacluster-zookeeperurl>)
- [type KafkaClusterClient](<#type-kafkaclusterclient>)
  - [func NewKafkaClusterClient(k *KubeClientSet) KafkaClusterClient](<#func-newkafkaclusterclient>)
  - [func (t KafkaClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-kafkaclusterclient-artifact>)
  - [func (t KafkaClusterClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-kafkaclusterclient-create>)
  - [func (t KafkaClusterClient) Delete(handle apiresource.ResourceHandle) error](<#func-kafkaclusterclient-delete>)
  - [func (t KafkaClusterClient) FQDN() string](<#func-kafkaclusterclient-fqdn>)
  - [func (t KafkaClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-kafkaclusterclient-get>)
  - [func (t KafkaClusterClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-kafkaclusterclient-getendpoints>)
  - [func (t KafkaClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-kafkaclusterclient-reserveenv>)
- [type KubeClientSet](<#type-kubeclientset>)
  - [func NewKubeClient(namespace string, clientConfig *rest.Config, kubeConfig string, clientSet kubernetes.Interface, dynamicClient dynamic.Interface) *KubeClientSet](<#func-newkubeclient>)
  - [func NewKubeClientFromKubeConfig(namespace string, kubeConfig string) (*KubeClientSet, error)](<#func-newkubeclientfromkubeconfig>)
  - [func NewKubeClientFromKubeConfigData(namespace string, kubeConfigData []byte) (*KubeClientSet, error)](<#func-newkubeclientfromkubeconfigdata>)
  - [func (ku *KubeClientSet) AddResourceSpecToConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string, spec json.RawMessage) error](<#func-kubeclientset-addresourcespectoconfigmap>)
  - [func (ku *KubeClientSet) DeletePod(name string) error](<#func-kubeclientset-deletepod>)
  - [func (ku *KubeClientSet) ExecCommandInContainerWithAsyncOutput(stdout, stderr io.WriteCloser, podName, containerName string, cmd ...string) (resource.RemoteCommander, error)](<#func-kubeclientset-execcommandincontainerwithasyncoutput>)
  - [func (ku *KubeClientSet) ExecCommandInContainerWithAsyncOutputInterruptible(stdout io.WriteCloser, podName, containerName string, cmd ...string) (resource.RemoteCommanderInterruptible, error)](<#func-kubeclientset-execcommandincontainerwithasyncoutputinterruptible>)
  - [func (ku *KubeClientSet) ExecCommandInContainerWithFullOutput(podName, containerName string, cmd ...string) (string, string, *int, error)](<#func-kubeclientset-execcommandincontainerwithfulloutput>)
  - [func (ku *KubeClientSet) ExecWithOptions(options ExecOptions) (string, string, *int, error)](<#func-kubeclientset-execwithoptions>)
  - [func (ku *KubeClientSet) GetResourceSpecFromConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string) (json.RawMessage, error)](<#func-kubeclientset-getresourcespecfromconfigmap>)
  - [func (ku *KubeClientSet) ListPods(labelMap map[string]string) ([]string, error)](<#func-kubeclientset-listpods>)
  - [func (ku *KubeClientSet) RemoveResourceSpecFromConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string) error](<#func-kubeclientset-removeresourcespecfromconfigmap>)
  - [func (ku *KubeClientSet) TarStreamFrom(podName string, containerName string, path string) io.ReadCloser](<#func-kubeclientset-tarstreamfrom>)
  - [func (ku *KubeClientSet) WriteFileInContainer(podName string, containerName string, content io.Reader, filepath string) error](<#func-kubeclientset-writefileincontainer>)
- [type LightningClient](<#type-lightningclient>)
  - [func NewLightningClient(k *KubeClientSet) LightningClient](<#func-newlightningclient>)
  - [func (t LightningClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-lightningclient-artifact>)
  - [func (t LightningClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-lightningclient-create>)
  - [func (t LightningClient) Delete(handle apiresource.ResourceHandle) error](<#func-lightningclient-delete>)
  - [func (t LightningClient) FQDN() string](<#func-lightningclient-fqdn>)
  - [func (t LightningClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-lightningclient-get>)
  - [func (t LightningClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-lightningclient-getendpoints>)
  - [func (t LightningClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-lightningclient-reserveenv>)
- [type LightningGetter](<#type-lightninggetter>)
  - [func (t *LightningGetter) Get() (core.Resource, error)](<#func-lightninggetter-get>)
- [type LoadBalancer](<#type-loadbalancer>)
  - [func (l *LoadBalancer) Endpoint() (domainName string, port int)](<#func-loadbalancer-endpoint>)
  - [func (l *LoadBalancer) Handle() apiresource.ResourceHandle](<#func-loadbalancer-handle>)
  - [func (l *LoadBalancer) Sync() error](<#func-loadbalancer-sync>)
- [type LoadBalancerClient](<#type-loadbalancerclient>)
  - [func NewLoadBalancerClient(k *KubeClientSet) LoadBalancerClient](<#func-newloadbalancerclient>)
  - [func (l LoadBalancerClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)](<#func-loadbalancerclient-artifact>)
  - [func (l LoadBalancerClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-loadbalancerclient-create>)
  - [func (l LoadBalancerClient) Delete(handle apiresource.ResourceHandle) error](<#func-loadbalancerclient-delete>)
  - [func (l LoadBalancerClient) FQDN() string](<#func-loadbalancerclient-fqdn>)
  - [func (l LoadBalancerClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-loadbalancerclient-get>)
  - [func (l LoadBalancerClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-loadbalancerclient-getendpoints>)
  - [func (l LoadBalancerClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-loadbalancerclient-reserveenv>)
- [type LoadBalancerGetter](<#type-loadbalancergetter>)
  - [func (t *LoadBalancerGetter) Get() (core.Resource, error)](<#func-loadbalancergetter-get>)
- [type MySQLClient](<#type-mysqlclient>)
  - [func NewMySQLClient(k *KubeClientSet) MySQLClient](<#func-newmysqlclient>)
  - [func (t MySQLClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-mysqlclient-artifact>)
  - [func (t MySQLClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-mysqlclient-create>)
  - [func (t MySQLClient) Delete(handle apiresource.ResourceHandle) error](<#func-mysqlclient-delete>)
  - [func (t MySQLClient) FQDN() string](<#func-mysqlclient-fqdn>)
  - [func (t MySQLClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-mysqlclient-get>)
  - [func (t MySQLClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-mysqlclient-getendpoints>)
  - [func (t MySQLClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-mysqlclient-reserveenv>)
- [type MySQLClusterConfig](<#type-mysqlclusterconfig>)
- [type MySQLClusterReadyCheckConfig](<#type-mysqlclusterreadycheckconfig>)
- [type MySQLGetter](<#type-mysqlgetter>)
  - [func (t *MySQLGetter) Get() (core.Resource, error)](<#func-mysqlgetter-get>)
- [type MySQLNode](<#type-mysqlnode>)
  - [func (t *MySQLNode) GetDB(dbName string) (db *sql.DB, err error)](<#func-mysqlnode-getdb>)
  - [func (t *MySQLNode) Name() string](<#func-mysqlnode-name>)
  - [func (t *MySQLNode) Namespace() string](<#func-mysqlnode-namespace>)
  - [func (t *MySQLNode) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)](<#func-mysqlnode-peerurls>)
  - [func (t *MySQLNode) Ping() error](<#func-mysqlnode-ping>)
  - [func (t *MySQLNode) Ready() bool](<#func-mysqlnode-ready>)
  - [func (t *MySQLNode) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)](<#func-mysqlnode-serviceurl>)
  - [func (t *MySQLNode) SinkEndpoint() (*url.URL, error)](<#func-mysqlnode-sinkendpoint>)
- [type PodSelector](<#type-podselector>)
  - [func (p *PodSelector) HumanReadableName() string](<#func-podselector-humanreadablename>)
- [type RemoteCommander](<#type-remotecommander>)
  - [func (j *RemoteCommander) Interrupt() error](<#func-remotecommander-interrupt>)
  - [func (j *RemoteCommander) Wait() resource.RemoteCommandErr](<#func-remotecommander-wait>)
- [type RequeueError](<#type-requeueerror>)
  - [func (re *RequeueError) Error() string](<#func-requeueerror-error>)
- [type Testbed](<#type-testbed>)
  - [func (t *Testbed) GetSpec() (*request.CreateTestbedRequest, error)](<#func-testbed-getspec>)
  - [func (t *Testbed) Handle() apiresource.ResourceHandle](<#func-testbed-handle>)
- [type TestbedClient](<#type-testbedclient>)
  - [func NewTestbedClient(k *KubeClientSet) TestbedClient](<#func-newtestbedclient>)
  - [func (t TestbedClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)](<#func-testbedclient-artifact>)
  - [func (t TestbedClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-testbedclient-create>)
  - [func (t TestbedClient) Delete(handle apiresource.ResourceHandle) error](<#func-testbedclient-delete>)
  - [func (t TestbedClient) FQDN() string](<#func-testbedclient-fqdn>)
  - [func (t TestbedClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-testbedclient-get>)
  - [func (t TestbedClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-testbedclient-getendpoints>)
  - [func (t TestbedClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-testbedclient-reserveenv>)
- [type TiDBCloudCluster](<#type-tidbcloudcluster>)
  - [func (t *TiDBCloudCluster) Backup(ctx context.Context, opts resource.TiDBCloudBackupOptions) (string, error)](<#func-tidbcloudcluster-backup>)
  - [func (t *TiDBCloudCluster) ChaosClient() resource.ChaosClient](<#func-tidbcloudcluster-chaosclient>)
  - [func (t *TiDBCloudCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)](<#func-tidbcloudcluster-chaosselect>)
  - [func (t *TiDBCloudCluster) GetDB(dbName string) (*sql.DB, error)](<#func-tidbcloudcluster-getdb>)
  - [func (t *TiDBCloudCluster) GetSpec() apiresource.TiDBCloudClusterSpec](<#func-tidbcloudcluster-getspec>)
  - [func (t *TiDBCloudCluster) GetStatus() (*apiresource.TiDBCloudClusterStatus, error)](<#func-tidbcloudcluster-getstatus>)
  - [func (t *TiDBCloudCluster) Handle() apiresource.ResourceHandle](<#func-tidbcloudcluster-handle>)
  - [func (t *TiDBCloudCluster) Import(ctx context.Context, options resource.TiDBCloudImportOptions) error](<#func-tidbcloudcluster-import>)
  - [func (t *TiDBCloudCluster) InplaceRestore(ctx context.Context, opts resource.TiDBCloudInplaceRestoreOptions) error](<#func-tidbcloudcluster-inplacerestore>)
  - [func (t *TiDBCloudCluster) PrometheusAPI() (prometheus_api.API, error)](<#func-tidbcloudcluster-prometheusapi>)
  - [func (t *TiDBCloudCluster) ResetCluster() error](<#func-tidbcloudcluster-resetcluster>)
  - [func (t *TiDBCloudCluster) Restore(ctx context.Context, opts resource.TiDBCloudRestoreOptions) (resource.TiDBCloudCluster, error)](<#func-tidbcloudcluster-restore>)
  - [func (t *TiDBCloudCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)](<#func-tidbcloudcluster-serviceurl>)
  - [func (t *TiDBCloudCluster) Sync() error](<#func-tidbcloudcluster-sync>)
  - [func (t *TiDBCloudCluster) SyncWithoutPing() error](<#func-tidbcloudcluster-syncwithoutping>)
  - [func (t *TiDBCloudCluster) WaitForReady(timeout time.Duration) error](<#func-tidbcloudcluster-waitforready>)
- [type TiDBCloudClusterClient](<#type-tidbcloudclusterclient>)
  - [func NewTiDBCloudClusterClient(k *KubeClientSet, config *tidbcloud.TiDBCloudConfiguration) (*TiDBCloudClusterClient, error)](<#func-newtidbcloudclusterclient>)
  - [func (t TiDBCloudClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)](<#func-tidbcloudclusterclient-artifact>)
  - [func (t TiDBCloudClusterClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-tidbcloudclusterclient-create>)
  - [func (t TiDBCloudClusterClient) Delete(handle apiresource.ResourceHandle) error](<#func-tidbcloudclusterclient-delete>)
  - [func (t TiDBCloudClusterClient) FQDN() string](<#func-tidbcloudclusterclient-fqdn>)
  - [func (t TiDBCloudClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-tidbcloudclusterclient-get>)
  - [func (t TiDBCloudClusterClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-tidbcloudclusterclient-getendpoints>)
  - [func (t TiDBCloudClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-tidbcloudclusterclient-reserveenv>)
- [type TiDBCloudClusterConfig](<#type-tidbcloudclusterconfig>)
- [type TiDBCloudClusterReadyCheckConfig](<#type-tidbcloudclusterreadycheckconfig>)
- [type TiDBCloudKubeClientSet](<#type-tidbcloudkubeclientset>)
  - [func NewFakeTiDBCloudClient() TiDBCloudKubeClientSet](<#func-newfaketidbcloudclient>)
  - [func NewTiDBCloudKubeClientSet(config *tidbcloud.TiDBCloudConfiguration) (TiDBCloudKubeClientSet, error)](<#func-newtidbcloudkubeclientset>)
- [type TiDBCloudObjectController](<#type-tidbcloudobjectcontroller>)
  - [func NewTiDBCloudClusterController(clientSet kubernetes.Interface, tidbCloudKubeClientSet TiDBCloudKubeClientSet, configuration tidbcloud.TiDBCloudConfiguration) (*TiDBCloudObjectController, error)](<#func-newtidbcloudclustercontroller>)
  - [func (t *TiDBCloudObjectController) StartUntil(context context.Context, workers int) error](<#func-tidbcloudobjectcontroller-startuntil>)
- [type TiDBCluster](<#type-tidbcluster>)
  - [func (t *TiDBCluster) ChaosClient() resource.ChaosClient](<#func-tidbcluster-chaosclient>)
  - [func (t *TiDBCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)](<#func-tidbcluster-chaosselect>)
  - [func (t *TiDBCluster) Exec(opts resource.TiDBClusterExecOptions) (stdout string, stderr string, exitCode int, err error)](<#func-tidbcluster-exec>)
  - [func (t *TiDBCluster) GetDB(dbName string) (db *sql.DB, err error)](<#func-tidbcluster-getdb>)
  - [func (t *TiDBCluster) GetNodes(comp resource.TiDBCompType) ([]resource.TiDBComponentNode, error)](<#func-tidbcluster-getnodes>)
  - [func (t *TiDBCluster) GetSpec(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentSpec, error)](<#func-tidbcluster-getspec>)
  - [func (t *TiDBCluster) GetStatus(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentStatus, error)](<#func-tidbcluster-getstatus>)
  - [func (t *TiDBCluster) Handle() apiresource.ResourceHandle](<#func-tidbcluster-handle>)
  - [func (t *TiDBCluster) Name() string](<#func-tidbcluster-name>)
  - [func (t *TiDBCluster) Namespace() string](<#func-tidbcluster-namespace>)
  - [func (t *TiDBCluster) PDClient() (*pdutil.Client, error)](<#func-tidbcluster-pdclient>)
  - [func (t *TiDBCluster) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)](<#func-tidbcluster-peerurls>)
  - [func (t *TiDBCluster) PrometheusAPI() (prometheus_api.API, error)](<#func-tidbcluster-prometheusapi>)
  - [func (t *TiDBCluster) PrometheusClient() (prometheus.Client, error)](<#func-tidbcluster-prometheusclient>)
  - [func (t *TiDBCluster) Scale(opts resource.TiDBClusterScaleOptions) error](<#func-tidbcluster-scale>)
  - [func (t *TiDBCluster) SearchLog(ctx context.Context, opts resource.TiDBClusterSearchLogOptions) ([]string, error)](<#func-tidbcluster-searchlog>)
  - [func (t *TiDBCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)](<#func-tidbcluster-serviceurl>)
  - [func (t *TiDBCluster) SinkEndpoint() (*url.URL, error)](<#func-tidbcluster-sinkendpoint>)
  - [func (t *TiDBCluster) SyncTiDBCluster() error](<#func-tidbcluster-synctidbcluster>)
  - [func (t *TiDBCluster) UpdateConfig(opts resource.TiDBClusterUpdateConfigOptions) error](<#func-tidbcluster-updateconfig>)
  - [func (t *TiDBCluster) UpdateConfigAsync(opts resource.TiDBClusterUpdateConfigOptions) (err error)](<#func-tidbcluster-updateconfigasync>)
  - [func (t *TiDBCluster) UpdateConfigs(opts resource.TiDBClusterUpdateConfigsOptions) error](<#func-tidbcluster-updateconfigs>)
  - [func (t *TiDBCluster) Upgrade(opts resource.TiDBClusterUpgradeOptions) error](<#func-tidbcluster-upgrade>)
  - [func (t *TiDBCluster) WaitForReady(timeout time.Duration) error](<#func-tidbcluster-waitforready>)
  - [func (t *TiDBCluster) WatchOOM(ctx context.Context, opts resource.TiDBClusterOOMWatchOptions) (<-chan resource.OOMEvent, error)](<#func-tidbcluster-watchoom>)
- [type TiDBClusterClient](<#type-tidbclusterclient>)
  - [func NewTiDBClusterClient(k *KubeClientSet) TiDBClusterClient](<#func-newtidbclusterclient>)
  - [func (t TiDBClusterClient) ApplyRawClusterSpec(defaultSpec *map[string]interface{}, rawSpec map[string]interface{}) error](<#func-tidbclusterclient-applyrawclusterspec>)
  - [func (t TiDBClusterClient) ApplyRawMonitorSpec(destSpec *map[string]interface{}, rawSpec map[string]interface{}) error](<#func-tidbclusterclient-applyrawmonitorspec>)
  - [func (t TiDBClusterClient) ApplyRawNGMonitorSpec(destSpec map[string]interface{}, rawSpec map[string]interface{}) error](<#func-tidbclusterclient-applyrawngmonitorspec>)
  - [func (t TiDBClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)](<#func-tidbclusterclient-artifact>)
  - [func (t TiDBClusterClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-tidbclusterclient-create>)
  - [func (t TiDBClusterClient) Delete(handle apiresource.ResourceHandle) error](<#func-tidbclusterclient-delete>)
  - [func (t TiDBClusterClient) FQDN() string](<#func-tidbclusterclient-fqdn>)
  - [func (t TiDBClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-tidbclusterclient-get>)
  - [func (t TiDBClusterClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-tidbclusterclient-getendpoints>)
  - [func (t TiDBClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-tidbclusterclient-reserveenv>)
- [type TiDBClusterConfig](<#type-tidbclusterconfig>)
- [type TiDBClusterReadyCheckConfig](<#type-tidbclusterreadycheckconfig>)
- [type TiDBClusterSpecValidator](<#type-tidbclusterspecvalidator>)
- [type TiDBDrainer](<#type-tidbdrainer>)
  - [func (t *TiDBDrainer) CheckResourceExist() error](<#func-tidbdrainer-checkresourceexist>)
  - [func (t *TiDBDrainer) Exec(opts resource.TiDBDrainerExecOptions) (stdout string, stderr string, exitCode int, err error)](<#func-tidbdrainer-exec>)
  - [func (t *TiDBDrainer) Handle() apiresource.ResourceHandle](<#func-tidbdrainer-handle>)
  - [func (t *TiDBDrainer) Ready() bool](<#func-tidbdrainer-ready>)
  - [func (t *TiDBDrainer) Sync() error](<#func-tidbdrainer-sync>)
- [type TiDBDrainerClient](<#type-tidbdrainerclient>)
  - [func NewTiDBDrainerClient(k *KubeClientSet) TiDBDrainerClient](<#func-newtidbdrainerclient>)
  - [func (t TiDBDrainerClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-tidbdrainerclient-artifact>)
  - [func (t TiDBDrainerClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-tidbdrainerclient-create>)
  - [func (t TiDBDrainerClient) Delete(handle apiresource.ResourceHandle) error](<#func-tidbdrainerclient-delete>)
  - [func (t TiDBDrainerClient) FQDN() string](<#func-tidbdrainerclient-fqdn>)
  - [func (t TiDBDrainerClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-tidbdrainerclient-get>)
  - [func (t TiDBDrainerClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-tidbdrainerclient-getendpoints>)
  - [func (t TiDBDrainerClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-tidbdrainerclient-reserveenv>)
- [type TiDBLightning](<#type-tidblightning>)
- [type WorkloadNode](<#type-workloadnode>)
  - [func (t *WorkloadNode) ChaosClient() resource.ChaosClient](<#func-workloadnode-chaosclient>)
  - [func (t *WorkloadNode) ChaosSelect(selector resource.WorkloadNodeSelectorOpts) ([]resource.ChaosSelector, error)](<#func-workloadnode-chaosselect>)
  - [func (t *WorkloadNode) Exec(opts resource.WorkloadNodeExecOptions) (stdout string, stderr string, exitCode int, err error)](<#func-workloadnode-exec>)
  - [func (t *WorkloadNode) ExecAsync(stdout io.WriteCloser, stderr io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommander, err error)](<#func-workloadnode-execasync>)
  - [func (t *WorkloadNode) ExecAsyncInterruptible(stdout io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommanderInterruptible, err error)](<#func-workloadnode-execasyncinterruptible>)
  - [func (t *WorkloadNode) Handle() apiresource.ResourceHandle](<#func-workloadnode-handle>)
  - [func (t *WorkloadNode) Ready() bool](<#func-workloadnode-ready>)
  - [func (t *WorkloadNode) Sync() error](<#func-workloadnode-sync>)
  - [func (t *WorkloadNode) WriteFile(opts resource.WorkloadNodeWriteFileOptions) error](<#func-workloadnode-writefile>)
- [type WorkloadNodeClient](<#type-workloadnodeclient>)
  - [func NewWorkloadNodeClient(k *KubeClientSet) WorkloadNodeClient](<#func-newworkloadnodeclient>)
  - [func (t WorkloadNodeClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)](<#func-workloadnodeclient-artifact>)
  - [func (t WorkloadNodeClient) Create(spec json.RawMessage) (core.Resource, error)](<#func-workloadnodeclient-create>)
  - [func (t WorkloadNodeClient) Delete(handle apiresource.ResourceHandle) error](<#func-workloadnodeclient-delete>)
  - [func (t WorkloadNodeClient) FQDN() string](<#func-workloadnodeclient-fqdn>)
  - [func (t WorkloadNodeClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)](<#func-workloadnodeclient-get>)
  - [func (t WorkloadNodeClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)](<#func-workloadnodeclient-getendpoints>)
  - [func (t WorkloadNodeClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error](<#func-workloadnodeclient-reserveenv>)


## Constants

```go
const (
    TestInfraName = "test-infra/name"
)
```

## Variables

```go
var ErrUpgradeTimeout = fmt.Errorf("upgrade the cluster timeout")
```

## func [AddOwnerReference](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/util.go#L59>)

```go
func AddOwnerReference(obj *metav1.ObjectMeta, owner *unstructured.Unstructured)
```

## func [GetOwnerReferenceFromTestbed](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/util.go#L40>)

```go
func GetOwnerReferenceFromTestbed(k *KubeClientSet, testbed string) (*metav1.OwnerReference, error)
```

FIXME\(@mahjonp\): check exists & replace with the testbed CR object in future

## func [LoadConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/util.go#L31>)

```go
func LoadConfig(kubeConfig string) (config *rest.Config, err error)
```

LoadConfig loads a rest.Config

## func [MustUnmarshalYaml](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L654>)

```go
func MustUnmarshalYaml(b []byte, o interface{})
```

## func [SetConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L84>)

```go
func SetConfig(c Config)
```

## func [TiDBCloudShootName](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/util.go#L169>)

```go
func TiDBCloudShootName(projectID string, cloudProvider string, region string) string
```

copied from https://github.com/tidbcloud/config-service/blob/e4d7ca7c8e2e2733b1ad738046c0b7856bcd4f24/gardener/util.go#L48

## type [BR](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br.go#L9-L11>)

```go
type BR struct {
    WorkloadNode
}
```

## type [BRClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L19-L21>)

```go
type BRClient struct {
    WorkloadNodeClient
}
```

### func [NewBRClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L23>)

```go
func NewBRClient(k *KubeClientSet) BRClient
```

### func \(BRClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L85>)

```go
func (t BRClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(BRClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L44>)

```go
func (t BRClient) Create(spec json.RawMessage) (core.Resource, error)
```

Create ...

```
_, err := client.Create([]byte(`{
```

```
"name": "br",
"testbed": "testbed-1",
"type": "BR_NODE",
"spec": {
    "image": "docker.io/pingcap/br:v5.0.1",
    "resources": {
        "requests": {
            "memory": "64Mi",
            "cpu": "250m",
            "storage": "1Gi"
        }
    }
}
```

```
}`))
```

### func \(BRClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L73>)

```go
func (t BRClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(BRClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L77>)

```go
func (t BRClient) FQDN() string
```

### func \(BRClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L61>)

```go
func (t BRClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(BRClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L69>)

```go
func (t BRClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(BRClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L81>)

```go
func (t BRClient) ReserveEnv(_ apiresource.ResourceHandle, _ apiresource.GcReserveEnvAction) error
```

## type [BRGetter](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L131>)

```go
type BRGetter struct {
    // contains filtered or unexported fields
}
```

### func \(\*BRGetter\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/br_client.go#L133>)

```go
func (t *BRGetter) Get() (core.Resource, error)
```

## type [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaos.go#L58-L60>)

```go
type ChaosClient struct {
    KubeClientSet
}
```

### func \(\*ChaosClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaos.go#L72>)

```go
func (c *ChaosClient) Create(opts resource.InjectChaosOptions) (resource.ChaosIdentifier, error)
```

### func \(\*ChaosClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaos.go#L92>)

```go
func (c *ChaosClient) Delete(id resource.ChaosIdentifier) error
```

## type [ChaosClientV2](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaosv2.go#L28-L30>)

```go
type ChaosClientV2 struct {
    KubeClientSet
}
```

### func \(\*ChaosClientV2\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaosv2.go#L32>)

```go
func (c *ChaosClientV2) Create(opts resource.InjectChaosOptions) (resource.ChaosIdentifier, error)
```

### func \(\*ChaosClientV2\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaosv2.go#L58>)

```go
func (c *ChaosClientV2) Delete(id resource.ChaosIdentifier) error
```

## type [ChaosIdentifier](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaos.go#L62-L66>)

```go
type ChaosIdentifier struct {
    Namespace string
    Name      string
    Spec      resource.ExperimentSpec
}
```

### func \(\*ChaosIdentifier\) [HumanReadableName](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/chaos.go#L68>)

```go
func (c *ChaosIdentifier) HumanReadableName() string
```

## type [Config](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L14-L19>)

```go
type Config struct {
    TiDBCluster            TiDBClusterConfig      `yaml:"tidbCluster"`
    MySQLCluster           MySQLClusterConfig     `yaml:"mysqlCluster"`
    TiDBCloudClusterConfig TiDBCloudClusterConfig `yaml:"tidbCloudCluster"`
    Images                 Images                 `yaml:"images"`
}
```

### func \(Config\) [Validate](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L21>)

```go
func (c Config) Validate() error
```

## type [DMCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L32-L37>)

```go
type DMCluster struct {
    KubeClientSet
    apiresource.DMCluster
    // contains filtered or unexported fields
}
```

### func \(\*DMCluster\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L200>)

```go
func (d *DMCluster) ChaosClient() resource.ChaosClient
```

### func \(\*DMCluster\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L204>)

```go
func (d *DMCluster) ChaosSelect(selector resource.DMClusterSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*DMCluster\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L47>)

```go
func (d *DMCluster) Exec(podName, containerName string, cmd ...string) (stdout string, stderr string, exitCode int, err error)
```

### func \(\*DMCluster\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L39>)

```go
func (d *DMCluster) Handle() apiresource.ResourceHandle
```

### func \(\*DMCluster\) [Name](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L43>)

```go
func (d *DMCluster) Name() string
```

### func \(\*DMCluster\) [Namespace](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L45>)

```go
func (d *DMCluster) Namespace() string
```

### func \(\*DMCluster\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L76>)

```go
func (d *DMCluster) Ready() bool
```

### func \(\*DMCluster\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L84>)

```go
func (d *DMCluster) Sync() error
```

### func \(\*DMCluster\) [Upgrade](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L120>)

```go
func (d *DMCluster) Upgrade(opts resource.DMClusterUpgradeOptions) error
```

### func \(\*DMCluster\) [WaitForReady](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster.go#L65>)

```go
func (d *DMCluster) WaitForReady(timeout time.Duration) error
```

## type [DMClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L53-L55>)

```go
type DMClusterClient struct {
    *KubeClientSet
}
```

### func [NewDMClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L57>)

```go
func NewDMClusterClient(k *KubeClientSet) DMClusterClient
```

### func \(DMClusterClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L147>)

```go
func (d DMClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(DMClusterClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L61>)

```go
func (d DMClusterClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(DMClusterClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L103>)

```go
func (d DMClusterClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(DMClusterClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L182>)

```go
func (d DMClusterClient) FQDN() string
```

### func \(DMClusterClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L85>)

```go
func (d DMClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(DMClusterClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L99>)

```go
func (d DMClusterClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(DMClusterClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/dmcluster_client.go#L143>)

```go
func (d DMClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [ExecOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L98-L108>)

ExecOptions passed to ExecWithOptions

```go
type ExecOptions struct {
    Command       []string
    Namespace     string
    PodName       string
    ContainerName string
    Stdin         io.Reader
    CaptureStdout bool
    CaptureStderr bool
    // If false, whitespace in std{err,out} will be removed.
    PreserveWhitespace bool
}
```

## type [Images](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L30-L33>)

```go
type Images struct {
    SDKServer string `yaml:"sdkServer"`
    TCSetup   string `yaml:"tcSetup"`
}
```

### func \(Images\) [Validate](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L35>)

```go
func (i Images) Validate() error
```

## type [KafkaCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L27-L38>)

```go
type KafkaCluster struct {
    KubeClientSet
    // api object
    apiresource.KafkaCluster
    // contains filtered or unexported fields
}
```

### func \(\*KafkaCluster\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L270>)

```go
func (t *KafkaCluster) ChaosClient() resource.ChaosClient
```

### func \(\*KafkaCluster\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L274>)

```go
func (t *KafkaCluster) ChaosSelect(selector resource.KafkaClusterSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*KafkaCluster\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L77>)

```go
func (t *KafkaCluster) Exec(opts resource.KafkaClusterExecOptions) (stdout string, stderr string, exitCode int, err error)
```

### func \(\*KafkaCluster\) [GetController](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L123>)

```go
func (t *KafkaCluster) GetController() (*brokerInfo, error)
```

### func \(\*KafkaCluster\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L40>)

```go
func (t *KafkaCluster) Handle() apiresource.ResourceHandle
```

### func \(\*KafkaCluster\) [PeerURLs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L60>)

```go
func (t *KafkaCluster) PeerURLs() ([]*url.URL, error)
```

### func \(\*KafkaCluster\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L154>)

```go
func (t *KafkaCluster) Ready() bool
```

### func \(\*KafkaCluster\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L49>)

```go
func (t *KafkaCluster) ServiceURL() (*url.URL, error)
```

ServiceURL can be used to get kafka endpoint

### func \(\*KafkaCluster\) [SinkEndpoint](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L44>)

```go
func (t *KafkaCluster) SinkEndpoint() (*url.URL, error)
```

### func \(\*KafkaCluster\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L159>)

```go
func (t *KafkaCluster) Sync() error
```

Sync syncs from the k8s object to api object

### func \(\*KafkaCluster\) [ZookeeperURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka.go#L55>)

```go
func (t *KafkaCluster) ZookeeperURL() (*url.URL, error)
```

ZookeeperURL can be used to get zookeeper endpoint

## type [KafkaClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L35-L37>)

```go
type KafkaClusterClient struct {
    *KubeClientSet
}
```

### func [NewKafkaClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L39>)

```go
func NewKafkaClusterClient(k *KubeClientSet) KafkaClusterClient
```

### func \(KafkaClusterClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L134>)

```go
func (t KafkaClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(KafkaClusterClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L43>)

```go
func (t KafkaClusterClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(KafkaClusterClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L113>)

```go
func (t KafkaClusterClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(KafkaClusterClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L138>)

```go
func (t KafkaClusterClient) FQDN() string
```

### func \(KafkaClusterClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L95>)

```go
func (t KafkaClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(KafkaClusterClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L109>)

```go
func (t KafkaClusterClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(KafkaClusterClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/kafka_client.go#L130>)

```go
func (t KafkaClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [KubeClientSet](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L31-L37>)

KubeClientSet supports common operations used by sdk; it keeps some clients and a namespace.

```go
type KubeClientSet struct {
    Namespace string

    ClientSet     kubernetes.Interface
    DynamicClient dynamic.Interface
    // contains filtered or unexported fields
}
```

### func [NewKubeClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L87>)

```go
func NewKubeClient(namespace string, clientConfig *rest.Config, kubeConfig string, clientSet kubernetes.Interface, dynamicClient dynamic.Interface) *KubeClientSet
```

NewKubeClient creates a KubeClientSet instance

### func [NewKubeClientFromKubeConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L40>)

```go
func NewKubeClientFromKubeConfig(namespace string, kubeConfig string) (*KubeClientSet, error)
```

NewKubeClientFromKubeConfig creates a KubeClientSet instance from the namespace and kubeConfig

### func [NewKubeClientFromKubeConfigData](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L64>)

```go
func NewKubeClientFromKubeConfigData(namespace string, kubeConfigData []byte) (*KubeClientSet, error)
```

NewKubeClientFromKubeConfigData creates a KubeClientSet instance from the namespace and kubeConfigData

### func \(\*KubeClientSet\) [AddResourceSpecToConfigMap](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L353>)

```go
func (ku *KubeClientSet) AddResourceSpecToConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string, spec json.RawMessage) error
```

### func \(\*KubeClientSet\) [DeletePod](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L423>)

```go
func (ku *KubeClientSet) DeletePod(name string) error
```

### func \(\*KubeClientSet\) [ExecCommandInContainerWithAsyncOutput](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L250>)

```go
func (ku *KubeClientSet) ExecCommandInContainerWithAsyncOutput(stdout, stderr io.WriteCloser, podName, containerName string, cmd ...string) (resource.RemoteCommander, error)
```

### func \(\*KubeClientSet\) [ExecCommandInContainerWithAsyncOutputInterruptible](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L202>)

```go
func (ku *KubeClientSet) ExecCommandInContainerWithAsyncOutputInterruptible(stdout io.WriteCloser, podName, containerName string, cmd ...string) (resource.RemoteCommanderInterruptible, error)
```

### func \(\*KubeClientSet\) [ExecCommandInContainerWithFullOutput](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L150>)

```go
func (ku *KubeClientSet) ExecCommandInContainerWithFullOutput(podName, containerName string, cmd ...string) (string, string, *int, error)
```

ExecCommandInContainerWithFullOutput executes a command in the specified container and return stdout, stderr, exit code\(optional\) and error

### func \(\*KubeClientSet\) [ExecWithOptions](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L113>)

```go
func (ku *KubeClientSet) ExecWithOptions(options ExecOptions) (string, string, *int, error)
```

ExecWithOptions executes a command in the specified container, returning stdout, stderr, exit code\(optional\) and error. \`options\` allowed for additional parameters to be passed.

### func \(\*KubeClientSet\) [GetResourceSpecFromConfigMap](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L365>)

```go
func (ku *KubeClientSet) GetResourceSpecFromConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string) (json.RawMessage, error)
```

### func \(\*KubeClientSet\) [ListPods](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L411>)

```go
func (ku *KubeClientSet) ListPods(labelMap map[string]string) ([]string, error)
```

### func \(\*KubeClientSet\) [RemoveResourceSpecFromConfigMap](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L375>)

```go
func (ku *KubeClientSet) RemoveResourceSpecFromConfigMap(resourceHandle apiresource.ResourceHandle, configMapName string) error
```

### func \(\*KubeClientSet\) [TarStreamFrom](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L326>)

```go
func (ku *KubeClientSet) TarStreamFrom(podName string, containerName string, path string) io.ReadCloser
```

TarStreamFrom builds a tar streaming ref: https://github.com/kubernetes/kubernetes/blob/edb0a72cff0e43bab72a02cada8486d562ee1cd5/staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go#L347-L380

### func \(\*KubeClientSet\) [WriteFileInContainer](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L302>)

```go
func (ku *KubeClientSet) WriteFileInContainer(podName string, containerName string, content io.Reader, filepath string) error
```

## type [LightningClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L21-L23>)

```go
type LightningClient struct {
    WorkloadNodeClient
}
```

### func [NewLightningClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L25>)

```go
func NewLightningClient(k *KubeClientSet) LightningClient
```

### func \(LightningClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L83>)

```go
func (t LightningClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(LightningClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L46>)

```go
func (t LightningClient) Create(spec json.RawMessage) (core.Resource, error)
```

Create ...

```
_, err := client.Create([]byte(`{
```

```
"name": "tidb-lightning",
"testbed": "testbed-1",
"type": "TIDB_LIGHTNING",
"spec": {
    "image": "docker.io/pingcap/tidb-lightning:v5.0.1",
    "resources": {
        "requests": {
            "memory": "64Mi",
            "cpu": "250m",
            "storage": "1Gi"
        }
    }
}
```

```
}`))
```

### func \(LightningClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L75>)

```go
func (t LightningClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(LightningClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L95>)

```go
func (t LightningClient) FQDN() string
```

### func \(LightningClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L63>)

```go
func (t LightningClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(LightningClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L71>)

```go
func (t LightningClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(LightningClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L79>)

```go
func (t LightningClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [LightningGetter](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L133>)

```go
type LightningGetter struct {
    // contains filtered or unexported fields
}
```

### func \(\*LightningGetter\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning_client.go#L135>)

```go
func (t *LightningGetter) Get() (core.Resource, error)
```

## type [LoadBalancer](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer.go#L18-L23>)

```go
type LoadBalancer struct {
    *KubeClientSet
    apiresource.LoadBalancer
    // contains filtered or unexported fields
}
```

### func \(\*LoadBalancer\) [Endpoint](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer.go#L29>)

```go
func (l *LoadBalancer) Endpoint() (domainName string, port int)
```

### func \(\*LoadBalancer\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer.go#L25>)

```go
func (l *LoadBalancer) Handle() apiresource.ResourceHandle
```

### func \(\*LoadBalancer\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer.go#L33>)

```go
func (l *LoadBalancer) Sync() error
```

## type [LoadBalancerClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L22-L24>)

```go
type LoadBalancerClient struct {
    *KubeClientSet
}
```

### func [NewLoadBalancerClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L26>)

```go
func NewLoadBalancerClient(k *KubeClientSet) LoadBalancerClient
```

### func \(LoadBalancerClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L120>)

```go
func (l LoadBalancerClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)
```

Artifact archives logs for debugging on resource

### func \(LoadBalancerClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L31>)

```go
func (l LoadBalancerClient) Create(spec json.RawMessage) (core.Resource, error)
```

Create creates resource

### func \(LoadBalancerClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L110>)

```go
func (l LoadBalancerClient) Delete(handle apiresource.ResourceHandle) error
```

Delete deletes resources

### func \(LoadBalancerClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L125>)

```go
func (l LoadBalancerClient) FQDN() string
```

FQDN return the fully qualified domain name of the Client

### func \(LoadBalancerClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L91>)

```go
func (l LoadBalancerClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

Get gets resource

### func \(LoadBalancerClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L105>)

```go
func (l LoadBalancerClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

GetEndpoints gets Endpoints of a resource

### func \(LoadBalancerClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L115>)

```go
func (l LoadBalancerClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

ReserveEnv reserves environment without the loss of debugging on resource

## type [LoadBalancerGetter](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L129>)

```go
type LoadBalancerGetter struct {
    // contains filtered or unexported fields
}
```

### func \(\*LoadBalancerGetter\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/loadbalancer_client.go#L131>)

```go
func (t *LoadBalancerGetter) Get() (core.Resource, error)
```

## type [MySQLClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L26-L28>)

```go
type MySQLClient struct {
    WorkloadNodeClient
}
```

### func [NewMySQLClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L30>)

```go
func NewMySQLClient(k *KubeClientSet) MySQLClient
```

### func \(MySQLClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L164>)

```go
func (t MySQLClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(MySQLClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L56>)

```go
func (t MySQLClient) Create(spec json.RawMessage) (core.Resource, error)
```

Create ...

```
_, err := client.Create([]byte(`{
```

```
"name": "mysql",
"testbed": "testbed-1",
"type": "MySQL_NODE",
"spec": {
    "image": "docker.io/mysql:8",
    "port": 3306,
    "resources": {
        "requests": {
            "memory": "64Mi",
            "cpu": "250m",
            "storage": "1Gi"
        }
    },
	  "env": {
		  "MYSQL_ALLOW_EMPTY_PASSWORD": "yes",
		  "MYSQL_ROOT_HOST":            "%",
	  }
},
```

```
}`))
```

### func \(MySQLClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L148>)

```go
func (t MySQLClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(MySQLClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L168>)

```go
func (t MySQLClient) FQDN() string
```

### func \(MySQLClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L87>)

```go
func (t MySQLClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(MySQLClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L103>)

```go
func (t MySQLClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(MySQLClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L160>)

```go
func (t MySQLClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [MySQLClusterConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L51-L53>)

```go
type MySQLClusterConfig struct {
    ReadyCheck MySQLClusterReadyCheckConfig `yaml:"readyCheck"`
}
```

## type [MySQLClusterReadyCheckConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L55-L57>)

```go
type MySQLClusterReadyCheckConfig struct {
    PingDB bool `yaml:"pingDB"`
}
```

## type [MySQLGetter](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L187>)

```go
type MySQLGetter struct {
    // contains filtered or unexported fields
}
```

### func \(\*MySQLGetter\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql_client.go#L189>)

```go
func (t *MySQLGetter) Get() (core.Resource, error)
```

## type [MySQLNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L19-L23>)

```go
type MySQLNode struct {
    WorkloadNode
    // reader service can be used to debug mysql node
    ReaderService *corev1.Service
}
```

### func \(\*MySQLNode\) [GetDB](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L87>)

```go
func (t *MySQLNode) GetDB(dbName string) (db *sql.DB, err error)
```

### func \(\*MySQLNode\) [Name](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L71>)

```go
func (t *MySQLNode) Name() string
```

### func \(\*MySQLNode\) [Namespace](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L75>)

```go
func (t *MySQLNode) Namespace() string
```

### func \(\*MySQLNode\) [PeerURLs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L38>)

```go
func (t *MySQLNode) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)
```

### func \(\*MySQLNode\) [Ping](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L80>)

```go
func (t *MySQLNode) Ping() error
```

Ping the mysql node, to check health

### func \(\*MySQLNode\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L59>)

```go
func (t *MySQLNode) Ready() bool
```

### func \(\*MySQLNode\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L30>)

```go
func (t *MySQLNode) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)
```

ServiceURL can be used to get mysql endpoint

### func \(\*MySQLNode\) [SinkEndpoint](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/mysql.go#L25>)

```go
func (t *MySQLNode) SinkEndpoint() (*url.URL, error)
```

## type [PodSelector](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/types.go#L13-L15>)

```go
type PodSelector struct {
    *corev1.Pod
}
```

### func \(\*PodSelector\) [HumanReadableName](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/types.go#L17>)

```go
func (p *PodSelector) HumanReadableName() string
```

## type [RemoteCommander](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L165-L170>)

```go
type RemoteCommander struct {
    // contains filtered or unexported fields
}
```

### func \(\*RemoteCommander\) [Interrupt](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L172>)

```go
func (j *RemoteCommander) Interrupt() error
```

### func \(\*RemoteCommander\) [Wait](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/client.go#L182>)

```go
func (j *RemoteCommander) Wait() resource.RemoteCommandErr
```

## type [RequeueError](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_controller.go#L41-L43>)

```go
type RequeueError struct {
    // contains filtered or unexported fields
}
```

### func \(\*RequeueError\) [Error](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_controller.go#L45>)

```go
func (re *RequeueError) Error() string
```

## type [Testbed](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed.go#L17-L23>)

```go
type Testbed struct {
    KubeClientSet
    apiresource.TestBed
    // contains filtered or unexported fields
}
```

### func \(\*Testbed\) [GetSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed.go#L29>)

```go
func (t *Testbed) GetSpec() (*request.CreateTestbedRequest, error)
```

### func \(\*Testbed\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed.go#L25>)

```go
func (t *Testbed) Handle() apiresource.ResourceHandle
```

## type [TestbedClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L34-L36>)

```go
type TestbedClient struct {
    *KubeClientSet
}
```

### func [NewTestbedClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L38>)

```go
func NewTestbedClient(k *KubeClientSet) TestbedClient
```

### func \(TestbedClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L136>)

```go
func (t TestbedClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(TestbedClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L50>)

```go
func (t TestbedClient) Create(spec json.RawMessage) (core.Resource, error)
```

Create a testbed concept container\(not linux container\) spec: request.CreateTestbedRequest

```
_, err = client.Create([]byte(`{
"name": "testbed",
"type": "TEST_BED",
```

"qos": \[\{"podGroup": "cluster\-1"\}\], \}\`\)\)

### func \(TestbedClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L126>)

```go
func (t TestbedClient) Delete(handle apiresource.ResourceHandle) error
```

TODO\(@mahjonp\) pvcs of TiDBCluster should be also deleted when deleting a Testbed, we haven't set their ownerReference

### func \(TestbedClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L140>)

```go
func (t TestbedClient) FQDN() string
```

### func \(TestbedClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L82>)

```go
func (t TestbedClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(TestbedClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L121>)

```go
func (t TestbedClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(TestbedClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/testbed_client.go#L132>)

```go
func (t TestbedClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [TiDBCloudCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L55-L76>)

```go
type TiDBCloudCluster struct {
    KubeClientSet

    apiresource.TiDBCloudCluster
    // contains filtered or unexported fields
}
```

### func \(\*TiDBCloudCluster\) [Backup](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L414>)

```go
func (t *TiDBCloudCluster) Backup(ctx context.Context, opts resource.TiDBCloudBackupOptions) (string, error)
```

### func \(\*TiDBCloudCluster\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L78>)

```go
func (t *TiDBCloudCluster) ChaosClient() resource.ChaosClient
```

### func \(\*TiDBCloudCluster\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L82>)

```go
func (t *TiDBCloudCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*TiDBCloudCluster\) [GetDB](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L298>)

```go
func (t *TiDBCloudCluster) GetDB(dbName string) (*sql.DB, error)
```

### func \(\*TiDBCloudCluster\) [GetSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L334>)

```go
func (t *TiDBCloudCluster) GetSpec() apiresource.TiDBCloudClusterSpec
```

### func \(\*TiDBCloudCluster\) [GetStatus](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L338>)

```go
func (t *TiDBCloudCluster) GetStatus() (*apiresource.TiDBCloudClusterStatus, error)
```

### func \(\*TiDBCloudCluster\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L294>)

```go
func (t *TiDBCloudCluster) Handle() apiresource.ResourceHandle
```

### func \(\*TiDBCloudCluster\) [Import](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L354>)

```go
func (t *TiDBCloudCluster) Import(ctx context.Context, options resource.TiDBCloudImportOptions) error
```

Import data to dbaas cluster, only support TiDBCloudImportDataFormatSQL format now.

### func \(\*TiDBCloudCluster\) [InplaceRestore](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L608>)

```go
func (t *TiDBCloudCluster) InplaceRestore(ctx context.Context, opts resource.TiDBCloudInplaceRestoreOptions) error
```

InplaceRestore restores data into current cluster, without creating a new cluster \(in contrast, Restore\(\) will create a new cluster before restoring data\)

### func \(\*TiDBCloudCluster\) [PrometheusAPI](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L345>)

```go
func (t *TiDBCloudCluster) PrometheusAPI() (prometheus_api.API, error)
```

### func \(\*TiDBCloudCluster\) [ResetCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L699>)

```go
func (t *TiDBCloudCluster) ResetCluster() error
```

ResetCluster deletes all data of components\(i.e. rm \-rf data of tikv, pd...\), then restarts cluster. It's to simulate a fresh deployed cluster

### func \(\*TiDBCloudCluster\) [Restore](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L467>)

```go
func (t *TiDBCloudCluster) Restore(ctx context.Context, opts resource.TiDBCloudRestoreOptions) (resource.TiDBCloudCluster, error)
```

Restore creates a new cluster then restores data into that cluster \(in contrast, InplaceRestore\(\) will not create a new cluster before restoring data\)

### func \(\*TiDBCloudCluster\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L313>)

```go
func (t *TiDBCloudCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)
```

### func \(\*TiDBCloudCluster\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L940>)

```go
func (t *TiDBCloudCluster) Sync() error
```

### func \(\*TiDBCloudCluster\) [SyncWithoutPing](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L944>)

```go
func (t *TiDBCloudCluster) SyncWithoutPing() error
```

### func \(\*TiDBCloudCluster\) [WaitForReady](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster.go#L1074>)

```go
func (t *TiDBCloudCluster) WaitForReady(timeout time.Duration) error
```

## type [TiDBCloudClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L49-L54>)

```go
type TiDBCloudClusterClient struct {
    *KubeClientSet
    // contains filtered or unexported fields
}
```

### func [NewTiDBCloudClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L391>)

```go
func NewTiDBCloudClusterClient(k *KubeClientSet, config *tidbcloud.TiDBCloudConfiguration) (*TiDBCloudClusterClient, error)
```

### func \(TiDBCloudClusterClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L310>)

```go
func (t TiDBCloudClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(TiDBCloudClusterClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L56>)

```go
func (t TiDBCloudClusterClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(TiDBCloudClusterClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L275>)

```go
func (t TiDBCloudClusterClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(TiDBCloudClusterClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L314>)

```go
func (t TiDBCloudClusterClient) FQDN() string
```

### func \(TiDBCloudClusterClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L256>)

```go
func (t TiDBCloudClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(TiDBCloudClusterClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L271>)

```go
func (t TiDBCloudClusterClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(TiDBCloudClusterClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_client.go#L306>)

```go
func (t TiDBCloudClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [TiDBCloudClusterConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L47-L49>)

```go
type TiDBCloudClusterConfig struct {
    ReadyCheck TiDBCloudClusterReadyCheckConfig `yaml:"readyCheck"`
}
```

## type [TiDBCloudClusterReadyCheckConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L68-L70>)

```go
type TiDBCloudClusterReadyCheckConfig struct {
    PingDB bool `yaml:"pingDB"`
}
```

## type [TiDBCloudKubeClientSet](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_kubeclient.go#L23-L27>)

```go
type TiDBCloudKubeClientSet interface {
    GardenKubeClient() *KubeClientSet
    GetShootKubeConfig(ctx context.Context, projectID string, cloudProvider string, region string) (kubeConfig []byte, err error)
    // contains filtered or unexported methods
}
```

### func [NewFakeTiDBCloudClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_kubeclient.go#L205>)

```go
func NewFakeTiDBCloudClient() TiDBCloudKubeClientSet
```

### func [NewTiDBCloudKubeClientSet](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_kubeclient.go#L56>)

```go
func NewTiDBCloudKubeClientSet(config *tidbcloud.TiDBCloudConfiguration) (TiDBCloudKubeClientSet, error)
```

## type [TiDBCloudObjectController](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_controller.go#L49-L57>)

```go
type TiDBCloudObjectController struct {
    // contains filtered or unexported fields
}
```

### func [NewTiDBCloudClusterController](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_controller.go#L288>)

```go
func NewTiDBCloudClusterController(clientSet kubernetes.Interface, tidbCloudKubeClientSet TiDBCloudKubeClientSet, configuration tidbcloud.TiDBCloudConfiguration) (*TiDBCloudObjectController, error)
```

### func \(\*TiDBCloudObjectController\) [StartUntil](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcloud_cluster_controller.go#L59>)

```go
func (t *TiDBCloudObjectController) StartUntil(context context.Context, workers int) error
```

## type [TiDBCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L54-L60>)

```go
type TiDBCluster struct {
    KubeClientSet
    // api object
    apiresource.TiDBCluster
    // contains filtered or unexported fields
}
```

### func \(\*TiDBCluster\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L62>)

```go
func (t *TiDBCluster) ChaosClient() resource.ChaosClient
```

### func \(\*TiDBCluster\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L620>)

```go
func (t *TiDBCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*TiDBCluster\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L169>)

```go
func (t *TiDBCluster) Exec(opts resource.TiDBClusterExecOptions) (stdout string, stderr string, exitCode int, err error)
```

### func \(\*TiDBCluster\) [GetDB](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L1069>)

```go
func (t *TiDBCluster) GetDB(dbName string) (db *sql.DB, err error)
```

### func \(\*TiDBCluster\) [GetNodes](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L1142>)

```go
func (t *TiDBCluster) GetNodes(comp resource.TiDBCompType) ([]resource.TiDBComponentNode, error)
```

### func \(\*TiDBCluster\) [GetSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L1025>)

```go
func (t *TiDBCluster) GetSpec(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentSpec, error)
```

### func \(\*TiDBCluster\) [GetStatus](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L1034>)

```go
func (t *TiDBCluster) GetStatus(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentStatus, error)
```

### func \(\*TiDBCluster\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L96>)

```go
func (t *TiDBCluster) Handle() apiresource.ResourceHandle
```

### func \(\*TiDBCluster\) [Name](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L911>)

```go
func (t *TiDBCluster) Name() string
```

### func \(\*TiDBCluster\) [Namespace](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L913>)

```go
func (t *TiDBCluster) Namespace() string
```

### func \(\*TiDBCluster\) [PDClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L88>)

```go
func (t *TiDBCluster) PDClient() (*pdutil.Client, error)
```

### func \(\*TiDBCluster\) [PeerURLs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L124>)

```go
func (t *TiDBCluster) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)
```

Headless service use PeerURL to access specified pod

### func \(\*TiDBCluster\) [PrometheusAPI](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L80>)

```go
func (t *TiDBCluster) PrometheusAPI() (prometheus_api.API, error)
```

### func \(\*TiDBCluster\) [PrometheusClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L66>)

```go
func (t *TiDBCluster) PrometheusClient() (prometheus.Client, error)
```

### func \(\*TiDBCluster\) [Scale](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L527>)

```go
func (t *TiDBCluster) Scale(opts resource.TiDBClusterScaleOptions) error
```

### func \(\*TiDBCluster\) [SearchLog](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L585>)

```go
func (t *TiDBCluster) SearchLog(ctx context.Context, opts resource.TiDBClusterSearchLogOptions) ([]string, error)
```

### func \(\*TiDBCluster\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L104>)

```go
func (t *TiDBCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)
```

### func \(\*TiDBCluster\) [SinkEndpoint](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L100>)

```go
func (t *TiDBCluster) SinkEndpoint() (*url.URL, error)
```

### func \(\*TiDBCluster\) [SyncTiDBCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L916>)

```go
func (t *TiDBCluster) SyncTiDBCluster() error
```

SyncTiDBCluster syncs from the k8s object\(tc, pvcs\) to apiresource.TiDBCluster and tc fields

### func \(\*TiDBCluster\) [UpdateConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L239>)

```go
func (t *TiDBCluster) UpdateConfig(opts resource.TiDBClusterUpdateConfigOptions) error
```

### func \(\*TiDBCluster\) [UpdateConfigAsync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L185>)

```go
func (t *TiDBCluster) UpdateConfigAsync(opts resource.TiDBClusterUpdateConfigOptions) (err error)
```

### func \(\*TiDBCluster\) [UpdateConfigs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L275>)

```go
func (t *TiDBCluster) UpdateConfigs(opts resource.TiDBClusterUpdateConfigsOptions) error
```

### func \(\*TiDBCluster\) [Upgrade](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L357>)

```go
func (t *TiDBCluster) Upgrade(opts resource.TiDBClusterUpgradeOptions) error
```

### func \(\*TiDBCluster\) [WaitForReady](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L574>)

```go
func (t *TiDBCluster) WaitForReady(timeout time.Duration) error
```

### func \(\*TiDBCluster\) [WatchOOM](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster.go#L860>)

```go
func (t *TiDBCluster) WatchOOM(ctx context.Context, opts resource.TiDBClusterOOMWatchOptions) (<-chan resource.OOMEvent, error)
```

## type [TiDBClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L55-L57>)

```go
type TiDBClusterClient struct {
    *KubeClientSet
}
```

### func [NewTiDBClusterClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L59>)

```go
func NewTiDBClusterClient(k *KubeClientSet) TiDBClusterClient
```

### func \(TiDBClusterClient\) [ApplyRawClusterSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L459>)

```go
func (t TiDBClusterClient) ApplyRawClusterSpec(defaultSpec *map[string]interface{}, rawSpec map[string]interface{}) error
```

### func \(TiDBClusterClient\) [ApplyRawMonitorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L480>)

```go
func (t TiDBClusterClient) ApplyRawMonitorSpec(destSpec *map[string]interface{}, rawSpec map[string]interface{}) error
```

### func \(TiDBClusterClient\) [ApplyRawNGMonitorSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L487>)

```go
func (t TiDBClusterClient) ApplyRawNGMonitorSpec(destSpec map[string]interface{}, rawSpec map[string]interface{}) error
```

### func \(TiDBClusterClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L225>)

```go
func (t TiDBClusterClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver resource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(TiDBClusterClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L63>)

```go
func (t TiDBClusterClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(TiDBClusterClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L182>)

```go
func (t TiDBClusterClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(TiDBClusterClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L279>)

```go
func (t TiDBClusterClient) FQDN() string
```

### func \(TiDBClusterClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L111>)

```go
func (t TiDBClusterClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(TiDBClusterClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L125>)

```go
func (t TiDBClusterClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(TiDBClusterClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidbcluster_client.go#L221>)

```go
func (t TiDBClusterClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [TiDBClusterConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L42-L45>)

```go
type TiDBClusterConfig struct {
    SpecValidator *TiDBClusterSpecValidator   `yaml:"validator"`
    ReadyCheck    TiDBClusterReadyCheckConfig `yaml:"readyCheck"`
}
```

## type [TiDBClusterReadyCheckConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L63-L66>)

```go
type TiDBClusterReadyCheckConfig struct {
    PingDB      bool `yaml:"pingDB"`
    DialDrainer bool `yaml:"dialDrainer"`
}
```

## type [TiDBClusterSpecValidator](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/config.go#L59-L61>)

```go
type TiDBClusterSpecValidator struct {
    TcValidatorURL string `yaml:"url"`
}
```

## type [TiDBDrainer](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L23-L26>)

```go
type TiDBDrainer struct {
    KubeClientSet
    apiresource.TiDBDrainer
}
```

### func \(\*TiDBDrainer\) [CheckResourceExist](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L93>)

```go
func (t *TiDBDrainer) CheckResourceExist() error
```

### func \(\*TiDBDrainer\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L32>)

```go
func (t *TiDBDrainer) Exec(opts resource.TiDBDrainerExecOptions) (stdout string, stderr string, exitCode int, err error)
```

### func \(\*TiDBDrainer\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L28>)

```go
func (t *TiDBDrainer) Handle() apiresource.ResourceHandle
```

### func \(\*TiDBDrainer\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L48>)

```go
func (t *TiDBDrainer) Ready() bool
```

### func \(\*TiDBDrainer\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer.go#L52>)

```go
func (t *TiDBDrainer) Sync() error
```

## type [TiDBDrainerClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L62-L64>)

```go
type TiDBDrainerClient struct {
    *KubeClientSet
}
```

### func [NewTiDBDrainerClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L66>)

```go
func NewTiDBDrainerClient(k *KubeClientSet) TiDBDrainerClient
```

### func \(TiDBDrainerClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L176>)

```go
func (t TiDBDrainerClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(TiDBDrainerClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L70>)

```go
func (t TiDBDrainerClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(TiDBDrainerClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L152>)

```go
func (t TiDBDrainerClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(TiDBDrainerClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L205>)

```go
func (t TiDBDrainerClient) FQDN() string
```

### func \(TiDBDrainerClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L137>)

```go
func (t TiDBDrainerClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(TiDBDrainerClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L148>)

```go
func (t TiDBDrainerClient) GetEndpoints(_ apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(TiDBDrainerClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/drainer_client.go#L172>)

```go
func (t TiDBDrainerClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

## type [TiDBLightning](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/tidb_lightning.go#L9-L11>)

```go
type TiDBLightning struct {
    WorkloadNode
}
```

## type [WorkloadNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L26-L35>)

```go
type WorkloadNode struct {
    KubeClientSet
    // api object
    apiresource.WorkloadNode
    // contains filtered or unexported fields
}
```

### func \(\*WorkloadNode\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L170>)

```go
func (t *WorkloadNode) ChaosClient() resource.ChaosClient
```

### func \(\*WorkloadNode\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L174>)

```go
func (t *WorkloadNode) ChaosSelect(selector resource.WorkloadNodeSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*WorkloadNode\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L41>)

```go
func (t *WorkloadNode) Exec(opts resource.WorkloadNodeExecOptions) (stdout string, stderr string, exitCode int, err error)
```

### func \(\*WorkloadNode\) [ExecAsync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L56>)

```go
func (t *WorkloadNode) ExecAsync(stdout io.WriteCloser, stderr io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommander, err error)
```

### func \(\*WorkloadNode\) [ExecAsyncInterruptible](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L60>)

```go
func (t *WorkloadNode) ExecAsyncInterruptible(stdout io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommanderInterruptible, err error)
```

### func \(\*WorkloadNode\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L37>)

```go
func (t *WorkloadNode) Handle() apiresource.ResourceHandle
```

### func \(\*WorkloadNode\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L68>)

```go
func (t *WorkloadNode) Ready() bool
```

### func \(\*WorkloadNode\) [Sync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L73>)

```go
func (t *WorkloadNode) Sync() error
```

Sync syncs from the k8s object to api object

### func \(\*WorkloadNode\) [WriteFile](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode.go#L64>)

```go
func (t *WorkloadNode) WriteFile(opts resource.WorkloadNodeWriteFileOptions) error
```

## type [WorkloadNodeClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L40-L42>)

```go
type WorkloadNodeClient struct {
    *KubeClientSet
}
```

### func [NewWorkloadNodeClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L44>)

```go
func NewWorkloadNodeClient(k *KubeClientSet) WorkloadNodeClient
```

### func \(WorkloadNodeClient\) [Artifact](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L191>)

```go
func (t WorkloadNodeClient) Artifact(handle apiresource.ResourceHandle, action apiresource.GcArtifactAction, archiver sdkresource.ArchiverFunc) (map[string]*url.URL, error)
```

### func \(WorkloadNodeClient\) [Create](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L48>)

```go
func (t WorkloadNodeClient) Create(spec json.RawMessage) (core.Resource, error)
```

### func \(WorkloadNodeClient\) [Delete](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L153>)

```go
func (t WorkloadNodeClient) Delete(handle apiresource.ResourceHandle) error
```

### func \(WorkloadNodeClient\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L237>)

```go
func (t WorkloadNodeClient) FQDN() string
```

### func \(WorkloadNodeClient\) [Get](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L98>)

```go
func (t WorkloadNodeClient) Get(handle apiresource.ResourceHandle) (core.Resource, error)
```

### func \(WorkloadNodeClient\) [GetEndpoints](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L112>)

```go
func (t WorkloadNodeClient) GetEndpoints(handle apiresource.ResourceHandle) (apiresource.ResourceEndpoints, error)
```

### func \(WorkloadNodeClient\) [ReserveEnv](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/k8s/workloadnode_client.go#L187>)

```go
func (t WorkloadNodeClient) ReserveEnv(handle apiresource.ResourceHandle, action apiresource.GcReserveEnvAction) error
```

# local

```go
import "github.com/pingcap/test-infra/sdk/resource/impl/local"
```

## Index

- [type MySQLNode](<#type-mysqlnode>)
  - [func (t *MySQLNode) GetDB(dbName string) (db *sql.DB, err error)](<#func-mysqlnode-getdb>)
  - [func (t *MySQLNode) PeerURLs(_ resource.TiDBAddrType) ([]*url.URL, error)](<#func-mysqlnode-peerurls>)
  - [func (t *MySQLNode) Ping() error](<#func-mysqlnode-ping>)
  - [func (t *MySQLNode) Ready() bool](<#func-mysqlnode-ready>)
  - [func (t *MySQLNode) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)](<#func-mysqlnode-serviceurl>)
  - [func (t *MySQLNode) SinkEndpoint() (*url.URL, error)](<#func-mysqlnode-sinkendpoint>)
- [type RemoteCommander](<#type-remotecommander>)
  - [func (j *RemoteCommander) Interrupt() error](<#func-remotecommander-interrupt>)
  - [func (j *RemoteCommander) Wait() resource.RemoteCommandErr](<#func-remotecommander-wait>)
- [type TiDBCluster](<#type-tidbcluster>)
  - [func (t *TiDBCluster) ChaosClient() resource.ChaosClient](<#func-tidbcluster-chaosclient>)
  - [func (t *TiDBCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)](<#func-tidbcluster-chaosselect>)
  - [func (t *TiDBCluster) Exec(opts resource.TiDBClusterExecOptions) (stdout string, stderr string, exitCode int, err error)](<#func-tidbcluster-exec>)
  - [func (t TiDBCluster) FQDN() string](<#func-tidbcluster-fqdn>)
  - [func (t *TiDBCluster) GetDB(dbName string) (db *sql.DB, err error)](<#func-tidbcluster-getdb>)
  - [func (t *TiDBCluster) GetNodes(resource.TiDBCompType) ([]resource.TiDBComponentNode, error)](<#func-tidbcluster-getnodes>)
  - [func (t *TiDBCluster) GetSpec(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentSpec, error)](<#func-tidbcluster-getspec>)
  - [func (t *TiDBCluster) GetStatus(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentStatus, error)](<#func-tidbcluster-getstatus>)
  - [func (t *TiDBCluster) Handle() apiresource.ResourceHandle](<#func-tidbcluster-handle>)
  - [func (t *TiDBCluster) PDClient() (*pdutil.Client, error)](<#func-tidbcluster-pdclient>)
  - [func (t *TiDBCluster) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)](<#func-tidbcluster-peerurls>)
  - [func (t *TiDBCluster) PrometheusAPI() (prometheus_api.API, error)](<#func-tidbcluster-prometheusapi>)
  - [func (t *TiDBCluster) PrometheusClient() (prometheus.Client, error)](<#func-tidbcluster-prometheusclient>)
  - [func (t *TiDBCluster) Scale(opts resource.TiDBClusterScaleOptions) error](<#func-tidbcluster-scale>)
  - [func (t *TiDBCluster) SearchLog(ctx context.Context, opts resource.TiDBClusterSearchLogOptions) ([]string, error)](<#func-tidbcluster-searchlog>)
  - [func (t *TiDBCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)](<#func-tidbcluster-serviceurl>)
  - [func (t *TiDBCluster) UpdateConfig(opts resource.TiDBClusterUpdateConfigOptions) error](<#func-tidbcluster-updateconfig>)
  - [func (t TiDBCluster) UpdateConfigs(opts resource.TiDBClusterUpdateConfigsOptions) error](<#func-tidbcluster-updateconfigs>)
  - [func (t *TiDBCluster) Upgrade(opts resource.TiDBClusterUpgradeOptions) error](<#func-tidbcluster-upgrade>)
  - [func (t *TiDBCluster) WatchOOM(ctx context.Context, opts resource.TiDBClusterOOMWatchOptions) (<-chan resource.OOMEvent, error)](<#func-tidbcluster-watchoom>)
- [type WorkloadNode](<#type-workloadnode>)
  - [func (t *WorkloadNode) ChaosClient() resource.ChaosClient](<#func-workloadnode-chaosclient>)
  - [func (t *WorkloadNode) ChaosSelect(selector resource.WorkloadNodeSelectorOpts) ([]resource.ChaosSelector, error)](<#func-workloadnode-chaosselect>)
  - [func (t *WorkloadNode) Exec(opts resource.WorkloadNodeExecOptions) (outStr string, errStr string, exitCode int, err error)](<#func-workloadnode-exec>)
  - [func (t *WorkloadNode) ExecAsync(stdout, stderr io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommander, err error)](<#func-workloadnode-execasync>)
  - [func (t *WorkloadNode) ExecAsyncInterruptible(stdout io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommanderInterruptible, err error)](<#func-workloadnode-execasyncinterruptible>)
  - [func (t *WorkloadNode) Handle() apiresource.ResourceHandle](<#func-workloadnode-handle>)
  - [func (t *WorkloadNode) WriteFile(opts resource.WorkloadNodeWriteFileOptions) (err error)](<#func-workloadnode-writefile>)


## type [MySQLNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L22-L26>)

```go
type MySQLNode struct {
    WorkloadNode
    // reader service can be used to debug mysql node
    ReaderService *corev1.Service
}
```

### func \(\*MySQLNode\) [GetDB](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L75>)

```go
func (t *MySQLNode) GetDB(dbName string) (db *sql.DB, err error)
```

### func \(\*MySQLNode\) [PeerURLs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L48>)

```go
func (t *MySQLNode) PeerURLs(_ resource.TiDBAddrType) ([]*url.URL, error)
```

### func \(\*MySQLNode\) [Ping](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L57>)

```go
func (t *MySQLNode) Ping() error
```

Ping the mysql node, to check health

### func \(\*MySQLNode\) [Ready](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L52>)

```go
func (t *MySQLNode) Ready() bool
```

### func \(\*MySQLNode\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L33>)

```go
func (t *MySQLNode) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)
```

ServiceURL can be used to get mysql endpoint

### func \(\*MySQLNode\) [SinkEndpoint](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/mysql.go#L28>)

```go
func (t *MySQLNode) SinkEndpoint() (*url.URL, error)
```

## type [RemoteCommander](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L24-L27>)

```go
type RemoteCommander struct {
    // contains filtered or unexported fields
}
```

### func \(\*RemoteCommander\) [Interrupt](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L29>)

```go
func (j *RemoteCommander) Interrupt() error
```

### func \(\*RemoteCommander\) [Wait](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L40>)

```go
func (j *RemoteCommander) Wait() resource.RemoteCommandErr
```

## type [TiDBCluster](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L22-L25>)

```go
type TiDBCluster struct {
    // api object
    apiresource.TiDBCluster
}
```

### func \(\*TiDBCluster\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L161>)

```go
func (t *TiDBCluster) ChaosClient() resource.ChaosClient
```

### func \(\*TiDBCluster\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L157>)

```go
func (t *TiDBCluster) ChaosSelect(selector resource.TiDBClusterSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*TiDBCluster\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L121>)

```go
func (t *TiDBCluster) Exec(opts resource.TiDBClusterExecOptions) (stdout string, stderr string, exitCode int, err error)
```

### func \(TiDBCluster\) [FQDN](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L27>)

```go
func (t TiDBCluster) FQDN() string
```

### func \(\*TiDBCluster\) [GetDB](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L105>)

```go
func (t *TiDBCluster) GetDB(dbName string) (db *sql.DB, err error)
```

### func \(\*TiDBCluster\) [GetNodes](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L177>)

```go
func (t *TiDBCluster) GetNodes(resource.TiDBCompType) ([]resource.TiDBComponentNode, error)
```

### func \(\*TiDBCluster\) [GetSpec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L145>)

```go
func (t *TiDBCluster) GetSpec(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentSpec, error)
```

### func \(\*TiDBCluster\) [GetStatus](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L149>)

```go
func (t *TiDBCluster) GetStatus(comp resource.TiDBCompType) (*apiresource.TiDBClusterComponentStatus, error)
```

### func \(\*TiDBCluster\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L31>)

```go
func (t *TiDBCluster) Handle() apiresource.ResourceHandle
```

### func \(\*TiDBCluster\) [PDClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L173>)

```go
func (t *TiDBCluster) PDClient() (*pdutil.Client, error)
```

### func \(\*TiDBCluster\) [PeerURLs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L101>)

```go
func (t *TiDBCluster) PeerURLs(typ resource.TiDBAddrType) ([]*url.URL, error)
```

### func \(\*TiDBCluster\) [PrometheusAPI](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L169>)

```go
func (t *TiDBCluster) PrometheusAPI() (prometheus_api.API, error)
```

### func \(\*TiDBCluster\) [PrometheusClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L165>)

```go
func (t *TiDBCluster) PrometheusClient() (prometheus.Client, error)
```

### func \(\*TiDBCluster\) [Scale](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L137>)

```go
func (t *TiDBCluster) Scale(opts resource.TiDBClusterScaleOptions) error
```

### func \(\*TiDBCluster\) [SearchLog](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L141>)

```go
func (t *TiDBCluster) SearchLog(ctx context.Context, opts resource.TiDBClusterSearchLogOptions) ([]string, error)
```

### func \(\*TiDBCluster\) [ServiceURL](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L35>)

```go
func (t *TiDBCluster) ServiceURL(typ resource.TiDBAddrType) (*url.URL, error)
```

### func \(\*TiDBCluster\) [UpdateConfig](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L125>)

```go
func (t *TiDBCluster) UpdateConfig(opts resource.TiDBClusterUpdateConfigOptions) error
```

### func \(TiDBCluster\) [UpdateConfigs](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L129>)

```go
func (t TiDBCluster) UpdateConfigs(opts resource.TiDBClusterUpdateConfigsOptions) error
```

### func \(\*TiDBCluster\) [Upgrade](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L133>)

```go
func (t *TiDBCluster) Upgrade(opts resource.TiDBClusterUpgradeOptions) error
```

### func \(\*TiDBCluster\) [WatchOOM](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/tidbcluster.go#L153>)

```go
func (t *TiDBCluster) WatchOOM(ctx context.Context, opts resource.TiDBClusterOOMWatchOptions) (<-chan resource.OOMEvent, error)
```

## type [WorkloadNode](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L19-L22>)

```go
type WorkloadNode struct {
    // api object
    apiresource.WorkloadNode
}
```

### func \(\*WorkloadNode\) [ChaosClient](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L104>)

```go
func (t *WorkloadNode) ChaosClient() resource.ChaosClient
```

### func \(\*WorkloadNode\) [ChaosSelect](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L100>)

```go
func (t *WorkloadNode) ChaosSelect(selector resource.WorkloadNodeSelectorOpts) ([]resource.ChaosSelector, error)
```

### func \(\*WorkloadNode\) [Exec](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L57>)

```go
func (t *WorkloadNode) Exec(opts resource.WorkloadNodeExecOptions) (outStr string, errStr string, exitCode int, err error)
```

### func \(\*WorkloadNode\) [ExecAsync](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L72>)

```go
func (t *WorkloadNode) ExecAsync(stdout, stderr io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommander, err error)
```

### func \(\*WorkloadNode\) [ExecAsyncInterruptible](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L86>)

```go
func (t *WorkloadNode) ExecAsyncInterruptible(stdout io.WriteCloser, opts resource.WorkloadNodeExecOptions) (remote resource.RemoteCommanderInterruptible, err error)
```

### func \(\*WorkloadNode\) [Handle](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L53>)

```go
func (t *WorkloadNode) Handle() apiresource.ResourceHandle
```

### func \(\*WorkloadNode\) [WriteFile](<https://github.com/pingcap/test-infra/blob/main/sdk/resource/impl/local/workloadnode.go#L108>)

```go
func (t *WorkloadNode) WriteFile(opts resource.WorkloadNodeWriteFileOptions) (err error)
```



Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
