Documentation ¶
Index ¶
- Constants
- Variables
- func AppImage(app, tag string) string
- 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, PT, L, PL), ...)
- func ClearResourcesWithRemoveFinalizerOption[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], ...](testCtx *testutil.TestContext, _ func(T, PT, L, PL), removeFinalizer bool, ...)
- func ClusterReconciled(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) bool
- func CompDefName(r string) string
- func CompDefNameWithExactRegex(r string) string
- func CompDefNameWithFuzzyRegex(r string) string
- func ComponentReconciled(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) bool
- func CreateCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]](testCtx *testutil.TestContext, filePath string, pobj PT, actions ...any) PT
- func CreateDefaultMysqlCluster(testCtx *testutil.TestContext, clusterName, compDefName, compName string, ...) *appsv1.Cluster
- 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 CreateStorageClass(testCtx *testutil.TestContext, storageClassName string, ...) *storagev1.StorageClass
- func CreateVolumeSnapshotClass(testCtx *testutil.TestContext)
- 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) appsv1.ComponentPhase
- 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) appsv1.ClusterPhase
- func GetComponentObservedGeneration(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) int64
- func GetComponentPhase(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) appsv1.ComponentPhase
- func GetRandomizedKey(namespace, prefix string) types.NamespacedName
- func InitConsensusMysql(testCtx *testutil.TestContext, clusterName, compDefName, compName string) (*appsv1.ComponentDefinition, *appsv1.Cluster)
- func List[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], ...](testCtx *testutil.TestContext, _ func(T, PT, L, PL), opt ...client.ListOption) func(gomega.Gomega) []T
- func MockInstanceSetComponent(testCtx *testutil.TestContext, clusterName, itsCompName string) *workloads.InstanceSet
- func MockInstanceSetPod(testCtx *testutil.TestContext, its *workloads.InstanceSet, ...) *corev1.Pod
- func MockInstanceSetPods(testCtx *testutil.TestContext, its *workloads.InstanceSet, ...) []*corev1.Pod
- func MockInstanceSetStatus(testCtx testutil.TestContext, cluster *appsv1.Cluster, fullCompName string)
- func MockKBAgentClient(mock func(*kbacli.MockClientMockRecorder))
- func MockKBAgentClient4HScale(testCtx *testutil.TestContext, clusterKey types.NamespacedName, ...)
- func MockKBAgentClient4Workload(testCtx *testutil.TestContext, pods []*corev1.Pod)
- func MockKBAgentClientDefault()
- func MockKBAgentContainer() corev1.Container
- 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 NewPVC(size string) corev1.PersistentVolumeClaimSpec
- func NewPVCSpec(size string) appsv1.PersistentVolumeClaimSpec
- func RandomizedObjName() func(client.Object)
- func ReleaseID(r string) string
- func ResetToIgnoreFinalizers()
- func ServiceVersion(r string) string
- 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]) AddAccessModeLabel(value string) *F
- 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]) AddAppManagedByLabel() *F
- func (factory *BaseFactory[T, PT, F]) AddAppNameLabel(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]) Get() PT
- func (factory *BaseFactory[T, PT, F]) GetObject() PT
- func (factory *BaseFactory[T, PT, F]) Init(namespace, name string, obj PT, f *F)
- func (factory *BaseFactory[T, PT, F]) SetName(name string) *F
- func (factory *BaseFactory[T, PT, F]) SetOwnerReferences(ownerAPIVersion string, ownerKind string, owner client.Object) *F
- func (factory *BaseFactory[T, PT, F]) SetUID(uid types.UID) *F
- func (factory *BaseFactory[T, PT, F]) WithRandomName() *F
- type MockClusterDefFactory
- type MockClusterFactory
- func (factory *MockClusterFactory) AddComponent(compName string, compDefName string) *MockClusterFactory
- func (factory *MockClusterFactory) AddComponentService(serviceName string, serviceType corev1.ServiceType) *MockClusterFactory
- func (factory *MockClusterFactory) AddInstances(compName string, instance appsv1.InstanceTemplate) *MockClusterFactory
- func (factory *MockClusterFactory) AddMultipleTemplateComponent(compName string, compDefName string) *MockClusterFactory
- func (factory *MockClusterFactory) AddService(service appsv1.ClusterService) *MockClusterFactory
- func (factory *MockClusterFactory) AddSharding(shardingName string, shardingDefName, compDefName string) *MockClusterFactory
- func (factory *MockClusterFactory) AddSystemAccount(name string, passwordConfig *appsv1.PasswordConfig, ...) *MockClusterFactory
- func (factory *MockClusterFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1.PersistentVolumeClaimSpec) *MockClusterFactory
- func (factory *MockClusterFactory) SetBackup(backup *appsv1.ClusterBackup) *MockClusterFactory
- func (factory *MockClusterFactory) SetCompDef(compDef string) *MockClusterFactory
- func (factory *MockClusterFactory) SetIssuer(issuer *appsv1.Issuer) *MockClusterFactory
- func (factory *MockClusterFactory) SetReplicas(replicas int32) *MockClusterFactory
- func (factory *MockClusterFactory) SetResources(resources corev1.ResourceRequirements) *MockClusterFactory
- func (factory *MockClusterFactory) SetSchedulingPolicy(schedulingPolicy *appsv1.SchedulingPolicy) *MockClusterFactory
- func (factory *MockClusterFactory) SetServiceAccountName(serviceAccountName string) *MockClusterFactory
- func (factory *MockClusterFactory) SetServiceRefs(serviceRefs []appsv1.ServiceRef) *MockClusterFactory
- func (factory *MockClusterFactory) SetServiceVersion(serviceVersion string) *MockClusterFactory
- func (factory *MockClusterFactory) SetShards(shards int32) *MockClusterFactory
- func (factory *MockClusterFactory) SetStop(stop *bool) *MockClusterFactory
- func (factory *MockClusterFactory) SetTLS(tls bool) *MockClusterFactory
- func (factory *MockClusterFactory) SetTerminationPolicy(policyType appsv1.TerminationPolicyType) *MockClusterFactory
- func (factory *MockClusterFactory) SetTopology(topology string) *MockClusterFactory
- type MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddConfigTemplate(name, configTemplateRef, configConstraintRef, namespace, volumeName string, ...) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddConfigs(configs []kbappsv1.ComponentConfigSpec) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddEnv(containerName string, envVar corev1.EnvVar) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddHostNetworkContainerPort(container string, ports []string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddLogConfig(name, filePathPattern string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddRole(name string, serviceable, writable bool) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddScriptTemplate(name, configTemplateRef, namespace, volumeName string, mode *int32) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddScripts(scripts []kbappsv1.ComponentTemplateSpec) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddService(name, serviceName string, port int32, roleSelector string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddServiceExt(name, serviceName string, serviceSpec corev1.ServiceSpec, roleSelector string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddServiceRef(name, serviceKind, serviceVersion string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddSystemAccount(accountName string, initAccount bool, statement string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddVar(v kbappsv1.EnvVar) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddVolume(name string, snapshot bool, watermark int) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) AddVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetAvailable(available *kbappsv1.ComponentAvailable) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetDefaultSpec() *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetDescription(description string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetLabels(labels map[string]string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetLifecycleAction(name string, val interface{}) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetPodManagementPolicy(policy *appsv1.PodManagementPolicyType) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetPolicyRules(rules []rbacv1.PolicyRule) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetReplicasLimit(minReplicas, maxReplicas int32) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetRuntime(container *corev1.Container) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetServiceKind(serviceKind string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetServiceVersion(serviceVersion string) *MockComponentDefinitionFactory
- func (f *MockComponentDefinitionFactory) SetUpdateStrategy(strategy *kbappsv1.UpdateStrategy) *MockComponentDefinitionFactory
- type MockComponentFactory
- func (factory *MockComponentFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1.PersistentVolumeClaimSpec) *MockComponentFactory
- func (factory *MockComponentFactory) SetReplicas(replicas int32) *MockComponentFactory
- func (factory *MockComponentFactory) SetResources(resources corev1.ResourceRequirements) *MockComponentFactory
- func (factory *MockComponentFactory) SetServiceAccountName(serviceAccountName string) *MockComponentFactory
- func (factory *MockComponentFactory) SetServiceVersion(serviceVersion string) *MockComponentFactory
- func (factory *MockComponentFactory) SetTLSConfig(enable bool, issuer *appsv1.Issuer) *MockComponentFactory
- type MockComponentVersionFactory
- func (f *MockComponentVersionFactory) AddCompatibilityRule(compDefs, releases []string) *MockComponentVersionFactory
- func (f *MockComponentVersionFactory) AddRelease(name, changes, serviceVersion string, images map[string]string) *MockComponentVersionFactory
- func (f *MockComponentVersionFactory) SetDefaultSpec(compDef string) *MockComponentVersionFactory
- func (f *MockComponentVersionFactory) SetSpec(spec appsv1.ComponentVersionSpec) *MockComponentVersionFactory
- type MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) AddConfigmapVolume(volumeName string, configmapName string) *MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) AddContainer(container corev1.Container) *MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) AddVolume(volume corev1.Volume) *MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) AddVolumeClaimTemplate(pvc corev1.PersistentVolumeClaim) *MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) SetReplicas(replicas int32) *MockInstanceSetFactory
- func (factory *MockInstanceSetFactory) SetRoles(roles []workloads.ReplicaRole) *MockInstanceSetFactory
- type MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetAnnotations(annotations map[string]string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetDataSourceRef(apiGroup, kind, name string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetStorage(storageSize string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeClaimFactory
- func (factory *MockPersistentVolumeClaimFactory) SetVolumeName(volName string) *MockPersistentVolumeClaimFactory
- type MockPersistentVolumeFactory
- func (f *MockPersistentVolumeFactory) SetCSIDriver(driverName string) *MockPersistentVolumeFactory
- func (f *MockPersistentVolumeFactory) SetClaimRef(obj client.Object) *MockPersistentVolumeFactory
- func (f *MockPersistentVolumeFactory) SetPersistentVolumeReclaimPolicy(reclaimPolicy corev1.PersistentVolumeReclaimPolicy) *MockPersistentVolumeFactory
- func (f *MockPersistentVolumeFactory) SetStorage(storageSize string) *MockPersistentVolumeFactory
- func (f *MockPersistentVolumeFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeFactory
- type MockPodFactory
- type MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetAuth(auth appsv1.ConnectionCredentialAuth) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetEndpoint(endpoint appsv1.CredentialVar) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetHost(host appsv1.CredentialVar) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetPodFQDNs(podFQDNs appsv1.CredentialVar) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetPort(port appsv1.CredentialVar) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetServiceKind(serviceKind string) *MockServiceDescriptorFactory
- func (factory *MockServiceDescriptorFactory) SetServiceVersion(serviceVersion string) *MockServiceDescriptorFactory
- type MockShardingDefinitionFactory
- func (f *MockShardingDefinitionFactory) AddSystemAccount(account appsv1.ShardingSystemAccount) *MockShardingDefinitionFactory
- func (f *MockShardingDefinitionFactory) SetLifecycleActions(actions *appsv1.ShardingLifecycleActions) *MockShardingDefinitionFactory
- func (f *MockShardingDefinitionFactory) SetProvisionStrategy(strategy appsv1.UpdateStrategy) *MockShardingDefinitionFactory
- func (f *MockShardingDefinitionFactory) SetUpdateStrategy(strategy appsv1.UpdateStrategy) *MockShardingDefinitionFactory
- type MockSidecarDefinitionFactory
Constants ¶
const ( CompDefinitionName = "test-component-definition" CompVersionName = "test-component-version" AppName = "app" AppNameSamePrefix = "app-same-prefix" DefaultActionName = "preTerminate" ReleasePrefix = "v0.0.1" ServiceVersionPrefix = "8.0.30" )
const ( KubeBlocks = "kubeblocks" LogVolumeName = "log" ConfVolumeName = "conf" DataVolumeName = "data" ScriptsVolumeName = "scripts" ServiceDefaultName = "default" ServiceNodePortName = "nodeport" ServiceHeadlessName = "headless" ServiceVPCName = "vpc-lb" ServiceInternetName = "internet-lb" ApeCloudMySQLImage = "docker.io/apecloud/apecloud-mysql-server:latest" DefaultMySQLContainerName = "mysql" NginxImage = "nginx" DefaultConfigSpecName = "config-cm" DefaultConfigSpecTplRef = "env-from-config-tpl" DefaultConfigSpecVolumeName = "volume" DefaultConfigSpecConstraintRef = "env-from-config-test" DefaultScriptSpecName = "script-cm" DefaultScriptSpecTplRef = "env-from-config-tpl" DefaultScriptSpecVolumeName = "script-volume" )
Variables ¶
var ( NewLifecycleAction = func(name string) *appsv1.Action { return &appsv1.Action{ Exec: &appsv1.ExecAction{ Command: []string{"/bin/sh", "-c", fmt.Sprintf("echo %s", name)}, }, } } DefaultCompDefConfigs = []appsv1.ComponentConfigSpec{ { ComponentTemplateSpec: appsv1.ComponentTemplateSpec{ Name: DefaultConfigSpecName, TemplateRef: DefaultConfigSpecTplRef, VolumeName: DefaultConfigSpecVolumeName, }, ConfigConstraintRef: DefaultConfigSpecConstraintRef, }, } DefaultCompDefScripts = []appsv1.ComponentTemplateSpec{ { Name: DefaultScriptSpecName, TemplateRef: DefaultScriptSpecTplRef, VolumeName: DefaultScriptSpecVolumeName, }, } )
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 ¶
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, PT, L, PL), 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, PT, L, PL), removeFinalizer bool, opts ...client.DeleteAllOfOption)
ClearResourcesWithRemoveFinalizerOption clears all resources of the given type T with removeFinalizer specifier, and satisfying the input ListOptions.
func ClusterReconciled ¶
func ClusterReconciled(testCtx *testutil.TestContext, clusterKey types.NamespacedName) func(gomega.Gomega) bool
ClusterReconciled checks if the testing cluster has been reconciled.
func CompDefName ¶ added in v0.9.0
func CompDefNameWithExactRegex ¶ added in v0.9.1
func CompDefNameWithFuzzyRegex ¶ added in v0.9.1
func ComponentReconciled ¶
func ComponentReconciled(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) bool
ComponentReconciled checks if the testing component has been reconciled.
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 CreateStorageClass ¶
func CreateStorageClass(testCtx *testutil.TestContext, storageClassName string, allowVolumeExpansion bool) *storagev1.StorageClass
func CreateVolumeSnapshotClass ¶
func CreateVolumeSnapshotClass(testCtx *testutil.TestContext)
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) appsv1.ComponentPhase
GetClusterComponentPhase gets the component phase of testing cluster for verification.
func GetClusterGeneration ¶
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) appsv1.ClusterPhase
GetClusterPhase gets the testing cluster's phase in status for verification.
func GetComponentObservedGeneration ¶ added in v0.8.0
func GetComponentObservedGeneration(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) int64
GetComponentObservedGeneration gets the testing component's ObservedGeneration in status for verification.
func GetComponentPhase ¶ added in v0.8.0
func GetComponentPhase(testCtx *testutil.TestContext, compKey types.NamespacedName) func(gomega.Gomega) appsv1.ComponentPhase
GetComponentPhase gets the testing component's phase in status for verification.
func GetRandomizedKey ¶
func GetRandomizedKey(namespace, prefix string) types.NamespacedName
func InitConsensusMysql ¶
func InitConsensusMysql(testCtx *testutil.TestContext, clusterName, compDefName, compName string) (*appsv1.ComponentDefinition, *appsv1.Cluster)
func List ¶
func List[T intctrlutil.Object, PT intctrlutil.PObject[T], L intctrlutil.ObjList[T], PL intctrlutil.PObjList[T, L]]( testCtx *testutil.TestContext, _ func(T, PT, L, PL), opt ...client.ListOption) func(gomega.Gomega) []T
func MockInstanceSetComponent ¶ added in v0.9.0
func MockInstanceSetComponent( testCtx *testutil.TestContext, clusterName, itsCompName string) *workloads.InstanceSet
MockInstanceSetComponent mocks the ITS component, just using in envTest
func MockInstanceSetPod ¶ added in v0.9.0
func MockInstanceSetPod( testCtx *testutil.TestContext, its *workloads.InstanceSet, clusterName, consensusCompName, podName, podRole, accessMode string, resources ...corev1.ResourceRequirements) *corev1.Pod
MockInstanceSetPod mocks to create the pod of the InstanceSet, just using in envTest
func MockInstanceSetPods ¶ added in v0.9.0
func MockInstanceSetPods( testCtx *testutil.TestContext, its *workloads.InstanceSet, cluster *appsv1.Cluster, compName string) []*corev1.Pod
MockInstanceSetPods mocks the InstanceSet pods, just using in envTest
func MockInstanceSetStatus ¶ added in v0.9.0
func MockInstanceSetStatus(testCtx testutil.TestContext, cluster *appsv1.Cluster, fullCompName string)
func MockKBAgentClient ¶
func MockKBAgentClient(mock func(*kbacli.MockClientMockRecorder))
func MockKBAgentClient4HScale ¶
func MockKBAgentClient4HScale(testCtx *testutil.TestContext, clusterKey types.NamespacedName, compName, podAnnotationKey4Test string, replicas int)
func MockKBAgentClient4Workload ¶
func MockKBAgentClient4Workload(testCtx *testutil.TestContext, pods []*corev1.Pod)
func MockKBAgentClientDefault ¶
func MockKBAgentClientDefault()
func MockKBAgentContainer ¶
func NewCustomizedObj ¶
func NewCustomizedObj[T intctrlutil.Object, PT intctrlutil.PObject[T]]( filePath string, pobj PT, actions ...any) PT
func NewPVC ¶
func NewPVC(size string) corev1.PersistentVolumeClaimSpec
func NewPVCSpec ¶
func NewPVCSpec(size string) appsv1.PersistentVolumeClaimSpec
NewPVCSpec creates appsv1alpha1.PersistentVolumeClaimSpec.
func RandomizedObjName ¶
func ResetToIgnoreFinalizers ¶
func ResetToIgnoreFinalizers()
func ServiceVersion ¶ added in v0.9.0
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]) AddAccessModeLabel ¶ added in v0.9.0
func (factory *BaseFactory[T, PT, F]) AddAccessModeLabel(value string) *F
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]) AddAppManagedByLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppManagedByLabel() *F
func (*BaseFactory[T, PT, F]) AddAppNameLabel ¶
func (factory *BaseFactory[T, PT, F]) AddAppNameLabel(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 ¶
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]) Get ¶
func (factory *BaseFactory[T, PT, F]) Get() PT
func (*BaseFactory[T, PT, F]) GetObject ¶
func (factory *BaseFactory[T, PT, F]) GetObject() PT
func (*BaseFactory[T, PT, F]) Init ¶
func (factory *BaseFactory[T, PT, F]) Init(namespace, name string, obj PT, f *F)
func (*BaseFactory[T, PT, F]) SetName ¶ added in v0.8.0
func (factory *BaseFactory[T, PT, F]) SetName(name string) *F
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]) SetUID ¶ added in v0.7.1
func (factory *BaseFactory[T, PT, F]) SetUID(uid types.UID) *F
func (*BaseFactory[T, PT, F]) WithRandomName ¶
func (factory *BaseFactory[T, PT, F]) WithRandomName() *F
type MockClusterDefFactory ¶
type MockClusterDefFactory struct { BaseFactory[appsv1.ClusterDefinition, *appsv1.ClusterDefinition, MockClusterDefFactory] }
func NewClusterDefFactory ¶
func NewClusterDefFactory(name string) *MockClusterDefFactory
func (*MockClusterDefFactory) AddClusterTopology ¶ added in v0.9.0
func (factory *MockClusterDefFactory) AddClusterTopology(topology appsv1.ClusterTopology) *MockClusterDefFactory
type MockClusterFactory ¶
type MockClusterFactory struct { BaseFactory[appsv1.Cluster, *appsv1.Cluster, MockClusterFactory] }
func NewClusterFactory ¶
func NewClusterFactory(namespace, name, clusterDef string) *MockClusterFactory
func (*MockClusterFactory) AddComponent ¶
func (factory *MockClusterFactory) AddComponent(compName string, compDefName string) *MockClusterFactory
func (*MockClusterFactory) AddComponentService ¶ added in v0.8.0
func (factory *MockClusterFactory) AddComponentService(serviceName string, serviceType corev1.ServiceType) *MockClusterFactory
func (*MockClusterFactory) AddInstances ¶
func (factory *MockClusterFactory) AddInstances(compName string, instance appsv1.InstanceTemplate) *MockClusterFactory
func (*MockClusterFactory) AddMultipleTemplateComponent ¶ added in v0.9.0
func (factory *MockClusterFactory) AddMultipleTemplateComponent(compName string, compDefName string) *MockClusterFactory
func (*MockClusterFactory) AddService ¶
func (factory *MockClusterFactory) AddService(service appsv1.ClusterService) *MockClusterFactory
func (*MockClusterFactory) AddSharding ¶
func (factory *MockClusterFactory) AddSharding(shardingName string, shardingDefName, compDefName string) *MockClusterFactory
func (*MockClusterFactory) AddSystemAccount ¶ added in v0.9.0
func (factory *MockClusterFactory) AddSystemAccount(name string, passwordConfig *appsv1.PasswordConfig, secretRef *appsv1.ProvisionSecretRef) *MockClusterFactory
func (*MockClusterFactory) AddVolumeClaimTemplate ¶
func (factory *MockClusterFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1.PersistentVolumeClaimSpec) *MockClusterFactory
func (*MockClusterFactory) SetBackup ¶
func (factory *MockClusterFactory) SetBackup(backup *appsv1.ClusterBackup) *MockClusterFactory
func (*MockClusterFactory) SetCompDef ¶ added in v0.8.0
func (factory *MockClusterFactory) SetCompDef(compDef string) *MockClusterFactory
func (*MockClusterFactory) SetIssuer ¶
func (factory *MockClusterFactory) SetIssuer(issuer *appsv1.Issuer) *MockClusterFactory
func (*MockClusterFactory) SetReplicas ¶
func (factory *MockClusterFactory) SetReplicas(replicas int32) *MockClusterFactory
func (*MockClusterFactory) SetResources ¶
func (factory *MockClusterFactory) SetResources(resources corev1.ResourceRequirements) *MockClusterFactory
func (*MockClusterFactory) SetSchedulingPolicy ¶ added in v0.9.2
func (factory *MockClusterFactory) SetSchedulingPolicy(schedulingPolicy *appsv1.SchedulingPolicy) *MockClusterFactory
func (*MockClusterFactory) SetServiceAccountName ¶
func (factory *MockClusterFactory) SetServiceAccountName(serviceAccountName string) *MockClusterFactory
func (*MockClusterFactory) SetServiceRefs ¶
func (factory *MockClusterFactory) SetServiceRefs(serviceRefs []appsv1.ServiceRef) *MockClusterFactory
func (*MockClusterFactory) SetServiceVersion ¶ added in v0.9.0
func (factory *MockClusterFactory) SetServiceVersion(serviceVersion string) *MockClusterFactory
func (*MockClusterFactory) SetShards ¶ added in v0.8.2
func (factory *MockClusterFactory) SetShards(shards int32) *MockClusterFactory
func (*MockClusterFactory) SetStop ¶ added in v0.9.1
func (factory *MockClusterFactory) SetStop(stop *bool) *MockClusterFactory
func (*MockClusterFactory) SetTLS ¶
func (factory *MockClusterFactory) SetTLS(tls bool) *MockClusterFactory
func (*MockClusterFactory) SetTerminationPolicy ¶ added in v0.8.0
func (factory *MockClusterFactory) SetTerminationPolicy(policyType appsv1.TerminationPolicyType) *MockClusterFactory
func (*MockClusterFactory) SetTopology ¶ added in v0.9.0
func (factory *MockClusterFactory) SetTopology(topology string) *MockClusterFactory
type MockComponentDefinitionFactory ¶ added in v0.8.0
type MockComponentDefinitionFactory struct { BaseFactory[kbappsv1.ComponentDefinition, *kbappsv1.ComponentDefinition, MockComponentDefinitionFactory] }
func NewComponentDefinitionFactory ¶ added in v0.8.0
func NewComponentDefinitionFactory(name string) *MockComponentDefinitionFactory
func NewComponentDefinitionFactoryExt ¶ added in v0.8.0
func NewComponentDefinitionFactoryExt(name, provider, description, serviceKind, serviceVersion string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddConfigTemplate ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddConfigTemplate(name, configTemplateRef, configConstraintRef, namespace, volumeName string, injectEnvTo ...string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddConfigs ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddConfigs(configs []kbappsv1.ComponentConfigSpec) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddEnv ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddEnv(containerName string, envVar corev1.EnvVar) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddHostNetworkContainerPort ¶ added in v0.9.0
func (f *MockComponentDefinitionFactory) AddHostNetworkContainerPort(container string, ports []string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddLogConfig ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddLogConfig(name, filePathPattern string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddRole ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddRole(name string, serviceable, writable bool) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddScriptTemplate ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddScriptTemplate(name, configTemplateRef, namespace, volumeName string, mode *int32) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddScripts ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddScripts(scripts []kbappsv1.ComponentTemplateSpec) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddService ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddService(name, serviceName string, port int32, roleSelector string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddServiceExt ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddServiceExt(name, serviceName string, serviceSpec corev1.ServiceSpec, roleSelector string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddServiceRef ¶ added in v0.9.0
func (f *MockComponentDefinitionFactory) AddServiceRef(name, serviceKind, serviceVersion string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddSystemAccount ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddSystemAccount(accountName string, initAccount bool, statement string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddVar ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddVar(v kbappsv1.EnvVar) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddVolume ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddVolume(name string, snapshot bool, watermark int) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) AddVolumeMounts ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) AddVolumeMounts(containerName string, volumeMounts []corev1.VolumeMount) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetAvailable ¶
func (f *MockComponentDefinitionFactory) SetAvailable(available *kbappsv1.ComponentAvailable) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetDefaultSpec ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetDefaultSpec() *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetDescription ¶ added in v0.9.1
func (f *MockComponentDefinitionFactory) SetDescription(description string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetLabels ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetLabels(labels map[string]string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetLifecycleAction ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetLifecycleAction(name string, val interface{}) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetPodManagementPolicy ¶ added in v0.9.1
func (f *MockComponentDefinitionFactory) SetPodManagementPolicy(policy *appsv1.PodManagementPolicyType) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetPolicyRules ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetPolicyRules(rules []rbacv1.PolicyRule) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetReplicasLimit ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetReplicasLimit(minReplicas, maxReplicas int32) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetRuntime ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetRuntime(container *corev1.Container) *MockComponentDefinitionFactory
SetRuntime adds a new container to runtime, or updates it to @container if it's already existed. If @container is nil, the default MySQL container (defaultMySQLContainer) will be used.
func (*MockComponentDefinitionFactory) SetServiceKind ¶
func (f *MockComponentDefinitionFactory) SetServiceKind(serviceKind string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetServiceVersion ¶ added in v0.9.0
func (f *MockComponentDefinitionFactory) SetServiceVersion(serviceVersion string) *MockComponentDefinitionFactory
func (*MockComponentDefinitionFactory) SetUpdateStrategy ¶ added in v0.8.0
func (f *MockComponentDefinitionFactory) SetUpdateStrategy(strategy *kbappsv1.UpdateStrategy) *MockComponentDefinitionFactory
type MockComponentFactory ¶ added in v0.8.0
type MockComponentFactory struct { BaseFactory[appsv1.Component, *appsv1.Component, MockComponentFactory] }
func NewComponentFactory ¶ added in v0.8.0
func NewComponentFactory(namespace, name, componentDefinition string) *MockComponentFactory
func (*MockComponentFactory) AddVolumeClaimTemplate ¶ added in v0.8.0
func (factory *MockComponentFactory) AddVolumeClaimTemplate(volumeName string, pvcSpec appsv1.PersistentVolumeClaimSpec) *MockComponentFactory
func (*MockComponentFactory) SetReplicas ¶ added in v0.8.0
func (factory *MockComponentFactory) SetReplicas(replicas int32) *MockComponentFactory
func (*MockComponentFactory) SetResources ¶ added in v0.8.0
func (factory *MockComponentFactory) SetResources(resources corev1.ResourceRequirements) *MockComponentFactory
func (*MockComponentFactory) SetServiceAccountName ¶ added in v0.8.0
func (factory *MockComponentFactory) SetServiceAccountName(serviceAccountName string) *MockComponentFactory
func (*MockComponentFactory) SetServiceVersion ¶ added in v0.9.0
func (factory *MockComponentFactory) SetServiceVersion(serviceVersion string) *MockComponentFactory
func (*MockComponentFactory) SetTLSConfig ¶ added in v0.8.0
func (factory *MockComponentFactory) SetTLSConfig(enable bool, issuer *appsv1.Issuer) *MockComponentFactory
type MockComponentVersionFactory ¶ added in v0.9.0
type MockComponentVersionFactory struct { BaseFactory[appsv1.ComponentVersion, *appsv1.ComponentVersion, MockComponentVersionFactory] }
func NewComponentVersionFactory ¶ added in v0.9.0
func NewComponentVersionFactory(name string) *MockComponentVersionFactory
func (*MockComponentVersionFactory) AddCompatibilityRule ¶ added in v0.9.0
func (f *MockComponentVersionFactory) AddCompatibilityRule(compDefs, releases []string) *MockComponentVersionFactory
func (*MockComponentVersionFactory) AddRelease ¶ added in v0.9.0
func (f *MockComponentVersionFactory) AddRelease(name, changes, serviceVersion string, images map[string]string) *MockComponentVersionFactory
func (*MockComponentVersionFactory) SetDefaultSpec ¶ added in v0.9.0
func (f *MockComponentVersionFactory) SetDefaultSpec(compDef string) *MockComponentVersionFactory
func (*MockComponentVersionFactory) SetSpec ¶ added in v0.9.0
func (f *MockComponentVersionFactory) SetSpec(spec appsv1.ComponentVersionSpec) *MockComponentVersionFactory
type MockInstanceSetFactory ¶ added in v0.9.0
type MockInstanceSetFactory struct { BaseFactory[workloads.InstanceSet, *workloads.InstanceSet, MockInstanceSetFactory] }
func NewInstanceSetFactory ¶ added in v0.9.0
func NewInstanceSetFactory(namespace, name string, clusterName string, componentName string) *MockInstanceSetFactory
func (*MockInstanceSetFactory) AddConfigmapVolume ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) AddConfigmapVolume(volumeName string, configmapName string) *MockInstanceSetFactory
func (*MockInstanceSetFactory) AddContainer ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) AddContainer(container corev1.Container) *MockInstanceSetFactory
func (*MockInstanceSetFactory) AddVolume ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) AddVolume(volume corev1.Volume) *MockInstanceSetFactory
func (*MockInstanceSetFactory) AddVolumeClaimTemplate ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) AddVolumeClaimTemplate(pvc corev1.PersistentVolumeClaim) *MockInstanceSetFactory
func (*MockInstanceSetFactory) SetReplicas ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) SetReplicas(replicas int32) *MockInstanceSetFactory
func (*MockInstanceSetFactory) SetRoles ¶ added in v0.9.0
func (factory *MockInstanceSetFactory) SetRoles(roles []workloads.ReplicaRole) *MockInstanceSetFactory
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) SetDataSourceRef ¶
func (factory *MockPersistentVolumeClaimFactory) SetDataSourceRef(apiGroup, kind, name string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetStorage ¶
func (factory *MockPersistentVolumeClaimFactory) SetStorage(storageSize string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetStorageClass ¶
func (factory *MockPersistentVolumeClaimFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeClaimFactory
func (*MockPersistentVolumeClaimFactory) SetVolumeName ¶
func (factory *MockPersistentVolumeClaimFactory) SetVolumeName(volName string) *MockPersistentVolumeClaimFactory
type MockPersistentVolumeFactory ¶
type MockPersistentVolumeFactory struct { BaseFactory[corev1.PersistentVolume, *corev1.PersistentVolume, MockPersistentVolumeFactory] }
func NewPersistentVolumeFactory ¶
func NewPersistentVolumeFactory(namespace, name, pvcName string) *MockPersistentVolumeFactory
func (*MockPersistentVolumeFactory) SetCSIDriver ¶
func (f *MockPersistentVolumeFactory) SetCSIDriver(driverName string) *MockPersistentVolumeFactory
func (*MockPersistentVolumeFactory) SetClaimRef ¶
func (f *MockPersistentVolumeFactory) SetClaimRef(obj client.Object) *MockPersistentVolumeFactory
func (*MockPersistentVolumeFactory) SetPersistentVolumeReclaimPolicy ¶
func (f *MockPersistentVolumeFactory) SetPersistentVolumeReclaimPolicy(reclaimPolicy corev1.PersistentVolumeReclaimPolicy) *MockPersistentVolumeFactory
func (*MockPersistentVolumeFactory) SetStorage ¶
func (f *MockPersistentVolumeFactory) SetStorage(storageSize string) *MockPersistentVolumeFactory
func (*MockPersistentVolumeFactory) SetStorageClass ¶
func (f *MockPersistentVolumeFactory) SetStorageClass(storageClassName string) *MockPersistentVolumeFactory
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 MockServiceDescriptorFactory ¶
type MockServiceDescriptorFactory struct { BaseFactory[appsv1.ServiceDescriptor, *appsv1.ServiceDescriptor, MockServiceDescriptorFactory] }
func NewServiceDescriptorFactory ¶
func NewServiceDescriptorFactory(namespace, name string) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetAuth ¶
func (factory *MockServiceDescriptorFactory) SetAuth(auth appsv1.ConnectionCredentialAuth) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetEndpoint ¶
func (factory *MockServiceDescriptorFactory) SetEndpoint(endpoint appsv1.CredentialVar) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetHost ¶ added in v0.9.0
func (factory *MockServiceDescriptorFactory) SetHost(host appsv1.CredentialVar) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetPodFQDNs ¶
func (factory *MockServiceDescriptorFactory) SetPodFQDNs(podFQDNs appsv1.CredentialVar) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetPort ¶
func (factory *MockServiceDescriptorFactory) SetPort(port appsv1.CredentialVar) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetServiceKind ¶
func (factory *MockServiceDescriptorFactory) SetServiceKind(serviceKind string) *MockServiceDescriptorFactory
func (*MockServiceDescriptorFactory) SetServiceVersion ¶
func (factory *MockServiceDescriptorFactory) SetServiceVersion(serviceVersion string) *MockServiceDescriptorFactory
type MockShardingDefinitionFactory ¶
type MockShardingDefinitionFactory struct { BaseFactory[appsv1.ShardingDefinition, *appsv1.ShardingDefinition, MockShardingDefinitionFactory] }
func NewShardingDefinitionFactory ¶
func NewShardingDefinitionFactory(name, compDef string) *MockShardingDefinitionFactory
func (*MockShardingDefinitionFactory) AddSystemAccount ¶
func (f *MockShardingDefinitionFactory) AddSystemAccount(account appsv1.ShardingSystemAccount) *MockShardingDefinitionFactory
func (*MockShardingDefinitionFactory) SetLifecycleActions ¶
func (f *MockShardingDefinitionFactory) SetLifecycleActions(actions *appsv1.ShardingLifecycleActions) *MockShardingDefinitionFactory
func (*MockShardingDefinitionFactory) SetProvisionStrategy ¶
func (f *MockShardingDefinitionFactory) SetProvisionStrategy(strategy appsv1.UpdateStrategy) *MockShardingDefinitionFactory
func (*MockShardingDefinitionFactory) SetUpdateStrategy ¶
func (f *MockShardingDefinitionFactory) SetUpdateStrategy(strategy appsv1.UpdateStrategy) *MockShardingDefinitionFactory
type MockSidecarDefinitionFactory ¶
type MockSidecarDefinitionFactory struct { BaseFactory[appsv1.SidecarDefinition, *appsv1.SidecarDefinition, MockSidecarDefinitionFactory] }
func NewSidecarDefinitionFactory ¶
func NewSidecarDefinitionFactory(name, owner string, selectors []string) *MockSidecarDefinitionFactory
func (*MockSidecarDefinitionFactory) AddContainer ¶
func (f *MockSidecarDefinitionFactory) AddContainer(c *corev1.Container) *MockSidecarDefinitionFactory
Source Files ¶
- base_factory.go
- cluster_factory.go
- cluster_instance_set_test_util.go
- cluster_util.go
- clusterdef_factory.go
- common_util.go
- component_factory.go
- component_util.go
- component_version_util.go
- componentdefinition_factory.go
- componentversion_factory.go
- constant.go
- instance_set_factoy.go
- kb_agent_util.go
- native_object_util.go
- pod_factory.go
- pv_factoy.go
- pvc_factoy.go
- servicedescriptor_factory.go
- shardingdefinition_factory.go
- sidecardefinition_factory.go