Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, pobj PT, action func(PT)) error
- func ChangeObjStatus[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, pobj PT, action func()) error
- func CheckObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, namespacedName types.NamespacedName, ...) func(g gomega.Gomega)
- func CheckObjExists(testCtx *testutil.TestContext, namespacedName types.NamespacedName, ...) func(g gomega.Gomega)
- func CheckedCreateCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
- func CheckedCreateK8sResource(testCtx *testutil.TestContext, obj client.Object) client.Object
- func ClearClusterResources(testCtx *testutil.TestContext)
- func ClearClusterResourcesWithRemoveFinalizerOption(testCtx *testutil.TestContext)
- func ClearResources[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], ...](testCtx *testutil.TestContext, funcSig func(T, L), ...)
- func ClearResourcesWithRemoveFinalizerOption[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], ...](testCtx *testutil.TestContext, _ func(T, L), removeFinalizer bool, ...)
- func CreateConsensusMysqlCluster(testCtx *testutil.TestContext, ...) *appsv1alpha1.Cluster
- func CreateConsensusMysqlClusterDef(testCtx *testutil.TestContext, clusterDefName, componentDefName string) *appsv1alpha1.ClusterDefinition
- func CreateConsensusMysqlClusterVersion(testCtx *testutil.TestContext, ...) *appsv1alpha1.ClusterVersion
- func CreateCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
- func CreateK8sResource(testCtx *testutil.TestContext, obj client.Object) client.Object
- func CreateObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
- func CreateOpsRequest(ctx context.Context, testCtx testutil.TestContext, ...) *appsv1alpha1.OpsRequest
- func CreateRestartOpsRequest(testCtx *testutil.TestContext, clusterName, opsRequestName string, ...) *appsv1alpha1.OpsRequest
- func CreateStorageClass(testCtx *testutil.TestContext, storageClassName string, ...) *storagev1.StorageClass
- func CustomizeObjYAML(a ...any) func(string) string
- func DeleteObject[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, key types.NamespacedName, pobj PT)
- func GetAndChangeObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, namespacedName types.NamespacedName, ...) func() error
- func GetAndChangeObjStatus[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, namespacedName types.NamespacedName, ...) func() error
- func GetClusterComponentPhase(testCtx *testutil.TestContext, clusterKey types.NamespacedName, ...) func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase
- func GetClusterGeneration(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) int64
- func GetClusterObservedGeneration(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) int64
- func GetClusterPhase(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) appsv1alpha1.ClusterPhase
- func GetOpsRequestCompPhase(ctx context.Context, testCtx testutil.TestContext, ...) func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase
- func GetOpsRequestPhase(testCtx *testutil.TestContext, opsKey types.NamespacedName) func(gomega.Gomega) appsv1alpha1.OpsPhase
- func GetRandomizedKey(namespace, prefix string) types.NamespacedName
- func InitClusterWithHybridComps(testCtx *testutil.TestContext, ...) (*appsv1alpha1.ClusterDefinition, *appsv1alpha1.ClusterVersion, ...)
- func InitConsensusMysql(testCtx *testutil.TestContext, ...) (*appsv1alpha1.ClusterDefinition, *appsv1alpha1.ClusterVersion, ...)
- func List[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], ...](testCtx *testutil.TestContext, _ func(T, L), opt ...client.ListOption) func(gomega.Gomega) []T
- func MockConsensusComponentPods(testCtx *testutil.TestContext, sts *appsv1.StatefulSet, ...) []*corev1.Pod
- func MockConsensusComponentStatefulSet(testCtx *testutil.TestContext, clusterName, consensusCompName string) *appsv1.StatefulSet
- func MockConsensusComponentStsPod(testCtx *testutil.TestContext, sts *appsv1.StatefulSet, ...) *corev1.Pod
- func MockReplicationComponentPod(g gomega.Gomega, testCtx testutil.TestContext, sts *appsv1.StatefulSet, ...) *corev1.Pod
- func MockReplicationComponentPods(g gomega.Gomega, testCtx testutil.TestContext, sts *appsv1.StatefulSet, ...) []*corev1.Pod
- func MockStatelessComponentDeploy(testCtx *testutil.TestContext, clusterName, componentName string) *appsv1.Deployment
- func MockStatelessPod(testCtx *testutil.TestContext, deploy *appsv1.Deployment, ...) *corev1.Pod
- func NewConfigMap(namespace, name string, options ...any) *corev1.ConfigMap
- func NewCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](filePath string, pobj PT, actions ...any) PT
- func NewOpsRequestObj(opsRequestName, namespace, clusterName string, opsType appsv1alpha1.OpsType) *appsv1alpha1.OpsRequest
- func NewPVC(size string) corev1.PersistentVolumeClaimSpec
- func NewPVCSpec(size string) appsv1alpha1.PersistentVolumeClaimSpec
- func RandomizedObjName() func(client.Object)
- func ResetToIgnoreFinalizers()
- func SetConfigMapData(key string, value string) func(*corev1.ConfigMap)
- func WithAnnotations(keysAndValues ...string) func(client.Object)
- func WithLabels(keysAndValues ...string) func(client.Object)
- func WithMap(keysAndValues ...string) map[string]string
- func WithName(name string) func(client.Object)
- func WithNamespace(namespace string) func(client.Object)
- func WithNamespacedName(resourceName, ns string) func(client.Object)
- type BaseFactory
- func (factory *BaseFactory[T, PT, F]) AddAnnotations(keysAndValues ...string) *F
- func (factory *BaseFactory[T, PT, F]) AddAnnotationsInMap(annotations map[string]string) *F
- func (factory *BaseFactory[T, PT, F]) AddAppComponentLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) AddAppInstanceLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) AddAppManangedByLabel() *F
- func (factory *BaseFactory[T, PT, F]) AddAppNameLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) AddConsensusSetAccessModeLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) AddControllerRevisionHashLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) AddFinalizers(finalizers []string) *F
- func (factory *BaseFactory[T, PT, F]) AddLabels(keysAndValues ...string) *F
- func (factory *BaseFactory[T, PT, F]) AddLabelsInMap(labels map[string]string) *F
- func (factory *BaseFactory[T, PT, F]) AddRoleLabel(value string) *F
- func (factory *BaseFactory[T, PT, F]) Apply(changeFn func(PT)) *F
- func (factory *BaseFactory[T, PT, F]) CheckedCreate(testCtx *testutil.TestContext) *F
- func (factory *BaseFactory[T, PT, F]) Create(testCtx *testutil.TestContext) *F
- func (factory *BaseFactory[T, PT, F]) CreateCli(ctx context.Context, cli client.Client) *F
- func (factory *BaseFactory[T, PT, F]) GetObject() PT
- func (factory *BaseFactory[T, PT, F]) SetOwnerReferences(ownerAPIVersion string, ownerKind string, owner client.Object) *F
- func (factory *BaseFactory[T, PT, F]) WithRandomName() *F
- type ComponentDefTplType
- type MockBackupFactory
- func (factory *MockBackupFactory) SetBackLog(startTime, stopTime time.Time) *MockBackupFactory
- func (factory *MockBackupFactory) SetBackupPolicyName(backupPolicyName string) *MockBackupFactory
- func (factory *MockBackupFactory) SetBackupType(backupType dataprotectionv1alpha1.BackupType) *MockBackupFactory
- func (factory *MockBackupFactory) SetLabels(labels map[string]string) *MockBackupFactory
- type MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddDataFilePolicy() *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddHookPostCommand(postCommand string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddHookPreCommand(preCommand string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddLogfilePolicy() *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddMatchLabels(keyAndValues ...string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) AddSnapshotPolicy() *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetBackupRepo(repoName string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetBackupStatusUpdates(backupStatusUpdates []dataprotectionv1alpha1.BackupStatusUpdate) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetBackupToolName(backupToolName string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetBackupsHistoryLimit(backupsHistoryLimit int32) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetHookContainerName(containerName string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetPVC(pvcName string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetSchedule(schedule string, enable bool) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetScheduleStartWindowMinutes(startWindowMinutes *int64) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetTTL(duration string) *MockBackupPolicyFactory
- func (factory *MockBackupPolicyFactory) SetTargetSecretName(name string) *MockBackupPolicyFactory
- type MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddBackupPolicy(componentDef string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddDatafilePolicy() *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddHookPostCommand(postCommand string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddHookPreCommand(preCommand string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddIncrementalPolicy() *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) AddSnapshotPolicy() *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetBackupToolName(backupToolName string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetBackupsHistoryLimit(backupsHistoryLimit int32) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetClusterDefRef(clusterDefRef string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetHookContainerName(containerName string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetLabels(labels map[string]string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetSchedule(schedule string, enable bool) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetTTL(duration string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetTargetAccount(account string) *MockBackupPolicyTemplateFactory
- func (factory *MockBackupPolicyTemplateFactory) SetTargetRole(role string) *MockBackupPolicyTemplateFactory
- type MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetAsDefaultRepo(v bool) *MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetConfig(config map[string]string) *MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetCredential(ref *corev1.SecretReference) *MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetPVReclaimPolicy(policy string) *MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetStorageProviderRef(providerName string) *MockBackupRepoFactory
- func (factory *MockBackupRepoFactory) SetVolumeCapacity(amount string) *MockBackupRepoFactory
- type MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddComponentDef(tplType ComponentDefTplType, compDefName string) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddComponentRef(ref *appsv1alpha1.ComponentDefRef) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddConfigTemplate(name, configTemplateRef, configConstraintRef, namespace, volumeName string, ...) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddContainerEnv(containerName string, envVar corev1.EnvVar) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddContainerVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddHorizontalScalePolicy(policy appsv1alpha1.HorizontalScalePolicy) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddInitContainerVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddLogConfig(name, filePathPattern string) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddNamedServicePort(name string, port int32) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddReplicationSpec(replicationSpec *appsv1alpha1.ReplicationSetSpec) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddScriptTemplate(name, configTemplateRef, namespace, volumeName string, mode *int32) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddServicePort(port int32) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddSwitchoverSpec(switchoverSpec *appsv1alpha1.SwitchoverSpec) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) AddSystemAccountSpec(sysAccounts *appsv1alpha1.SystemAccountSpec) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) SetConnectionCredential(connectionCredential map[string]string, svc *appsv1alpha1.ServiceSpec) *MockClusterDefFactory
- func (factory *MockClusterDefFactory) SetServiceSpec(svc *appsv1alpha1.ServiceSpec) *MockClusterDefFactory
- type MockClusterFactory
- func (factory *MockClusterFactory) AddClusterToleration(toleration corev1.Toleration) *MockClusterFactory
- func (factory *MockClusterFactory) AddComponent(compName string, compDefName string) *MockClusterFactory
- func (factory *MockClusterFactory) AddComponentToleration(toleration corev1.Toleration) *MockClusterFactory
- func (factory *MockClusterFactory) AddRestorePointInTime(restoreTime metav1.Time, sourceCluster string) *MockClusterFactory
- func (factory *MockClusterFactory) AddService(serviceName string, serviceType corev1.ServiceType) *MockClusterFactory
- func (factory *MockClusterFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1alpha1.PersistentVolumeClaimSpec) *MockClusterFactory
- func (factory *MockClusterFactory) SetClassDefRef(classDefRef *appsv1alpha1.ClassDefRef) *MockClusterFactory
- func (factory *MockClusterFactory) SetClusterAffinity(affinity *appsv1alpha1.Affinity) *MockClusterFactory
- func (factory *MockClusterFactory) SetComponentAffinity(affinity *appsv1alpha1.Affinity) *MockClusterFactory
- func (factory *MockClusterFactory) SetEnabledLogs(logName ...string) *MockClusterFactory
- func (factory *MockClusterFactory) SetIssuer(issuer *appsv1alpha1.Issuer) *MockClusterFactory
- func (factory *MockClusterFactory) SetMonitor(monitor bool) *MockClusterFactory
- func (factory *MockClusterFactory) SetReplicas(replicas int32) *MockClusterFactory
- func (factory *MockClusterFactory) SetResources(resources corev1.ResourceRequirements) *MockClusterFactory
- func (factory *MockClusterFactory) SetServiceAccountName(serviceAccountName string) *MockClusterFactory
- func (factory *MockClusterFactory) SetSwitchPolicy(switchPolicy *appsv1alpha1.ClusterSwitchPolicy) *MockClusterFactory
- func (factory *MockClusterFactory) SetTLS(tls bool) *MockClusterFactory
- type MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddComponentVersion(compDefName string) *MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddConfigTemplate(name string, configTemplateRef string, configConstraintRef string, ...) *MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddContainer(container corev1.Container) *MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddContainerShort(name string, image string) *MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddInitContainer(container corev1.Container) *MockClusterVersionFactory
- func (factory *MockClusterVersionFactory) AddInitContainerShort(name string, image string) *MockClusterVersionFactory
- type MockComponentClassDefinitionFactory
- type MockComponentResourceConstraintFactory
- type MockDeploymentFactory
- func (factory *MockDeploymentFactory) AddConfigmapVolume(volumeName, configmapName string) *MockDeploymentFactory
- func (factory *MockDeploymentFactory) AddContainer(container corev1.Container) *MockDeploymentFactory
- func (factory *MockDeploymentFactory) AddVolume(volume corev1.Volume) *MockDeploymentFactory
- func (factory *MockDeploymentFactory) SetMinReadySeconds(minReadySeconds int32) *MockDeploymentFactory
- func (factory *MockDeploymentFactory) SetReplicas(replicas int32) *MockDeploymentFactory
- type MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetAnnotations(annotations map[string]string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetStorage(storageSize string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeClaimFactory
- type MockPodFactory
- type MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) AddTargetMatchLabels(keyAndValues ...string) *MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) AddTargetVolume(volume corev1.Volume) *MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) AddTargetVolumeMount(volumeMount corev1.VolumeMount) *MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) AddTargetVolumePVC(volumeName, pvcName string) *MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) SetBackupJobName(backupJobName string) *MockRestoreJobFactory
- func (factory *MockRestoreJobFactory) SetTargetSecretName(name string) *MockRestoreJobFactory
- type MockStatefulSetFactory
- func (factory *MockStatefulSetFactory) AddConfigmapVolume(volumeName string, configmapName string) *MockStatefulSetFactory
- func (factory *MockStatefulSetFactory) AddContainer(container corev1.Container) *MockStatefulSetFactory
- func (factory *MockStatefulSetFactory) AddVolume(volume corev1.Volume) *MockStatefulSetFactory
- func (factory *MockStatefulSetFactory) AddVolumeClaimTemplate(pvc corev1.PersistentVolumeClaim) *MockStatefulSetFactory
- func (factory *MockStatefulSetFactory) SetReplicas(replicas int32) *MockStatefulSetFactory
- type ResourceConstraintTplType
Constants ¶
const ( KubeBlocks = "kubeblocks" LogVolumeName = "log" ConfVolumeName = "conf" DataVolumeName = "data" ScriptsVolumeName = "scripts" ServiceDefaultName = "" ServiceHeadlessName = "headless" ServiceVPCName = "vpc-lb" ServiceInternetName = "internet-lb" ReplicationPodRoleVolume = "pod-role" ReplicationRoleLabelFieldPath = "metadata.labels['kubeblocks.io/role']" DefaultReplicationCandidateIndex = 0 DefaultReplicationReplicas = 2 ApeCloudMySQLImage = "docker.io/apecloud/apecloud-mysql-server:latest" DefaultMySQLContainerName = "mysql" NginxImage = "nginx" DefaultNginxContainerName = "nginx" DefaultRedisCompDefName = "redis" DefaultRedisCompSpecName = "redis-rsts" DefaultRedisImageName = "redis:7.0.5" DefaultRedisContainerName = "redis" DefaultRedisInitContainerName = "redis-init-container" Class1c1gName = "general-1c1g" Class2c4gName = "general-2c4g" DefaultResourceConstraintName = "kb-resource-constraint" )
const (
ConsensusReplicas = 3
)
Variables ¶
var ( Class1c1g = appsv1alpha1.ComponentClass{ Name: Class1c1gName, CPU: resource.MustParse("1"), Memory: resource.MustParse("1Gi"), } Class2c4g = appsv1alpha1.ComponentClass{ Name: Class2c4gName, CPU: resource.MustParse("2"), Memory: resource.MustParse("4Gi"), } DefaultClasses = map[string]appsv1alpha1.ComponentClass{ Class1c1gName: Class1c1g, Class2c4gName: Class2c4g, } )
var ToIgnoreFinalizers []string
Functions ¶
func ChangeObj ¶
func ChangeObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, pobj PT, action func(PT)) error
func ChangeObjStatus ¶
func ChangeObjStatus[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, pobj PT, action func()) error
func CheckObj ¶
func CheckObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, namespacedName types.NamespacedName, check func(g gomega.Gomega, pobj PT)) func(g gomega.Gomega)
func CheckObjExists ¶
func CheckObjExists(testCtx *testutil.TestContext, namespacedName types.NamespacedName, obj client.Object, expectExisted bool) func(g gomega.Gomega)
func CheckedCreateCustomizedObj ¶
func CheckedCreateCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
func ClearClusterResources ¶
func ClearClusterResources(testCtx *testutil.TestContext)
ClearClusterResources clears all dependent resources belonging to existing clusters. The function is intended to be called to clean resources created by cluster controller in envtest environment without UseExistingCluster set, where garbage collection lacks.
func ClearClusterResourcesWithRemoveFinalizerOption ¶ added in v0.6.0
func ClearClusterResourcesWithRemoveFinalizerOption(testCtx *testutil.TestContext)
ClearClusterResourcesWithRemoveFinalizerOption clears all dependent resources belonging to existing clusters.
func ClearResources ¶
func ClearResources[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], PL intctrlutil.PObjList[T, L]]( testCtx *testutil.TestContext, funcSig func(T, L), opts ...client.DeleteAllOfOption)
ClearResources clears all resources of the given type T satisfying the input ListOptions.
func ClearResourcesWithRemoveFinalizerOption ¶
func ClearResourcesWithRemoveFinalizerOption[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], PL intctrlutil.PObjList[T, L]]( testCtx *testutil.TestContext, _ func(T, L), removeFinalizer bool, opts ...client.DeleteAllOfOption)
ClearResourcesWithRemoveFinalizerOption clears all resources of the given type T with removeFinalizer specifier, and satisfying the input ListOptions.
func CreateConsensusMysqlCluster ¶
func CreateConsensusMysqlCluster( testCtx *testutil.TestContext, clusterDefName, clusterVersionName, clusterName, workloadType, consensusCompName string, pvcSize ...string) *appsv1alpha1.Cluster
CreateConsensusMysqlCluster creates a mysql cluster with a component of ConsensusSet type.
func CreateConsensusMysqlClusterDef ¶
func CreateConsensusMysqlClusterDef(testCtx *testutil.TestContext, clusterDefName, componentDefName string) *appsv1alpha1.ClusterDefinition
CreateConsensusMysqlClusterDef creates a mysql clusterDefinition with a component of ConsensusSet type.
func CreateConsensusMysqlClusterVersion ¶
func CreateConsensusMysqlClusterVersion(testCtx *testutil.TestContext, clusterDefName, clusterVersionName, workloadType string) *appsv1alpha1.ClusterVersion
CreateConsensusMysqlClusterVersion creates a mysql clusterVersion with a component of ConsensusSet type.
func CreateCustomizedObj ¶
func CreateCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
func CreateK8sResource ¶
func CreateObj ¶
func CreateObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
CreateObj calls CreateCustomizedObj with CustomizeObjYAML wrapper for any optional modify actions.
func CreateOpsRequest ¶
func CreateOpsRequest(ctx context.Context, testCtx testutil.TestContext, opsRequest *appsv1alpha1.OpsRequest) *appsv1alpha1.OpsRequest
CreateOpsRequest calls the api to create the OpsRequest resource.
func CreateRestartOpsRequest ¶
func CreateRestartOpsRequest(testCtx *testutil.TestContext, clusterName, opsRequestName string, componentNames []string) *appsv1alpha1.OpsRequest
CreateRestartOpsRequest creates an OpsRequest of restart type for testing.
func CreateStorageClass ¶
func CreateStorageClass(testCtx *testutil.TestContext, storageClassName string, allowVolumeExpansion bool) *storagev1.StorageClass
func CustomizeObjYAML ¶
func DeleteObject ¶
func DeleteObject[T intctrlutil.Object, PT intctrlutil.PObject[T]]( testCtx *testutil.TestContext, key types.NamespacedName, pobj PT)
func GetAndChangeObj ¶
func GetAndChangeObj[T intctrlutil.Object, PT intctrlutil.PObject[T]]( testCtx *testutil.TestContext, namespacedName types.NamespacedName, action func(PT)) func() error
func GetAndChangeObjStatus ¶
func GetAndChangeObjStatus[T intctrlutil.Object, PT intctrlutil.PObject[T]]( testCtx *testutil.TestContext, namespacedName types.NamespacedName, action func(pobj PT)) func() error
func GetClusterComponentPhase ¶
func GetClusterComponentPhase(testCtx *testutil.TestContext, clusterKey types.NamespacedName, componentName string) func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase
GetClusterComponentPhase gets the component phase of testing cluster for verification.
func GetClusterGeneration ¶ added in v0.6.0
func GetClusterGeneration(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) int64
GetClusterGeneration gets the testing cluster's metadata.generation.
func GetClusterObservedGeneration ¶
func GetClusterObservedGeneration(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) int64
GetClusterObservedGeneration gets the testing cluster's ObservedGeneration in status for verification.
func GetClusterPhase ¶
func GetClusterPhase(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) appsv1alpha1.ClusterPhase
GetClusterPhase gets the testing cluster's phase in status for verification.
func GetOpsRequestCompPhase ¶
func GetOpsRequestCompPhase(ctx context.Context, testCtx testutil.TestContext, opsName, componentName string) func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase
GetOpsRequestCompPhase gets the component phase of testing OpsRequest for verification.
func GetOpsRequestPhase ¶
func GetOpsRequestPhase(testCtx *testutil.TestContext, opsKey types.NamespacedName) func(gomega.Gomega) appsv1alpha1.OpsPhase
GetOpsRequestPhase gets the testing opsRequest phase for verification.
func GetRandomizedKey ¶
func GetRandomizedKey(namespace, prefix string) types.NamespacedName
func InitClusterWithHybridComps ¶
func InitClusterWithHybridComps( testCtx *testutil.TestContext, clusterDefName, clusterVersionName, clusterName, statelessCompDefName, statefulCompDefName, consensusCompDefName string) (*appsv1alpha1.ClusterDefinition, *appsv1alpha1.ClusterVersion, *appsv1alpha1.Cluster)
InitClusterWithHybridComps initializes a cluster environment for testing, includes ClusterDefinition/ClusterVersion/Cluster resources.
func InitConsensusMysql ¶
func InitConsensusMysql(testCtx *testutil.TestContext, clusterDefName, clusterVersionName, clusterName, consensusCompType, consensusCompName string) (*appsv1alpha1.ClusterDefinition, *appsv1alpha1.ClusterVersion, *appsv1alpha1.Cluster)
InitConsensusMysql initializes a cluster environment which only contains a component of ConsensusSet type for testing, includes ClusterDefinition/ClusterVersion/Cluster resources.
func List ¶ added in v0.6.0
func List[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], PL intctrlutil.PObjList[T, L]]( testCtx *testutil.TestContext, _ func(T, L), opt ...client.ListOption) func(gomega.Gomega) []T
func MockConsensusComponentPods ¶
func MockConsensusComponentPods( testCtx *testutil.TestContext, sts *appsv1.StatefulSet, clusterName, consensusCompName string) []*corev1.Pod
MockConsensusComponentPods mocks the component pods, just using in envTest
func MockConsensusComponentStatefulSet ¶
func MockConsensusComponentStatefulSet( testCtx *testutil.TestContext, clusterName, consensusCompName string) *appsv1.StatefulSet
MockConsensusComponentStatefulSet mocks the component statefulSet, just using in envTest
func MockConsensusComponentStsPod ¶
func MockConsensusComponentStsPod( testCtx *testutil.TestContext, sts *appsv1.StatefulSet, clusterName, consensusCompName, podName, podRole, accessMode string) *corev1.Pod
MockConsensusComponentStsPod mocks to create the pod of the consensus StatefulSet, just using in envTest
func MockReplicationComponentPod ¶
func MockReplicationComponentPod( g gomega.Gomega, testCtx testutil.TestContext, sts *appsv1.StatefulSet, clusterName, compName, podName, roleName string) *corev1.Pod
MockReplicationComponentPod mocks to create pod of the replication StatefulSet, just using in envTest
func MockReplicationComponentPods ¶
func MockReplicationComponentPods( g gomega.Gomega, testCtx testutil.TestContext, sts *appsv1.StatefulSet, clusterName, compName string, roleByIdx map[int32]string) []*corev1.Pod
MockReplicationComponentPods mocks to create pods of the component, just using in envTest. If roleByIdx is empty, will have implicit pod-0 being "primary" role and others to "secondary" role.
func MockStatelessComponentDeploy ¶
func MockStatelessComponentDeploy(testCtx *testutil.TestContext, clusterName, componentName string) *appsv1.Deployment
MockStatelessComponentDeploy mocks a deployment workload of the stateless component.
func MockStatelessPod ¶
func MockStatelessPod(testCtx *testutil.TestContext, deploy *appsv1.Deployment, clusterName, componentName, podName string) *corev1.Pod
MockStatelessPod mocks the pods of the deployment workload.
func NewCustomizedObj ¶
func NewCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]]( filePath string, pobj PT, actions ...any) PT
func NewOpsRequestObj ¶
func NewOpsRequestObj(opsRequestName, namespace, clusterName string, opsType appsv1alpha1.OpsType) *appsv1alpha1.OpsRequest
NewOpsRequestObj only generates the OpsRequest Object, instead of actually creating this resource.
func NewPVC ¶
func NewPVC(size string) corev1.PersistentVolumeClaimSpec
func NewPVCSpec ¶
func NewPVCSpec(size string) appsv1alpha1.PersistentVolumeClaimSpec
NewPVCSpec creates appsv1alpha1.PersistentVolumeClaimSpec.
func RandomizedObjName ¶
func ResetToIgnoreFinalizers ¶
func ResetToIgnoreFinalizers()
func WithAnnotations ¶
func WithLabels ¶
func WithNamespace ¶
func WithNamespacedName ¶
Types ¶
type BaseFactory ¶
type BaseFactory[T intctrlutil.Object, PT intctrlutil.PObject[T], F any] struct { // contains filtered or unexported fields }
func (*BaseFactory[T, PT, F]) AddAnnotations ¶
func (factory *BaseFactory[T, PT, F]) AddAnnotations(keysAndValues ...string) *F
func (*BaseFactory[T, PT, F]) AddAnnotationsInMap ¶
func (factory *BaseFactory[T, PT, F]) AddAnnotationsInMap(annotations map[string]string) *F
func (*BaseFactory[T, PT, F]) AddAppComponentLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppComponentLabel(value string) *F
func (*BaseFactory[T, PT, F]) AddAppInstanceLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppInstanceLabel(value string) *F
func (*BaseFactory[T, PT, F]) AddAppManangedByLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppManangedByLabel() *F
func (*BaseFactory[T, PT, F]) AddAppNameLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppNameLabel(value string) *F
func (*BaseFactory[T, PT, F]) AddConsensusSetAccessModeLabel ¶
func (factory *BaseFactory[T, PT, F]) AddConsensusSetAccessModeLabel(value string) *F
func (*BaseFactory[T, PT, F]) AddControllerRevisionHashLabel ¶
func (factory *BaseFactory[T, PT, F]) AddControllerRevisionHashLabel(value string) *F
func (*BaseFactory[T, PT, F]) AddFinalizers ¶
func (factory *BaseFactory[T, PT, F]) AddFinalizers(finalizers []string) *F
func (*BaseFactory[T, PT, F]) AddLabels ¶
func (factory *BaseFactory[T, PT, F]) AddLabels(keysAndValues ...string) *F
func (*BaseFactory[T, PT, F]) AddLabelsInMap ¶
func (factory *BaseFactory[T, PT, F]) AddLabelsInMap(labels map[string]string) *F
func (*BaseFactory[T, PT, F]) AddRoleLabel ¶
func (factory *BaseFactory[T, PT, F]) AddRoleLabel(value string) *F
func (*BaseFactory[T, PT, F]) Apply ¶ added in v0.6.0
func (factory *BaseFactory[T, PT, F]) Apply(changeFn func(PT)) *F
func (*BaseFactory[T, PT, F]) CheckedCreate ¶
func (factory *BaseFactory[T, PT, F]) CheckedCreate(testCtx *testutil.TestContext) *F
func (*BaseFactory[T, PT, F]) Create ¶
func (factory *BaseFactory[T, PT, F]) Create(testCtx *testutil.TestContext) *F
func (*BaseFactory[T, PT, F]) CreateCli ¶
func (factory *BaseFactory[T, PT, F]) CreateCli(ctx context.Context, cli client.Client) *F
func (*BaseFactory[T, PT, F]) GetObject ¶
func (factory *BaseFactory[T, PT, F]) GetObject() PT
func (*BaseFactory[T, PT, F]) SetOwnerReferences ¶
func (factory *BaseFactory[T, PT, F]) SetOwnerReferences(ownerAPIVersion string, ownerKind string, owner client.Object) *F
func (*BaseFactory[T, PT, F]) WithRandomName ¶
func (factory *BaseFactory[T, PT, F]) WithRandomName() *F
type ComponentDefTplType ¶
type ComponentDefTplType string
const ( StatefulMySQLComponent ComponentDefTplType = "stateful-mysql" ConsensusMySQLComponent ComponentDefTplType = "consensus-mysql" ReplicationRedisComponent ComponentDefTplType = "replication-redis" StatelessNginxComponent ComponentDefTplType = "stateless-nginx" )
type MockBackupFactory ¶
type MockBackupFactory struct { BaseFactory[dataprotectionv1alpha1.Backup, *dataprotectionv1alpha1.Backup, MockBackupFactory] }
func NewBackupFactory ¶
func NewBackupFactory(namespace, name string) *MockBackupFactory
func (*MockBackupFactory) SetBackLog ¶
func (factory *MockBackupFactory) SetBackLog(startTime, stopTime time.Time) *MockBackupFactory
func (*MockBackupFactory) SetBackupPolicyName ¶
func (factory *MockBackupFactory) SetBackupPolicyName(backupPolicyName string) *MockBackupFactory
func (*MockBackupFactory) SetBackupType ¶
func (factory *MockBackupFactory) SetBackupType(backupType dataprotectionv1alpha1.BackupType) *MockBackupFactory
func (*MockBackupFactory) SetLabels ¶
func (factory *MockBackupFactory) SetLabels(labels map[string]string) *MockBackupFactory
type MockBackupPolicyFactory ¶
type MockBackupPolicyFactory struct { BaseFactory[dataprotectionv1alpha1.BackupPolicy, *dataprotectionv1alpha1.BackupPolicy, MockBackupPolicyFactory] // contains filtered or unexported fields }
func NewBackupPolicyFactory ¶
func NewBackupPolicyFactory(namespace, name string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddDataFilePolicy ¶ added in v0.6.0
func (factory *MockBackupPolicyFactory) AddDataFilePolicy() *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddHookPostCommand ¶
func (factory *MockBackupPolicyFactory) AddHookPostCommand(postCommand string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddHookPreCommand ¶
func (factory *MockBackupPolicyFactory) AddHookPreCommand(preCommand string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddLogfilePolicy ¶ added in v0.6.0
func (factory *MockBackupPolicyFactory) AddLogfilePolicy() *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddMatchLabels ¶
func (factory *MockBackupPolicyFactory) AddMatchLabels(keyAndValues ...string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) AddSnapshotPolicy ¶
func (factory *MockBackupPolicyFactory) AddSnapshotPolicy() *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetBackupRepo ¶ added in v0.6.0
func (factory *MockBackupPolicyFactory) SetBackupRepo(repoName string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetBackupStatusUpdates ¶ added in v0.6.0
func (factory *MockBackupPolicyFactory) SetBackupStatusUpdates(backupStatusUpdates []dataprotectionv1alpha1.BackupStatusUpdate) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetBackupToolName ¶
func (factory *MockBackupPolicyFactory) SetBackupToolName(backupToolName string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetBackupsHistoryLimit ¶
func (factory *MockBackupPolicyFactory) SetBackupsHistoryLimit(backupsHistoryLimit int32) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetHookContainerName ¶
func (factory *MockBackupPolicyFactory) SetHookContainerName(containerName string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetPVC ¶
func (factory *MockBackupPolicyFactory) SetPVC(pvcName string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetSchedule ¶
func (factory *MockBackupPolicyFactory) SetSchedule(schedule string, enable bool) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetScheduleStartWindowMinutes ¶
func (factory *MockBackupPolicyFactory) SetScheduleStartWindowMinutes(startWindowMinutes *int64) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetTTL ¶
func (factory *MockBackupPolicyFactory) SetTTL(duration string) *MockBackupPolicyFactory
func (*MockBackupPolicyFactory) SetTargetSecretName ¶
func (factory *MockBackupPolicyFactory) SetTargetSecretName(name string) *MockBackupPolicyFactory
type MockBackupPolicyTemplateFactory ¶
type MockBackupPolicyTemplateFactory struct { BaseFactory[appsv1alpha1.BackupPolicyTemplate, *appsv1alpha1.BackupPolicyTemplate, MockBackupPolicyTemplateFactory] // contains filtered or unexported fields }
func NewBackupPolicyTemplateFactory ¶
func NewBackupPolicyTemplateFactory(name string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddBackupPolicy ¶
func (factory *MockBackupPolicyTemplateFactory) AddBackupPolicy(componentDef string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddDatafilePolicy ¶ added in v0.6.0
func (factory *MockBackupPolicyTemplateFactory) AddDatafilePolicy() *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddHookPostCommand ¶
func (factory *MockBackupPolicyTemplateFactory) AddHookPostCommand(postCommand string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddHookPreCommand ¶
func (factory *MockBackupPolicyTemplateFactory) AddHookPreCommand(preCommand string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddIncrementalPolicy ¶
func (factory *MockBackupPolicyTemplateFactory) AddIncrementalPolicy() *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) AddSnapshotPolicy ¶
func (factory *MockBackupPolicyTemplateFactory) AddSnapshotPolicy() *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetBackupToolName ¶
func (factory *MockBackupPolicyTemplateFactory) SetBackupToolName(backupToolName string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetBackupsHistoryLimit ¶
func (factory *MockBackupPolicyTemplateFactory) SetBackupsHistoryLimit(backupsHistoryLimit int32) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetClusterDefRef ¶
func (factory *MockBackupPolicyTemplateFactory) SetClusterDefRef(clusterDefRef string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetHookContainerName ¶
func (factory *MockBackupPolicyTemplateFactory) SetHookContainerName(containerName string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetLabels ¶
func (factory *MockBackupPolicyTemplateFactory) SetLabels(labels map[string]string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetSchedule ¶
func (factory *MockBackupPolicyTemplateFactory) SetSchedule(schedule string, enable bool) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetTTL ¶
func (factory *MockBackupPolicyTemplateFactory) SetTTL(duration string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetTargetAccount ¶
func (factory *MockBackupPolicyTemplateFactory) SetTargetAccount(account string) *MockBackupPolicyTemplateFactory
func (*MockBackupPolicyTemplateFactory) SetTargetRole ¶
func (factory *MockBackupPolicyTemplateFactory) SetTargetRole(role string) *MockBackupPolicyTemplateFactory
type MockBackupRepoFactory ¶ added in v0.6.0
type MockBackupRepoFactory struct { BaseFactory[dataprotectionv1alpha1.BackupRepo, *dataprotectionv1alpha1.BackupRepo, MockBackupRepoFactory] }
func NewBackupRepoFactory ¶ added in v0.6.0
func NewBackupRepoFactory(namespace, name string) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetAsDefaultRepo ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetAsDefaultRepo(v bool) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetConfig ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetConfig(config map[string]string) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetCredential ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetCredential(ref *corev1.SecretReference) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetPVReclaimPolicy ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetPVReclaimPolicy(policy string) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetStorageProviderRef ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetStorageProviderRef(providerName string) *MockBackupRepoFactory
func (*MockBackupRepoFactory) SetVolumeCapacity ¶ added in v0.6.0
func (factory *MockBackupRepoFactory) SetVolumeCapacity(amount string) *MockBackupRepoFactory
type MockClusterDefFactory ¶
type MockClusterDefFactory struct { BaseFactory[appsv1alpha1.ClusterDefinition, *appsv1alpha1.ClusterDefinition, MockClusterDefFactory] }
func NewClusterDefFactory ¶
func NewClusterDefFactory(name string) *MockClusterDefFactory
func NewClusterDefFactoryWithConnCredential ¶
func NewClusterDefFactoryWithConnCredential(name string) *MockClusterDefFactory
func (*MockClusterDefFactory) AddComponentDef ¶
func (factory *MockClusterDefFactory) AddComponentDef(tplType ComponentDefTplType, compDefName string) *MockClusterDefFactory
func (*MockClusterDefFactory) AddComponentRef ¶ added in v0.6.0
func (factory *MockClusterDefFactory) AddComponentRef(ref *appsv1alpha1.ComponentDefRef) *MockClusterDefFactory
func (*MockClusterDefFactory) AddConfigTemplate ¶
func (factory *MockClusterDefFactory) AddConfigTemplate(name, configTemplateRef, configConstraintRef, namespace, volumeName string, asEnvFrom ...string) *MockClusterDefFactory
func (*MockClusterDefFactory) AddContainerEnv ¶
func (factory *MockClusterDefFactory) AddContainerEnv(containerName string, envVar corev1.EnvVar) *MockClusterDefFactory
func (*MockClusterDefFactory) AddContainerVolumeMounts ¶
func (factory *MockClusterDefFactory) AddContainerVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockClusterDefFactory
func (*MockClusterDefFactory) AddHorizontalScalePolicy ¶
func (factory *MockClusterDefFactory) AddHorizontalScalePolicy(policy appsv1alpha1.HorizontalScalePolicy) *MockClusterDefFactory
func (*MockClusterDefFactory) AddInitContainerVolumeMounts ¶
func (factory *MockClusterDefFactory) AddInitContainerVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockClusterDefFactory
func (*MockClusterDefFactory) AddLogConfig ¶
func (factory *MockClusterDefFactory) AddLogConfig(name, filePathPattern string) *MockClusterDefFactory
func (*MockClusterDefFactory) AddNamedServicePort ¶ added in v0.6.0
func (factory *MockClusterDefFactory) AddNamedServicePort(name string, port int32) *MockClusterDefFactory
func (*MockClusterDefFactory) AddReplicationSpec ¶
func (factory *MockClusterDefFactory) AddReplicationSpec(replicationSpec *appsv1alpha1.ReplicationSetSpec) *MockClusterDefFactory
func (*MockClusterDefFactory) AddScriptTemplate ¶
func (factory *MockClusterDefFactory) AddScriptTemplate(name, configTemplateRef, namespace, volumeName string, mode *int32) *MockClusterDefFactory
func (*MockClusterDefFactory) AddServicePort ¶
func (factory *MockClusterDefFactory) AddServicePort(port int32) *MockClusterDefFactory
func (*MockClusterDefFactory) AddSwitchoverSpec ¶ added in v0.6.0
func (factory *MockClusterDefFactory) AddSwitchoverSpec(switchoverSpec *appsv1alpha1.SwitchoverSpec) *MockClusterDefFactory
func (*MockClusterDefFactory) AddSystemAccountSpec ¶
func (factory *MockClusterDefFactory) AddSystemAccountSpec(sysAccounts *appsv1alpha1.SystemAccountSpec) *MockClusterDefFactory
func (*MockClusterDefFactory) SetConnectionCredential ¶
func (factory *MockClusterDefFactory) SetConnectionCredential( connectionCredential map[string]string, svc *appsv1alpha1.ServiceSpec) *MockClusterDefFactory
func (*MockClusterDefFactory) SetServiceSpec ¶
func (factory *MockClusterDefFactory) SetServiceSpec(svc *appsv1alpha1.ServiceSpec) *MockClusterDefFactory
type MockClusterFactory ¶
type MockClusterFactory struct { BaseFactory[appsv1alpha1.Cluster, *appsv1alpha1.Cluster, MockClusterFactory] }
func NewClusterFactory ¶
func NewClusterFactory(namespace, name, cdRef, cvRef string) *MockClusterFactory
func (*MockClusterFactory) AddClusterToleration ¶
func (factory *MockClusterFactory) AddClusterToleration(toleration corev1.Toleration) *MockClusterFactory
func (*MockClusterFactory) AddComponent ¶
func (factory *MockClusterFactory) AddComponent(compName string, compDefName string) *MockClusterFactory
func (*MockClusterFactory) AddComponentToleration ¶
func (factory *MockClusterFactory) AddComponentToleration(toleration corev1.Toleration) *MockClusterFactory
func (*MockClusterFactory) AddRestorePointInTime ¶
func (factory *MockClusterFactory) AddRestorePointInTime(restoreTime metav1.Time, sourceCluster string) *MockClusterFactory
func (*MockClusterFactory) AddService ¶
func (factory *MockClusterFactory) AddService(serviceName string, serviceType corev1.ServiceType) *MockClusterFactory
func (*MockClusterFactory) AddVolumeClaimTemplate ¶
func (factory *MockClusterFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1alpha1.PersistentVolumeClaimSpec) *MockClusterFactory
func (*MockClusterFactory) SetClassDefRef ¶
func (factory *MockClusterFactory) SetClassDefRef(classDefRef *appsv1alpha1.ClassDefRef) *MockClusterFactory
func (*MockClusterFactory) SetClusterAffinity ¶
func (factory *MockClusterFactory) SetClusterAffinity(affinity *appsv1alpha1.Affinity) *MockClusterFactory
func (*MockClusterFactory) SetComponentAffinity ¶
func (factory *MockClusterFactory) SetComponentAffinity(affinity *appsv1alpha1.Affinity) *MockClusterFactory
func (*MockClusterFactory) SetEnabledLogs ¶
func (factory *MockClusterFactory) SetEnabledLogs(logName ...string) *MockClusterFactory
func (*MockClusterFactory) SetIssuer ¶
func (factory *MockClusterFactory) SetIssuer(issuer *appsv1alpha1.Issuer) *MockClusterFactory
func (*MockClusterFactory) SetMonitor ¶
func (factory *MockClusterFactory) SetMonitor(monitor bool) *MockClusterFactory
func (*MockClusterFactory) SetReplicas ¶
func (factory *MockClusterFactory) SetReplicas(replicas int32) *MockClusterFactory
func (*MockClusterFactory) SetResources ¶
func (factory *MockClusterFactory) SetResources(resources corev1.ResourceRequirements) *MockClusterFactory
func (*MockClusterFactory) SetServiceAccountName ¶
func (factory *MockClusterFactory) SetServiceAccountName(serviceAccountName string) *MockClusterFactory
func (*MockClusterFactory) SetSwitchPolicy ¶
func (factory *MockClusterFactory) SetSwitchPolicy(switchPolicy *appsv1alpha1.ClusterSwitchPolicy) *MockClusterFactory
func (*MockClusterFactory) SetTLS ¶
func (factory *MockClusterFactory) SetTLS(tls bool) *MockClusterFactory
type MockClusterVersionFactory ¶
type MockClusterVersionFactory struct { BaseFactory[appsv1alpha1.ClusterVersion, *appsv1alpha1.ClusterVersion, MockClusterVersionFactory] }
func NewClusterVersionFactory ¶
func NewClusterVersionFactory(name, cdRef string) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddComponentVersion ¶
func (factory *MockClusterVersionFactory) AddComponentVersion(compDefName string) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddConfigTemplate ¶
func (factory *MockClusterVersionFactory) AddConfigTemplate(name string, configTemplateRef string, configConstraintRef string, volumeName string) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddContainer ¶
func (factory *MockClusterVersionFactory) AddContainer(container corev1.Container) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddContainerShort ¶
func (factory *MockClusterVersionFactory) AddContainerShort(name string, image string) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddInitContainer ¶
func (factory *MockClusterVersionFactory) AddInitContainer(container corev1.Container) *MockClusterVersionFactory
func (*MockClusterVersionFactory) AddInitContainerShort ¶
func (factory *MockClusterVersionFactory) AddInitContainerShort(name string, image string) *MockClusterVersionFactory
type MockComponentClassDefinitionFactory ¶
type MockComponentClassDefinitionFactory struct { BaseFactory[appsv1alpha1.ComponentClassDefinition, *appsv1alpha1.ComponentClassDefinition, MockComponentClassDefinitionFactory] }
func NewComponentClassDefinitionFactory ¶
func NewComponentClassDefinitionFactory(name, clusterDefinitionRef, componentType string) *MockComponentClassDefinitionFactory
func (*MockComponentClassDefinitionFactory) AddClasses ¶
func (factory *MockComponentClassDefinitionFactory) AddClasses(constraintRef string, classes []appsv1alpha1.ComponentClass) *MockComponentClassDefinitionFactory
type MockComponentResourceConstraintFactory ¶
type MockComponentResourceConstraintFactory struct { BaseFactory[appsv1alpha1.ComponentResourceConstraint, *appsv1alpha1.ComponentResourceConstraint, MockComponentResourceConstraintFactory] }
func NewComponentResourceConstraintFactory ¶
func NewComponentResourceConstraintFactory(name string) *MockComponentResourceConstraintFactory
func (*MockComponentResourceConstraintFactory) AddConstraints ¶
func (factory *MockComponentResourceConstraintFactory) AddConstraints(constraintTplType ResourceConstraintTplType) *MockComponentResourceConstraintFactory
type MockDeploymentFactory ¶
type MockDeploymentFactory struct { BaseFactory[appsv1.Deployment, *appsv1.Deployment, MockDeploymentFactory] }
func NewDeploymentFactory ¶
func NewDeploymentFactory(namespace, name, clusterName, componentName string) *MockDeploymentFactory
func (*MockDeploymentFactory) AddConfigmapVolume ¶
func (factory *MockDeploymentFactory) AddConfigmapVolume(volumeName, configmapName string) *MockDeploymentFactory
func (*MockDeploymentFactory) AddContainer ¶
func (factory *MockDeploymentFactory) AddContainer(container corev1.Container) *MockDeploymentFactory
func (*MockDeploymentFactory) AddVolume ¶
func (factory *MockDeploymentFactory) AddVolume(volume corev1.Volume) *MockDeploymentFactory
func (*MockDeploymentFactory) SetMinReadySeconds ¶
func (factory *MockDeploymentFactory) SetMinReadySeconds(minReadySeconds int32) *MockDeploymentFactory
func (*MockDeploymentFactory) SetReplicas ¶
func (factory *MockDeploymentFactory) SetReplicas(replicas int32) *MockDeploymentFactory
type MockPersistentVolumeClaimFactory ¶
type MockPersistentVolumeClaimFactory struct { BaseFactory[corev1.PersistentVolumeClaim, *corev1.PersistentVolumeClaim, MockPersistentVolumeClaimFactory] }
func NewPersistentVolumeClaimFactory ¶
func NewPersistentVolumeClaimFactory(namespace, name, clusterName, componentName, vctName string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetAnnotations ¶
func (factory *MockPersistentVolumeClaimFactory) SetAnnotations(annotations map[string]string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetStorage ¶
func (factory *MockPersistentVolumeClaimFactory) SetStorage(storageSize string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetStorageClass ¶
func (factory *MockPersistentVolumeClaimFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeClaimFactory
type MockPodFactory ¶
type MockPodFactory struct { BaseFactory[corev1.Pod, *corev1.Pod, MockPodFactory] }
func NewPodFactory ¶
func NewPodFactory(namespace, name string) *MockPodFactory
func (*MockPodFactory) AddContainer ¶
func (factory *MockPodFactory) AddContainer(container corev1.Container) *MockPodFactory
func (*MockPodFactory) AddNodeName ¶
func (factory *MockPodFactory) AddNodeName(nodeName string) *MockPodFactory
func (*MockPodFactory) AddVolume ¶
func (factory *MockPodFactory) AddVolume(volume corev1.Volume) *MockPodFactory
type MockRestoreJobFactory ¶
type MockRestoreJobFactory struct { BaseFactory[dataprotectionv1alpha1.RestoreJob, *dataprotectionv1alpha1.RestoreJob, MockRestoreJobFactory] }
func NewRestoreJobFactory ¶
func NewRestoreJobFactory(namespace, name string) *MockRestoreJobFactory
func (*MockRestoreJobFactory) AddTargetMatchLabels ¶
func (factory *MockRestoreJobFactory) AddTargetMatchLabels(keyAndValues ...string) *MockRestoreJobFactory
func (*MockRestoreJobFactory) AddTargetVolume ¶
func (factory *MockRestoreJobFactory) AddTargetVolume(volume corev1.Volume) *MockRestoreJobFactory
func (*MockRestoreJobFactory) AddTargetVolumeMount ¶
func (factory *MockRestoreJobFactory) AddTargetVolumeMount(volumeMount corev1.VolumeMount) *MockRestoreJobFactory
func (*MockRestoreJobFactory) AddTargetVolumePVC ¶
func (factory *MockRestoreJobFactory) AddTargetVolumePVC(volumeName, pvcName string) *MockRestoreJobFactory
func (*MockRestoreJobFactory) SetBackupJobName ¶
func (factory *MockRestoreJobFactory) SetBackupJobName(backupJobName string) *MockRestoreJobFactory
func (*MockRestoreJobFactory) SetTargetSecretName ¶
func (factory *MockRestoreJobFactory) SetTargetSecretName(name string) *MockRestoreJobFactory
type MockStatefulSetFactory ¶
type MockStatefulSetFactory struct { BaseFactory[appsv1.StatefulSet, *appsv1.StatefulSet, MockStatefulSetFactory] }
func NewStatefulSetFactory ¶
func NewStatefulSetFactory(namespace, name string, clusterName string, componentName string) *MockStatefulSetFactory
func (*MockStatefulSetFactory) AddConfigmapVolume ¶
func (factory *MockStatefulSetFactory) AddConfigmapVolume(volumeName string, configmapName string) *MockStatefulSetFactory
func (*MockStatefulSetFactory) AddContainer ¶
func (factory *MockStatefulSetFactory) AddContainer(container corev1.Container) *MockStatefulSetFactory
func (*MockStatefulSetFactory) AddVolume ¶
func (factory *MockStatefulSetFactory) AddVolume(volume corev1.Volume) *MockStatefulSetFactory
func (*MockStatefulSetFactory) AddVolumeClaimTemplate ¶
func (factory *MockStatefulSetFactory) AddVolumeClaimTemplate(pvc corev1.PersistentVolumeClaim) *MockStatefulSetFactory
func (*MockStatefulSetFactory) SetReplicas ¶
func (factory *MockStatefulSetFactory) SetReplicas(replicas int32) *MockStatefulSetFactory
type ResourceConstraintTplType ¶
type ResourceConstraintTplType string
const ( GeneralResourceConstraint ResourceConstraintTplType = "general" MemoryOptimizedResourceConstraint ResourceConstraintTplType = "memory-optimized" ProductionResourceConstraint ResourceConstraintTplType = "production" )
Source Files ¶
- backup_factory.go
- backuppolicy_factory.go
- backuppolicytemplate_factory.go
- backuprepo_factory.go
- base_factory.go
- cluster_consensus_test_util.go
- cluster_factory.go
- cluster_replication_test_util.go
- cluster_stateless_test_util.go
- cluster_util.go
- clusterdef_factory.go
- clusterversion_factory.go
- common_util.go
- componentclassdefinition_factory.go
- componentresourceconstraint_factory.go
- constant.go
- deployment_factoy.go
- native_object_util.go
- opsrequest_util.go
- pod_factory.go
- pvc_factoy.go
- restorejob_factory.go
- statefulset_factoy.go