tests

package
v1.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 92 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NodeUnreachablePodReason is defined in k8s.io/kubernetes/pkg/util/node
	// but not in client-go and apimachinery, so we define it here
	NodeUnreachablePodReason = "NodeLost"

	WebhookServiceName = "webhook-service"
)
View Source
const (
	DefaultPollTimeout          time.Duration = 5 * time.Minute
	DefaultPollInterval         time.Duration = 5 * time.Second
	BackupAndRestorePollTimeOut time.Duration = 10 * time.Minute
)
View Source
const (
	DrainerReplicas int32 = 1
	// TODO: better way to do incremental restore from pb files
	RunReparoCommandTemplate = `` /* 299-byte string literal not displayed */

)
View Source
const (
	// DMLabelName is the label value for `app.kubernetes.io/name`.
	DMLabelName = "dm-e2e"
	// DMMySQLNamespace is the namespace used to install upstream MySQL instances for DM E2E tests.
	DMMySQLNamespace = "dm-mysql"
	// DMMySQLSvcStsName is the upstream MySQL svc/sts name for DM E2E tests.
	DMMySQLSvcStsName = "dm-mysql"
	// DMMySQLImage is the upstream MySQL container image for DM E2E tests.
	DMMySQLImage = "mysql:5.7"
	// DMMySQLReplicas is the upstream MySQL instance number for DM E2E	tests.
	// We use replicas as different MySQL instances.
	DMMySQLReplicas int32 = 2
	// DMMySQLPort is the upstream MySQL instance's service port.
	DMMySQLPort int32 = 3306
	// DMMySQLStorage is the request storage used by one MySQL instance.
	DMMySQLStorage = "2Gi"

	// DMMySQLServerTLSPath is the path to mount the MySQL server TLS certs.
	DMMySQLServerTLSPath = "/var/lib/server-tls"

	// DMTiDBNamespace is the namespace used to install the downstream TiDB cluster for DM E2E tests.
	DMTiDBNamespace = "dm-tidb"
	// DMTiDBName is the name of the TiDB cluster for DM E2E tests.
	DMTiDBName = "dm-tidb"
)
View Source
const (
	RackLabel = "rack"
	RackNum   = 3

	LabelKeyTestingZone = "testing.pingcap.com/zone"
)
View Source
const (
	PodPollInterval = 2 * time.Second
	// PodTimeout is how long to wait for the pod to be started or
	// terminated.
	PodTimeout = 5 * time.Minute
)

Variables

View Source
var (
	DMSources = []string{`
source-id: "replica-01"
enable-gtid: true
relay-dir: /var/lib/dm-worker/relay

from:
  host: "dm-mysql-0.dm-mysql.dm-mysql"
  user: "root"
  password: ""
  port: 3306
`, `
source-id: "replica-02"
enable-gtid: true
relay-dir: /var/lib/dm-worker/relay

from:
  host: "dm-mysql-1.dm-mysql.dm-mysql"
  user: "root"
  password: ""
  port: 3306
`}

	DMSingleTask = `` /* 434-byte string literal not displayed */

	DMShardTask = `` /* 555-byte string literal not displayed */

)

Functions

func CheckDMData added in v1.2.0

func CheckDMData(fw portforward.PortForward, ns string, sourceCount int) error

CheckDMData checks data between downstream TiDB cluster and upstream MySQL are equal. NOTE: for simplicity, we only check rows count now.

func CheckDMDataWithTLSEnabled added in v1.2.0

func CheckDMDataWithTLSEnabled(fw portforward.PortForward, nsDM, nsMySQL, nsTiDB, tcName string, sourceCount int,
	upSecret, downSecret *corev1.Secret) error

CheckDMDataWithTLSEnabled checks data between downstream TiDB cluster and upstream MySQL are equal with TLS enabled. NOTE: for simplicity, we only check rows count now.

func CheckDMMySQLReady added in v1.2.0

func CheckDMMySQLReady(fw portforward.PortForward, ns string) error

CheckDMMySQLReady checks whether all upstream MySQL instances are ready.

func CheckDMMySQLReadyWithTLSEnabled added in v1.2.0

func CheckDMMySQLReadyWithTLSEnabled(fw portforward.PortForward, ns string, secret *corev1.Secret) error

CheckDMMySQLReadyWithTLSEnabled checks whether all upstream MySQL instances are ready with TLS enabled.

func CheckTidbMonitor added in v1.1.0

func CheckTidbMonitor(monitor *v1alpha1.TidbMonitor, cli versioned.Interface, kubeCli kubernetes.Interface, fw portforward.PortForward) error

func CheckTidbMonitorConfigurationUpdate added in v1.2.2

func CheckTidbMonitorConfigurationUpdate(monitor *v1alpha1.TidbMonitor, kubeCli kubernetes.Interface, fw portforward.PortForward, expectActiveTargets int) error

func CleanDMMySQL added in v1.2.0

func CleanDMMySQL(kubeCli kubernetes.Interface, ns string) error

CleanDMMySQL cleans upstream MySQL instances for DM E2E tests.

func CleanDMTiDB added in v1.2.0

func CleanDMTiDB(cli *versioned.Clientset, kubeCli kubernetes.Interface) error

CleanDMTiDB cleans the downstream TiDB cluster for DM E2E tests.

func CleanNodeLabels added in v1.2.0

func CleanNodeLabels(c kubernetes.Interface) error

func CleanOperator added in v1.2.0

func CleanOperator(info *OperatorConfig) error

func CleanReleasedCRDOrDie added in v1.1.0

func CleanReleasedCRDOrDie(version string)

func CreateDMSources added in v1.2.0

func CreateDMSources(fw portforward.PortForward, ns, masterSvcName string) error

CreateDMSources creates upstream MySQL sources into DM cluster.

func DeployDMMySQL added in v1.2.0

func DeployDMMySQL(kubeCli kubernetes.Interface, ns string) error

DeployDMMySQL deploy upstream MySQL instances for DM E2E tests.

func DeployDMMySQLWithTLSEnabled added in v1.2.0

func DeployDMMySQLWithTLSEnabled(kubeCli kubernetes.Interface, namespace, tlsSecret string) error

DeployDMMySQLWithTLSEnabled deploy upstream MySQL instances for DM E2E tests and with TLS enabled.

func DumpPod added in v1.2.0

func DumpPod(logPath string, pod *corev1.Pod) error

DumpPod dumps logs for a pod.

func GenDMFullData added in v1.2.0

func GenDMFullData(fw portforward.PortForward, ns string) error

GenDMFullData generates full stage data for upstream MySQL.

func GenDMFullDataWithMySQLNamespace added in v1.2.0

func GenDMFullDataWithMySQLNamespace(fw portforward.PortForward, nsDM, nsMySQL string) error

GenDMFullDataWithMySQLNamespace generates full stage data for upstream MySQL in the specified namespace.

func GenDMFullDataWithMySQLNamespaceWithTLSEnabled added in v1.2.0

func GenDMFullDataWithMySQLNamespaceWithTLSEnabled(fw portforward.PortForward, nsDM, nsMySQL string, secret *corev1.Secret) error

GenDMFullDataWithMySQLNamespaceWithTLSEnabled generates full stage data for upstream MySQL in the specified namespace with DLS enabled.

func GenDMIncrData added in v1.2.0

func GenDMIncrData(fw portforward.PortForward, ns string) error

GenDMIncrData generates incremental stage data for upstream MySQL. NOTE: we can generate incremental data multiple times if needed later.

func GenDMIncrDataWithMySQLNamespace added in v1.2.0

func GenDMIncrDataWithMySQLNamespace(fw portforward.PortForward, nsDM, nsMySQL string) error

GenDMIncrDataWithMySQLNamespace generates incremental stage data for upstream MySQL in the specified namespace. NOTE: we can generate incremental data multiple times if needed later.

func GenDMIncrDataWithMySQLNamespaceWithTLSEnabled added in v1.2.0

func GenDMIncrDataWithMySQLNamespaceWithTLSEnabled(fw portforward.PortForward, nsDM, nsMySQL string, secret *corev1.Secret) error

GenDMIncrDataWithMySQLNamespaceWithTLSEnabled generates incremental stage data for upstream MySQL in the specified namespace with TLS enabled. NOTE: we can generate incremental data multiple times if needed later.

func GetD added in v1.0.6

func GetD(ns, tcName, databaseName, password string) string

func GetDMMasters added in v1.2.0

func GetDMMasters(fw portforward.PortForward, ns, masterSvcName string) ([]*dmapi.MastersInfo, error)

GetDMMasters gets all DM-master members info.

func GetDMOpenAPISpec added in v1.3.0

func GetDMOpenAPISpec(fw portforward.PortForward, ns, masterSvcName, taskConf, errSubStr string) error

GetDMOpenAPISpec get openapi Spec from dm-master pod.

func GetDMWorkers added in v1.2.0

func GetDMWorkers(fw portforward.PortForward, ns, masterSvcName string) ([]*dmapi.WorkersInfo, error)

GetDMWorkers gets all DM-worker members info.

func GetDrainerSubValuesOrDie added in v1.1.0

func GetDrainerSubValuesOrDie(info *DrainerConfig) string

func GetKubeApiserverPod

func GetKubeApiserverPod(kubeCli kubernetes.Interface, node string) (*corev1.Pod, error)

func GetKubeControllerManagerPod

func GetKubeControllerManagerPod(kubeCli kubernetes.Interface, node string) (*corev1.Pod, error)

func GetKubeDNSPod

func GetKubeDNSPod(kubeCli kubernetes.Interface, node string) (*corev1.Pod, error)

func GetKubeProxyPod

func GetKubeProxyPod(kubeCli kubernetes.Interface, node string) (*corev1.Pod, error)

func GetKubeSchedulerPod

func GetKubeSchedulerPod(kubeCli kubernetes.Interface, node string) (*corev1.Pod, error)

func GetPodStatus

func GetPodStatus(pod *corev1.Pod) string

func GetPodsByLabels

func GetPodsByLabels(kubeCli kubernetes.Interface, node string, lables map[string]string) (*corev1.Pod, error)

func GetSecretListerWithCacheSynced added in v1.3.0

func GetSecretListerWithCacheSynced(c kubernetes.Interface, resync time.Duration) corelisterv1.SecretLister

GetSecretListerWithCacheSynced return SecretLister with cache synced

func GetSubValuesOrDie

func GetSubValuesOrDie(clusterName, namespace, topologyKey string, pdConfig []string, tikvConfig []string, tidbConfig []string, pumpConfig []string, drainerConfig []string) string

func IntPtr added in v1.1.0

func IntPtr(i int) *int

func KeepOrDie

func KeepOrDie(interval time.Duration, period time.Duration, fun func() error)

Keep will keep the fun running in the period, otherwise the fun return error

func QueryDMStatus added in v1.2.0

func QueryDMStatus(fw portforward.PortForward, ns, masterSvcName string) (string, error)

QueryDMStatus queries the status of DM data migration tasks.

func SelectNode

func SelectNode(nodes []Nodes) string

func ShowDMSource added in v1.2.0

func ShowDMSource(fw portforward.PortForward, ns, masterSvcName string) (string, error)

ShowDMSource shows the status of DM MySQL sources.

func StartDMTask added in v1.2.0

func StartDMTask(fw portforward.PortForward, ns, masterSvcName, taskConf, errSubStr string) error

StartDMTask starts a DM migration task with a task config. if `errSubStr` specified and DM cluster response message contain `errSubStr`, nil will returned for this method.

func StartValidatingAdmissionWebhookServerOrDie

func StartValidatingAdmissionWebhookServerOrDie(context *apimachinery.CertContext, namespaces ...string)

Types

type AffinityInfo

type AffinityInfo struct {
	ClusterName string
	Kind        string
	Weight      int
	Namespace   string
	TopologyKey string
	Config      []string
}

type BackupTarget added in v1.1.0

type BackupTarget struct {
	IncrementalType DbType
	TargetCluster   *TidbClusterConfig
	IsAdditional    bool
}

func (*BackupTarget) GetDrainerConfig added in v1.1.0

func (t *BackupTarget) GetDrainerConfig(source *TidbClusterConfig, ts string) *DrainerConfig

type BinLogInfo added in v1.0.1

type BinLogInfo struct {
	PumpConfig    []string
	DrainerConfig []string
	Namespace     string
	TopologyKey   string
}

type Config

type Config struct {
	TidbVersions         string          `yaml:"tidb_versions" json:"tidb_versions"`
	InstallOperator      bool            `yaml:"install_opeartor" json:"install_opeartor"`
	InstallDMMysql       bool            `yaml:"install_dm_mysql" json:"install_dm_mysql"`
	OperatorTag          string          `yaml:"operator_tag" json:"operator_tag"`
	OperatorImage        string          `yaml:"operator_image" json:"operator_image"`
	BackupImage          string          `yaml:"backup_image" json:"backup_image"`
	OperatorFeatures     map[string]bool `yaml:"operator_features" json:"operator_features"`
	UpgradeOperatorTag   string          `yaml:"upgrade_operator_tag" json:"upgrade_operator_tag"`
	UpgradeOperatorImage string          `yaml:"upgrade_operator_image" json:"upgrade_operator_image"`
	LogDir               string          `yaml:"log_dir" json:"log_dir"`
	FaultTriggerPort     int             `yaml:"fault_trigger_port" json:"fault_trigger_port"`
	Nodes                []Nodes         `yaml:"nodes" json:"nodes"`
	ETCDs                []Nodes         `yaml:"etcds" json:"etcds"`
	APIServers           []Nodes         `yaml:"apiservers" json:"apiservers"`
	CertFile             string
	KeyFile              string

	PDMaxReplicas       int `yaml:"pd_max_replicas" json:"pd_max_replicas"`
	TiKVGrpcConcurrency int `yaml:"tikv_grpc_concurrency" json:"tikv_grpc_concurrency"`
	TiDBTokenLimit      int `yaml:"tidb_token_limit" json:"tidb_token_limit"`

	// old versions of reparo does not support idempotent incremental recover, so we lock the version explicitly
	AdditionalDrainerVersion string `yaml:"file_drainer_version" json:"file_drainer_version"`

	// Block writer
	BlockWriter blockwriter.Config `yaml:"block_writer,omitempty"`

	// For local test
	OperatorRepoUrl string `yaml:"operator_repo_url" json:"operator_repo_url"`
	OperatorRepoDir string `yaml:"operator_repo_dir" json:"operator_repo_dir"`
	// chart dir
	ChartDir string `yaml:"chart_dir" json:"chart_dir"`
	// manifest dir
	ManifestDir string `yaml:"manifest_dir" json:"manifest_dir"`

	E2EImage string `yaml:"e2e_image" json:"e2e_image"`

	PreloadImages bool `yaml:"preload_images" json:"preload_images"`

	OperatorKiller utiloperator.OperatorKillerConfig
	// contains filtered or unexported fields
}

Config defines the config of operator tests

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new config.

func NewDefaultConfig added in v1.1.0

func NewDefaultConfig() *Config

NewDefaultConfig creates a default configuration.

func ParseConfigOrDie

func ParseConfigOrDie() *Config

func (*Config) CleanTempDirs

func (c *Config) CleanTempDirs() error

func (*Config) GetTiDBVersion

func (c *Config) GetTiDBVersion() (string, error)

func (*Config) GetTiDBVersionOrDie

func (c *Config) GetTiDBVersionOrDie() string

func (*Config) GetUpgradeTidbVersions

func (c *Config) GetUpgradeTidbVersions() []string

func (*Config) GetUpgradeTidbVersionsOrDie

func (c *Config) GetUpgradeTidbVersionsOrDie() []string

func (*Config) MustPrettyPrintJSON added in v1.1.0

func (c *Config) MustPrettyPrintJSON() string

func (*Config) Parse

func (c *Config) Parse() error

Parse parses flag definitions from the argument list.

func (*Config) PrettyPrintJSON added in v1.1.0

func (c *Config) PrettyPrintJSON() (string, error)

type CrdTestUtil added in v1.1.1

type CrdTestUtil struct {
	// contains filtered or unexported fields
}

func NewCrdTestUtil added in v1.1.1

func (*CrdTestUtil) CheckDisasterTolerance added in v1.1.1

func (ctu *CrdTestUtil) CheckDisasterTolerance(cluster *v1alpha1.TidbCluster) error

func (*CrdTestUtil) CheckDisasterToleranceOrDie added in v1.1.1

func (ctu *CrdTestUtil) CheckDisasterToleranceOrDie(tc *v1alpha1.TidbCluster)

func (*CrdTestUtil) CleanResourcesOrDie added in v1.1.1

func (ctu *CrdTestUtil) CleanResourcesOrDie(resource, namespace string)

func (*CrdTestUtil) CreateSecretOrDie added in v1.1.1

func (ctu *CrdTestUtil) CreateSecretOrDie(secret *corev1.Secret)

func (*CrdTestUtil) CreateTidbClusterOrDie added in v1.1.1

func (ctu *CrdTestUtil) CreateTidbClusterOrDie(tc *v1alpha1.TidbCluster)

func (*CrdTestUtil) DeleteTidbClusterOrDie added in v1.1.1

func (ctu *CrdTestUtil) DeleteTidbClusterOrDie(tc *v1alpha1.TidbCluster)

func (*CrdTestUtil) GetTidbClusterOrDie added in v1.1.1

func (ctu *CrdTestUtil) GetTidbClusterOrDie(name, namespace string) *v1alpha1.TidbCluster

func (*CrdTestUtil) UpdateTidbClusterOrDie added in v1.1.1

func (ctu *CrdTestUtil) UpdateTidbClusterOrDie(tc *v1alpha1.TidbCluster)

func (*CrdTestUtil) WaitForTidbClusterReady added in v1.1.1

func (ctu *CrdTestUtil) WaitForTidbClusterReady(tc *v1alpha1.TidbCluster, timeout, pollInterval time.Duration) error

WaitForTidbClusterReady waits for tidb components ready, or timeout

func (*CrdTestUtil) WaitTidbClusterReadyOrDie added in v1.1.1

func (ctu *CrdTestUtil) WaitTidbClusterReadyOrDie(tc *v1alpha1.TidbCluster, timeout time.Duration)

type DbType added in v1.1.0

type DbType string
const (
	DbTypeMySQL DbType = "mysql"
	DbTypeFile  DbType = "file"
	DbTypeTiDB  DbType = "tidb"
)

type DrainerConfig added in v1.1.0

type DrainerConfig struct {
	DrainerName       string
	InitialCommitTs   string
	OperatorTag       string
	SourceClusterName string
	Namespace         string

	DbType   DbType
	Host     string
	User     string
	Password string
	// use string type in case of empty port (db-type=file)
	Port       string
	TLSCluster bool
}

func (*DrainerConfig) BuildSubValues added in v1.1.0

func (d *DrainerConfig) BuildSubValues(dir string) (string, error)

func (*DrainerConfig) DrainerHelmString added in v1.1.0

func (d *DrainerConfig) DrainerHelmString(m map[string]string, source *TidbClusterConfig) string

type FaultTriggerActions

type FaultTriggerActions interface {
	CheckAndRecoverEnv() error
	CheckAndRecoverEnvOrDie()
	StopNode() (string, string, time.Time, error)
	StopNodeOrDie() (string, string, time.Time)
	StartNode(physicalNode string, node string) error
	StartNodeOrDie(physicalNode string, node string)
	StopETCD(nodes ...string) error
	StopETCDOrDie(nodes ...string)
	StartETCD(nodes ...string) error
	StartETCDOrDie(nodes ...string)
	StopKubelet(nodes ...string) error
	StopKubeletOrDie(nodes ...string)
	StartKubelet(nodes ...string) error
	StartKubeletOrDie(nodes ...string)
	StopKubeAPIServer(node string) error
	StopKubeAPIServerOrDie(node string)
	StartKubeAPIServer(node string) error
	StartKubeAPIServerOrDie(node string)
	StopKubeControllerManager(node string) error
	StopKubeControllerManagerOrDie(node string)
	StartKubeControllerManager(node string) error
	StartKubeControllerManagerOrDie(node string)
	StartKubeScheduler(node string) error
	StartKubeSchedulerOrDie(node string)
	StopKubeScheduler(node string) error
	StopKubeSchedulerOrDie(node string)
	StopKubeProxy() error
	StopKubeProxyOrDie()
	StartKubeProxy() error
	StartKubeProxyOrDie()
}

func NewFaultTriggerAction

func NewFaultTriggerAction(cli versioned.Interface, kubeCli kubernetes.Interface, secretLister corelisterv1.SecretLister, cfg *Config) FaultTriggerActions

type Node added in v1.0.2

type Node struct {
	IP   string `yaml:"ip" json:"ip"`
	Name string `yaml:"name" json:"name"`
}

type Nodes

type Nodes struct {
	PhysicalNode string `yaml:"physical_node" json:"physical_node"`
	Nodes        []Node `yaml:"nodes" json:"nodes"`
}

Nodes defines a series of nodes that belong to the same physical node.

type OperatorActions

type OperatorActions struct {
	// contains filtered or unexported fields
}

func (*OperatorActions) BackupAndRestoreToMultipleClusters added in v1.1.0

func (oa *OperatorActions) BackupAndRestoreToMultipleClusters(source *TidbClusterConfig, targets []BackupTarget) error

func (*OperatorActions) BackupAndRestoreToMultipleClustersOrDie added in v1.1.0

func (oa *OperatorActions) BackupAndRestoreToMultipleClustersOrDie(source *TidbClusterConfig, targets []BackupTarget)

func (*OperatorActions) BackupRestore

func (oa *OperatorActions) BackupRestore(from, to *TidbClusterConfig) error

func (*OperatorActions) BackupRestoreOrDie

func (oa *OperatorActions) BackupRestoreOrDie(from, to *TidbClusterConfig)

func (*OperatorActions) BeginInsertDataTo

func (oa *OperatorActions) BeginInsertDataTo(info *TidbClusterConfig) error

func (*OperatorActions) BeginInsertDataToOrDie

func (oa *OperatorActions) BeginInsertDataToOrDie(info *TidbClusterConfig)

func (*OperatorActions) CheckAdHocBackup

func (oa *OperatorActions) CheckAdHocBackup(info *TidbClusterConfig) (string, error)

func (*OperatorActions) CheckAllApiserverDownOrDie added in v1.0.2

func (oa *OperatorActions) CheckAllApiserverDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig)

func (*OperatorActions) CheckDataConsistency added in v1.2.0

func (oa *OperatorActions) CheckDataConsistency(from, to *TidbClusterConfig, timeout time.Duration) error

func (*OperatorActions) CheckDisasterTolerance

func (oa *OperatorActions) CheckDisasterTolerance(cluster *TidbClusterConfig) error

func (*OperatorActions) CheckDisasterToleranceOrDie

func (oa *OperatorActions) CheckDisasterToleranceOrDie(cluster *TidbClusterConfig)

func (*OperatorActions) CheckDrainer added in v1.1.0

func (oa *OperatorActions) CheckDrainer(info *DrainerConfig, source *TidbClusterConfig) error

func (*OperatorActions) CheckEtcdDownOrDie

func (oa *OperatorActions) CheckEtcdDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string)

func (*OperatorActions) CheckFailover

func (oa *OperatorActions) CheckFailover(info *TidbClusterConfig, node string) (bool, error)

func (*OperatorActions) CheckFailoverOrDie

func (oa *OperatorActions) CheckFailoverOrDie(clusters []*TidbClusterConfig, faultNode string)

func (*OperatorActions) CheckFailoverPending

func (oa *OperatorActions) CheckFailoverPending(info *TidbClusterConfig, node string, faultPoint *time.Time) (bool, error)

func (*OperatorActions) CheckFailoverPendingOrDie

func (oa *OperatorActions) CheckFailoverPendingOrDie(clusters []*TidbClusterConfig, node string, faultPoint *time.Time)

func (*OperatorActions) CheckIncrementalBackup

func (oa *OperatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withDrainer bool) error

func (*OperatorActions) CheckInitSQL added in v1.0.4

func (oa *OperatorActions) CheckInitSQL(info *TidbClusterConfig) error

func (*OperatorActions) CheckInitSQLOrDie added in v1.0.4

func (oa *OperatorActions) CheckInitSQLOrDie(info *TidbClusterConfig)

func (*OperatorActions) CheckK8sAvailable

func (oa *OperatorActions) CheckK8sAvailable(excludeNodes map[string]string, excludePods map[string]*corev1.Pod) error

func (*OperatorActions) CheckK8sAvailableOrDie

func (oa *OperatorActions) CheckK8sAvailableOrDie(excludeNodes map[string]string, excludePods map[string]*corev1.Pod)

func (*OperatorActions) CheckKubeControllerManagerDownOrDie

func (oa *OperatorActions) CheckKubeControllerManagerDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig)

func (*OperatorActions) CheckKubeProxyDownOrDie

func (oa *OperatorActions) CheckKubeProxyDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig)

func (*OperatorActions) CheckKubeSchedulerDownOrDie

func (oa *OperatorActions) CheckKubeSchedulerDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig)

func (*OperatorActions) CheckKubeletDownOrDie

func (oa *OperatorActions) CheckKubeletDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string)

func (*OperatorActions) CheckOneApiserverDownOrDie

func (oa *OperatorActions) CheckOneApiserverDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string)

func (*OperatorActions) CheckOperatorAvailable

func (oa *OperatorActions) CheckOperatorAvailable(operatorConfig *OperatorConfig) error

func (*OperatorActions) CheckOperatorDownOrDie

func (oa *OperatorActions) CheckOperatorDownOrDie(clusters []*TidbClusterConfig)

func (*OperatorActions) CheckRecover

func (oa *OperatorActions) CheckRecover(cluster *TidbClusterConfig) (bool, error)

func (*OperatorActions) CheckRecoverOrDie

func (oa *OperatorActions) CheckRecoverOrDie(clusters []*TidbClusterConfig)

func (*OperatorActions) CheckRestore

func (oa *OperatorActions) CheckRestore(from *TidbClusterConfig, to *TidbClusterConfig) error

func (*OperatorActions) CheckScaleInSafely

func (oa *OperatorActions) CheckScaleInSafely(info *TidbClusterConfig) error

func (*OperatorActions) CheckScaledCorrectly

func (oa *OperatorActions) CheckScaledCorrectly(info *TidbClusterConfig, podUIDsBeforeScale map[string]types.UID) error

func (*OperatorActions) CheckScheduledBackup

func (oa *OperatorActions) CheckScheduledBackup(info *TidbClusterConfig) error

func (*OperatorActions) CheckTidbClusterStatus

func (oa *OperatorActions) CheckTidbClusterStatus(info *TidbClusterConfig) error

func (*OperatorActions) CheckTidbClusterStatusOrDie

func (oa *OperatorActions) CheckTidbClusterStatusOrDie(info *TidbClusterConfig)

func (*OperatorActions) CheckTidbClustersAvailable

func (oa *OperatorActions) CheckTidbClustersAvailable(infos []*TidbClusterConfig) error

func (*OperatorActions) CheckTidbClustersAvailableOrDie

func (oa *OperatorActions) CheckTidbClustersAvailableOrDie(infos []*TidbClusterConfig)

func (*OperatorActions) CheckUpgrade

func (oa *OperatorActions) CheckUpgrade(ctx context.Context, info *TidbClusterConfig) error

TODO: add explanation

func (*OperatorActions) CheckUpgradeComplete added in v1.0.2

func (oa *OperatorActions) CheckUpgradeComplete(info *TidbClusterConfig) error

func (*OperatorActions) CheckUpgradeCompleteOrDie added in v1.0.2

func (oa *OperatorActions) CheckUpgradeCompleteOrDie(info *TidbClusterConfig)

func (*OperatorActions) CheckUpgradeOrDie

func (oa *OperatorActions) CheckUpgradeOrDie(ctx context.Context, info *TidbClusterConfig)

func (*OperatorActions) CleanCRDOrDie added in v1.0.3

func (oa *OperatorActions) CleanCRDOrDie()

func (*OperatorActions) CleanMonitor added in v1.2.0

func (oa *OperatorActions) CleanMonitor(info *TidbClusterConfig) error

func (*OperatorActions) CleanOperatorOrDie

func (oa *OperatorActions) CleanOperatorOrDie(info *OperatorConfig)

func (*OperatorActions) CleanWebHookAndService

func (oa *OperatorActions) CleanWebHookAndService(name string) error

func (*OperatorActions) CleanWebHookAndServiceOrDie

func (oa *OperatorActions) CleanWebHookAndServiceOrDie(name string)

func (*OperatorActions) CreateCRDOrDie added in v1.3.2

func (oa *OperatorActions) CreateCRDOrDie(info *OperatorConfig)

func (*OperatorActions) CreateReleasedCRDOrDie added in v1.3.2

func (oa *OperatorActions) CreateReleasedCRDOrDie(version string)

func (*OperatorActions) CreateSecret

func (oa *OperatorActions) CreateSecret(info *TidbClusterConfig) error

func (*OperatorActions) DataIsTheSameAs added in v1.1.0

func (oa *OperatorActions) DataIsTheSameAs(tc, otherInfo *TidbClusterConfig) (bool, error)

func (*OperatorActions) DeletePDDataThenCheckFailover added in v1.1.0

func (oa *OperatorActions) DeletePDDataThenCheckFailover(info *TidbClusterConfig, pdFailoverPeriod time.Duration) error

func (*OperatorActions) DeletePDDataThenCheckFailoverOrDie added in v1.1.0

func (oa *OperatorActions) DeletePDDataThenCheckFailoverOrDie(info *TidbClusterConfig, pdFailoverPeriod time.Duration)

func (*OperatorActions) DeployAdHocBackup

func (oa *OperatorActions) DeployAdHocBackup(info *TidbClusterConfig) error

func (*OperatorActions) DeployAndCheckIncrementalBackup added in v1.2.0

func (oa *OperatorActions) DeployAndCheckIncrementalBackup(from, to *TidbClusterConfig, ts string) error

func (*OperatorActions) DeployAndCheckPump added in v1.1.0

func (oa *OperatorActions) DeployAndCheckPump(tc *TidbClusterConfig) error

func (*OperatorActions) DeployDMMySQLOrDie added in v1.2.0

func (oa *OperatorActions) DeployDMMySQLOrDie(ns string)

func (*OperatorActions) DeployDMTiDBOrDie added in v1.2.0

func (oa *OperatorActions) DeployDMTiDBOrDie()

func (*OperatorActions) DeployDrainer added in v1.1.0

func (oa *OperatorActions) DeployDrainer(info *DrainerConfig, source *TidbClusterConfig) error

func (*OperatorActions) DeployDrainerOrDie added in v1.1.0

func (oa *OperatorActions) DeployDrainerOrDie(info *DrainerConfig, source *TidbClusterConfig)

func (*OperatorActions) DeployIncrementalBackup

func (oa *OperatorActions) DeployIncrementalBackup(from *TidbClusterConfig, to *TidbClusterConfig, withDrainer bool, ts string) error

func (*OperatorActions) DeployMonitor added in v1.2.0

func (oa *OperatorActions) DeployMonitor(info *TidbClusterConfig) error

func (*OperatorActions) DeployOperator

func (oa *OperatorActions) DeployOperator(info *OperatorConfig) error

func (*OperatorActions) DeployOperatorOrDie

func (oa *OperatorActions) DeployOperatorOrDie(info *OperatorConfig)

func (*OperatorActions) DeployScheduledBackup

func (oa *OperatorActions) DeployScheduledBackup(info *TidbClusterConfig) error

func (*OperatorActions) DeployTidbCluster

func (oa *OperatorActions) DeployTidbCluster(info *TidbClusterConfig) error

func (*OperatorActions) DeployTidbClusterOrDie

func (oa *OperatorActions) DeployTidbClusterOrDie(info *TidbClusterConfig)

func (*OperatorActions) DumpAllLogs

func (oa *OperatorActions) DumpAllLogs(operatorInfo *OperatorConfig, testClusters []*TidbClusterConfig) error

func (*OperatorActions) EmitEvent

func (oa *OperatorActions) EmitEvent(info *TidbClusterConfig, message string)

func (*OperatorActions) GetNodeMap

func (oa *OperatorActions) GetNodeMap(info *TidbClusterConfig, component string) (map[string][]string, error)

func (*OperatorActions) GetPodUIDMap

func (oa *OperatorActions) GetPodUIDMap(info *TidbClusterConfig) (map[string]types.UID, error)

func (*OperatorActions) IsMembersReady added in v1.3.3

func (oa *OperatorActions) IsMembersReady(obj metav1.Object, component v1alpha1.MemberType) error

func (*OperatorActions) LabelNodes

func (oa *OperatorActions) LabelNodes() error

func (*OperatorActions) LabelNodesOrDie

func (oa *OperatorActions) LabelNodesOrDie()

func (*OperatorActions) RegisterWebHookAndService

func (oa *OperatorActions) RegisterWebHookAndService(configName, namespace, service string, ctx *apimachinery.CertContext) error

func (*OperatorActions) RegisterWebHookAndServiceOrDie

func (oa *OperatorActions) RegisterWebHookAndServiceOrDie(configName, namespace, service string, context *apimachinery.CertContext)

func (*OperatorActions) ReplaceCRDOrDie added in v1.3.2

func (oa *OperatorActions) ReplaceCRDOrDie(info *OperatorConfig)

func (*OperatorActions) Restore

func (oa *OperatorActions) Restore(from *TidbClusterConfig, to *TidbClusterConfig) error

func (*OperatorActions) RestoreIncrementalFiles added in v1.1.0

func (oa *OperatorActions) RestoreIncrementalFiles(from *DrainerConfig, to *TidbClusterConfig, stopTSO int64) error

func (*OperatorActions) RunEventWorker added in v1.1.0

func (oa *OperatorActions) RunEventWorker()

func (*OperatorActions) RunKubectlOrDie added in v1.3.0

func (oa *OperatorActions) RunKubectlOrDie(args ...string) string

func (*OperatorActions) ScaleTidbCluster

func (oa *OperatorActions) ScaleTidbCluster(info *TidbClusterConfig) error

func (*OperatorActions) ScaleTidbClusterOrDie

func (oa *OperatorActions) ScaleTidbClusterOrDie(info *TidbClusterConfig)

func (*OperatorActions) StopInsertDataTo

func (oa *OperatorActions) StopInsertDataTo(info *TidbClusterConfig)

func (*OperatorActions) TruncateSSTFileThenCheckFailover

func (oa *OperatorActions) TruncateSSTFileThenCheckFailover(info *TidbClusterConfig, tikvFailoverPeriod time.Duration) error

func (*OperatorActions) TruncateSSTFileThenCheckFailoverOrDie

func (oa *OperatorActions) TruncateSSTFileThenCheckFailoverOrDie(info *TidbClusterConfig, tikvFailoverPeriod time.Duration)

func (*OperatorActions) UpgradeOperator

func (oa *OperatorActions) UpgradeOperator(info *OperatorConfig) error

func (*OperatorActions) UpgradeOperatorOrDie

func (oa *OperatorActions) UpgradeOperatorOrDie(info *OperatorConfig)

func (*OperatorActions) UpgradeTidbCluster

func (oa *OperatorActions) UpgradeTidbCluster(info *TidbClusterConfig) error

func (*OperatorActions) UpgradeTidbClusterOrDie

func (oa *OperatorActions) UpgradeTidbClusterOrDie(info *TidbClusterConfig)

func (*OperatorActions) WaitForDmClusterDeleted added in v1.2.0

func (oa *OperatorActions) WaitForDmClusterDeleted(ns, dcName string, timeout, pollInterval time.Duration) error

func (*OperatorActions) WaitForDmClusterReady added in v1.2.0

func (oa *OperatorActions) WaitForDmClusterReady(dc *v1alpha1.DMCluster, timeout, pollInterval time.Duration) error

func (*OperatorActions) WaitForTiDBNGMonitoringReady added in v1.3.0

func (oa *OperatorActions) WaitForTiDBNGMonitoringReady(tngm *v1alpha1.TidbNGMonitoring, timeout, pollInterval time.Duration) error

func (*OperatorActions) WaitForTidbClusterInitRandomPassword added in v1.3.0

func (oa *OperatorActions) WaitForTidbClusterInitRandomPassword(tc *v1alpha1.TidbCluster, fw portforward.PortForward, timeout, pollInterval time.Duration) error

func (*OperatorActions) WaitForTidbClusterReady added in v1.1.0

func (oa *OperatorActions) WaitForTidbClusterReady(tc *v1alpha1.TidbCluster, timeout, pollInterval time.Duration) error

FIXME: this duplicates with WaitForTidbClusterReady in crd_test_utils.go, and all functions in it TODO: sync with e2e doc

func (*OperatorActions) WaitForTidbComponentsReady added in v1.3.0

func (oa *OperatorActions) WaitForTidbComponentsReady(tc *v1alpha1.TidbCluster, componentsFilter map[v1alpha1.MemberType]struct{}, timeout, pollInterval time.Duration) error

WaitForTidbComponentsReady will wait for tidbcluster components to be ready except those specified in componentsFilter.

func (*OperatorActions) WaitPodOnNodeReadyOrDie added in v1.1.0

func (oa *OperatorActions) WaitPodOnNodeReadyOrDie(clusters []*TidbClusterConfig, faultNode string)

type OperatorConfig

type OperatorConfig struct {
	Namespace                 string
	ReleaseName               string
	Image                     string
	Tag                       string
	ControllerManagerReplicas *int
	SchedulerImage            string
	SchedulerTag              string
	SchedulerReplicas         *int
	Features                  []string
	LogLevel                  string
	WebhookServiceName        string
	WebhookSecretName         string
	WebhookConfigName         string
	Context                   *apimachinery.CertContext
	ImagePullPolicy           corev1.PullPolicy
	TestMode                  bool
	WebhookEnabled            bool
	StsWebhookEnabled         bool
	DefaultingEnabled         bool
	ValidatingEnabled         bool
	Cabundle                  string
	BackupImage               string
	AutoFailover              *bool
	AppendReleaseSuffix       bool
	// Additional STRING values, set via --set-string flag.
	StringValues map[string]string
	Selector     []string
}

func (*OperatorConfig) Enabled added in v1.1.0

func (oi *OperatorConfig) Enabled(feature string) bool

func (*OperatorConfig) OperatorHelmSetBoolean added in v1.1.0

func (oi *OperatorConfig) OperatorHelmSetBoolean() string

func (*OperatorConfig) OperatorHelmSetString

func (oi *OperatorConfig) OperatorHelmSetString(m map[string]string) string

type RegionInfo

type RegionInfo struct {
	ID          uint64              `json:"id"`
	StartKey    string              `json:"start_key"`
	EndKey      string              `json:"end_key"`
	RegionEpoch *metapb.RegionEpoch `json:"epoch,omitempty"`
	Peers       []*metapb.Peer      `json:"peers,omitempty"`

	Leader          *metapb.Peer      `json:"leader,omitempty"`
	DownPeers       []*pdpb.PeerStats `json:"down_peers,omitempty"`
	PendingPeers    []*metapb.Peer    `json:"pending_peers,omitempty"`
	WrittenBytes    uint64            `json:"written_bytes,omitempty"`
	ReadBytes       uint64            `json:"read_bytes,omitempty"`
	ApproximateSize int64             `json:"approximate_size,omitempty"`
	ApproximateKeys int64             `json:"approximate_keys,omitempty"`
}

RegionInfo records detail region info for api usage.

type RegionsInfo

type RegionsInfo struct {
	Count   int           `json:"count"`
	Regions []*RegionInfo `json:"regions"`
}

RegionsInfo contains some regions with the detailed region info.

type TidbClusterConfig

type TidbClusterConfig struct {
	BackupName       string
	Namespace        string
	ClusterName      string
	EnablePVReclaim  bool
	OperatorTag      string
	PDImage          string
	TiKVImage        string
	TiDBImage        string
	PumpImage        string
	StorageClassName string
	Password         string
	RecordCount      string
	InsertBatchSize  string
	Resources        map[string]string // TODO: rename this to TidbClusterCfg
	Args             map[string]string // TODO: rename this to BackupCfg

	Monitor                bool
	UserName               string
	InitSecretName         string
	BackupSecretName       string
	EnableConfigMapRollout bool
	ClusterVersion         string

	PDPreStartScript   string
	TiDBPreStartScript string
	TiKVPreStartScript string

	PDMaxReplicas       int
	TiKVGrpcConcurrency int
	TiDBTokenLimit      int
	PDLogLevel          string

	BlockWriteConfig blockwriter.Config
	GrafanaClient    *metrics.Client
	TopologyKey      string

	// TODO: remove this reference, which is not actually a configuration
	Clustrer *v1alpha1.TidbCluster
	// contains filtered or unexported fields
}

func (*TidbClusterConfig) BackupHelmSetString

func (tc *TidbClusterConfig) BackupHelmSetString(m map[string]string) string

func (*TidbClusterConfig) BuildSubValues

func (tc *TidbClusterConfig) BuildSubValues(path string) (string, error)

func (*TidbClusterConfig) DSN

func (tc *TidbClusterConfig) DSN(dbName string) string

func (*TidbClusterConfig) FullName

func (tc *TidbClusterConfig) FullName() string

func (*TidbClusterConfig) GenerateBackupDirPodName added in v1.0.4

func (tc *TidbClusterConfig) GenerateBackupDirPodName() string

func (*TidbClusterConfig) ScalePD

func (tc *TidbClusterConfig) ScalePD(replicas uint) *TidbClusterConfig

func (*TidbClusterConfig) ScaleTiDB

func (tc *TidbClusterConfig) ScaleTiDB(replicas uint) *TidbClusterConfig

func (*TidbClusterConfig) ScaleTiKV

func (tc *TidbClusterConfig) ScaleTiKV(replicas uint) *TidbClusterConfig

func (*TidbClusterConfig) SetHostNetwork added in v1.2.0

func (tc *TidbClusterConfig) SetHostNetwork(flag bool) *TidbClusterConfig

func (*TidbClusterConfig) String

func (tc *TidbClusterConfig) String() string

func (*TidbClusterConfig) TidbClusterHelmSetBoolean added in v1.1.10

func (tc *TidbClusterConfig) TidbClusterHelmSetBoolean(m map[string]bool) string

func (*TidbClusterConfig) TidbClusterHelmSetString

func (tc *TidbClusterConfig) TidbClusterHelmSetString(m map[string]string) string

func (*TidbClusterConfig) UpdatePDLogLevel

func (tc *TidbClusterConfig) UpdatePDLogLevel(logLevel string) *TidbClusterConfig

func (*TidbClusterConfig) UpdatePdMaxReplicas

func (tc *TidbClusterConfig) UpdatePdMaxReplicas(maxReplicas int) *TidbClusterConfig

FIXME: update of PD configuration do not work now #487

func (*TidbClusterConfig) UpdateTiDBTokenLimit

func (tc *TidbClusterConfig) UpdateTiDBTokenLimit(tokenLimit int) *TidbClusterConfig

func (*TidbClusterConfig) UpdateTiKVGrpcConcurrency

func (tc *TidbClusterConfig) UpdateTiKVGrpcConcurrency(concurrency int) *TidbClusterConfig

func (*TidbClusterConfig) UpgradeAll

func (tc *TidbClusterConfig) UpgradeAll(tag string) *TidbClusterConfig

func (*TidbClusterConfig) UpgradePD

func (tc *TidbClusterConfig) UpgradePD(image string) *TidbClusterConfig

func (*TidbClusterConfig) UpgradeTiDB

func (tc *TidbClusterConfig) UpgradeTiDB(image string) *TidbClusterConfig

func (*TidbClusterConfig) UpgradeTiKV

func (tc *TidbClusterConfig) UpgradeTiKV(image string) *TidbClusterConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL