Documentation
¶
Index ¶
- Constants
- Variables
- func BeNotFoundError() gomegatypes.GomegaMatcher
- func CheckDruidError(g *WithT, expectedError *druiderr.DruidError, actualError error)
- func CheckDruidErrorList(g *WithT, actual, expected []error)
- func CheckEtcdOwnerReference(refs []metav1.OwnerReference, etcdOwnerUID types.UID) bool
- func CheckEtcdPodLabels(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd, ...) error
- func CheckLastErrors(g *WithT, lastErrors []druidapicommon.LastError, ...)
- func CheckLastOperation(g *WithT, actualOp *druidapicommon.LastOperation, ...)
- func CmdIterator(element any) string
- func ContainerIterator(element any) string
- func CreateBackupSecret(ctx context.Context, c client.Client, name, namespace string, ...) error
- func CreateDefaultFakeClient() client.Client
- func CreateEtcdCopyBackupsJob(taskName, namespace string) *batchv1.Job
- func CreateEtcdCopyBackupsTask(name, namespace string, provider druidv1alpha1.StorageProvider, ...) *druidv1alpha1.EtcdCopyBackupsTask
- func CreateEvent(name, namespace, reason, message, eventType string, ...) *corev1.Event
- func CreateImageVector(withEtcdWrapperImage, withBackupRestoreImage bool) imagevector.ImageVector
- func CreateLease(name, namespace, etcdName string, etcdUID types.UID, componentName string) *coordinationv1.Lease
- func CreatePVC(sts *appsv1.StatefulSet, podName string, ...) *corev1.PersistentVolumeClaim
- func CreateSecrets(ctx context.Context, c client.Client, namespace string, secrets ...string) error
- func CreateStatefulSet(name, namespace string, etcdUID types.UID, replicas int32) *appsv1.StatefulSet
- func CreateTestFakeClientForAllObjectsInNamespace(deleteAllErr, listErr *apierrors.StatusError, namespace string, ...) client.Client
- func CreateTestFakeClientForObjects(getErr, createErr, patchErr, deleteErr *apierrors.StatusError, ...) client.Client
- func CreateTestFakeClientForObjectsInNamespaceWithGVK(errors []ErrorsForGVK, namespace string, existingObjects ...client.Object) client.Client
- func CreateTestFakeClientWithSchemeForObjects(scheme *runtime.Scheme, ...) client.Client
- func EnvIterator(element any) string
- func GenerateBackupSecretData(provider druidv1alpha1.StorageProvider) (map[string][]byte, error)
- func GenerateCACert(name string) ([]byte, error)
- func GenerateCAKeyCertToDirectory(logger logr.Logger, outputDir, name string) (err error)
- func GeneratePKIResourcesToDirectory(logger logr.Logger, tlsDir, name, namespace string) error
- func GenerateRandomAlphanumericString(g *WithT, length int) string
- func GenerateTestNamespaceName(t *testing.T, prefix string, suffixLength int) string
- func GenerateTestNamespaceNameWithTestCaseName(t *testing.T, prefix, tcName string, suffixLength int) string
- func GetBackupRestoreTLSConfig() *druidv1alpha1.TLSConfig
- func GetClientTLSConfig() *druidv1alpha1.TLSConfig
- func GetEnvOrDefault(key, defaultValue string) string
- func GetEnvOrError(key string) (string, error)
- func GetPeerTLSConfig() *druidv1alpha1.TLSConfig
- func IsEtcdRemoved(c client.Client, name, namespace string, timeout time.Duration) error
- func IsLeaseRemoved(c client.Client, name, namespace string, timeout time.Duration) error
- func MatchEtcdOwnerReference(etcdName string, etcdUID types.UID) gomegatypes.GomegaMatcher
- func MatchFinalizer(finalizer string) gomegatypes.GomegaMatcher
- func MatchResourceAnnotations(expected map[string]string) gomegatypes.GomegaMatcher
- func MatchResourceLabels(expected map[string]string) gomegatypes.GomegaMatcher
- func MatchSpecLabelSelector(expected map[string]string) gomegatypes.GomegaMatcher
- func MergeMaps[K comparable, V any](sourceMaps ...map[K]V) map[K]V
- func OwnerRefIterator(element any) string
- func ParseQuantity(q string) resource.Quantity
- func VerifyPeerTLSEnabledOnAllMemberLeases(ctx context.Context, c client.Client, etcd *druidv1alpha1.Etcd) error
- func VolumeIterator(element any) string
- func VolumeMountIterator(element any) string
- type ClientMethod
- type ErrorsForGVK
- type EtcdBuilder
- func (eb *EtcdBuilder) Build() *druidv1alpha1.Etcd
- func (eb *EtcdBuilder) WithAnnotations(annotations map[string]string) *EtcdBuilder
- func (eb *EtcdBuilder) WithBackupPort(port *int32) *EtcdBuilder
- func (eb *EtcdBuilder) WithBackupRestoreContainerImage(image string) *EtcdBuilder
- func (eb *EtcdBuilder) WithBackupRestoreTLS() *EtcdBuilder
- func (eb *EtcdBuilder) WithClientTLS() *EtcdBuilder
- func (eb *EtcdBuilder) WithComponentProtectionDisabled() *EtcdBuilder
- func (eb *EtcdBuilder) WithConditionAllMembersUpdated(updated bool) *EtcdBuilder
- func (eb *EtcdBuilder) WithDefaultBackup() *EtcdBuilder
- func (eb *EtcdBuilder) WithDefragmentation(schedule string, timeout time.Duration) *EtcdBuilder
- func (eb *EtcdBuilder) WithDeltaSnapshotPeriod(deltaSnapshotPeriod time.Duration) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdClientPort(clientPort *int32) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdClientServiceAnnotations(annotations map[string]string) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdClientServiceLabels(labels map[string]string) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdClientServiceTrafficDistribution(trafficDistribution *string) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdContainerImage(image string) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdServerPort(serverPort *int32) *EtcdBuilder
- func (eb *EtcdBuilder) WithEtcdWrapperPort(wrapperPort *int32) *EtcdBuilder
- func (eb *EtcdBuilder) WithGRPCGatewayEnabled() *EtcdBuilder
- func (eb *EtcdBuilder) WithGarbageCollection(period time.Duration, policy druidv1alpha1.GarbageCollectionPolicy, ...) *EtcdBuilder
- func (eb *EtcdBuilder) WithLabels(labels map[string]string) *EtcdBuilder
- func (eb *EtcdBuilder) WithLastOperation(operation *druidapicommon.LastOperation) *EtcdBuilder
- func (eb *EtcdBuilder) WithPeerTLS() *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderABS(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderGCS(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderLocal(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderOSS(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderS3(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithProviderSwift(prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithReadyStatus() *EtcdBuilder
- func (eb *EtcdBuilder) WithReplicas(replicas int32) *EtcdBuilder
- func (eb *EtcdBuilder) WithRunAsRoot(runAsRoot *bool) *EtcdBuilder
- func (eb *EtcdBuilder) WithSpecLabels(labels map[string]string) *EtcdBuilder
- func (eb *EtcdBuilder) WithStatusConditions(conditions []druidv1alpha1.Condition) *EtcdBuilder
- func (eb *EtcdBuilder) WithStorageProvider(provider druidv1alpha1.StorageProvider, prefix string) *EtcdBuilder
- func (eb *EtcdBuilder) WithoutBackupSecretRef() *EtcdBuilder
- func (eb *EtcdBuilder) WithoutProvider() *EtcdBuilder
- type EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) Build() *druidv1alpha1.EtcdOpsTask
- func (eb *EtcdOpsTaskBuilder) WithEtcdName(etcdName string) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithLastOperation(lastOp *druidapicommon.LastOperation) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithLastTransitionTime(time metav1.Time) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithOnDemandSnapshotConfig(config *druidv1alpha1.OnDemandSnapshotConfig) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithStartedAt(time metav1.Time) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithState(state druidv1alpha1.TaskState) *EtcdOpsTaskBuilder
- func (eb *EtcdOpsTaskBuilder) WithTTLSecondsAfterFinished(ttl int32) *EtcdOpsTaskBuilder
- type FakeEtcdOpsTaskHandler
- func (f *FakeEtcdOpsTaskHandler) Admit(ctx context.Context) handler.Result
- func (f *FakeEtcdOpsTaskHandler) Cleanup(ctx context.Context) handler.Result
- func (f *FakeEtcdOpsTaskHandler) Execute(ctx context.Context) handler.Result
- func (f *FakeEtcdOpsTaskHandler) WithAdmit(r handler.Result) *FakeEtcdOpsTaskHandler
- func (f *FakeEtcdOpsTaskHandler) WithCleanup(r handler.Result) *FakeEtcdOpsTaskHandler
- func (f *FakeEtcdOpsTaskHandler) WithExecute(r handler.Result) *FakeEtcdOpsTaskHandler
- type FakeManager
- func (f FakeManager) GetAPIReader() client.Reader
- func (f FakeManager) GetCache() cache.Cache
- func (f FakeManager) GetClient() client.Client
- func (f FakeManager) GetEventRecorderFor(_ string) record.EventRecorder
- func (f FakeManager) GetLogger() logr.Logger
- func (f FakeManager) GetScheme() *runtime.Scheme
- type FakeResponse
- type MockRoundTripper
- type TestClientBuilder
- func (b *TestClientBuilder) Build() client.Client
- func (b *TestClientBuilder) RecordErrorForObjects(method ClientMethod, err *apierrors.StatusError, ...) *TestClientBuilder
- func (b *TestClientBuilder) RecordErrorForObjectsMatchingLabels(method ClientMethod, namespace string, matchingLabels map[string]string, ...) *TestClientBuilder
- func (b *TestClientBuilder) RecordErrorForObjectsWithGVK(method ClientMethod, namespace string, gvk schema.GroupVersionKind, ...) *TestClientBuilder
- func (b *TestClientBuilder) WithClient(cl client.Client) *TestClientBuilder
- func (b *TestClientBuilder) WithObjects(objects ...client.Object) *TestClientBuilder
- func (b *TestClientBuilder) WithScheme(scheme *runtime.Scheme) *TestClientBuilder
- func (b *TestClientBuilder) WithStatusSubresource(obj client.Object) *TestClientBuilder
Constants ¶
const ( TestEtcdName = "etcd-test" // TestNamespace is a test namespace to be used in tests. TestNamespace = "test-ns" )
const ( // TestImageRepo is a constant for image repository name TestImageRepo = "test-repo" // ETCDWrapperImageTag is the ImageSource tag for etcd-wrapper image. ETCDWrapperImageTag = "etcd-wrapper-test-tag" // ETCDWrapperNextImageTag is the ImageSource tag for the next etcd-wrapper image (etcd 3.5). ETCDWrapperNextImageTag = "etcd-wrapper-next-test-tag" // ETCDBRImageTag is the ImageSource tag for etcd-backup-restore image. ETCDBRImageTag = "backup-restore-test-tag" // ETCDBRNextImageTag is the ImageSource tag for the next etcd-backup-restore image (etcd 3.5). ETCDBRNextImageTag = "backup-restore-next-test-tag" // InitContainerTag is the ImageSource tag for the init container image. InitContainerTag = "init-container-test-tag" )
Image vector constants
const ( // ClientTLSCASecretName is the name of the kubernetes Secret containing the client CA. ClientTLSCASecretName = "client-url-ca-etcd" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // ClientTLSServerCertSecretName is the name of the kubernetes Secret containing the client's server certificate. ClientTLSServerCertSecretName = "client-url-etcd-server-tls" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // ClientTLSClientCertSecretName is the name of the kubernetes Secret containing the client's client certificate. ClientTLSClientCertSecretName = "client-url-etcd-client-tls" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // PeerTLSCASecretName is the name of the kubernetes Secret containing the peer CA. PeerTLSCASecretName = "peer-url-ca-etcd" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // PeerTLSServerCertSecretName is the name of the kubernetes Secret containing the peer's server certificate. PeerTLSServerCertSecretName = "peer-url-etcd-server-tls" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // BackupRestoreTLSCASecretName is the name of the kubernetes Secret containing the etcd-backup-restore CA. BackupRestoreTLSCASecretName = "ca-etcdbr" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // BackupRestoreTLSServerCertSecretName is the name of the kubernetes Secret containing the etcd-backup-restore server certificate. BackupRestoreTLSServerCertSecretName = "etcdbr-server-tls" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // BackupRestoreTLSClientCertSecretName is the name of the kubernetes Secret containing the etcd-backup-restore client certificate. BackupRestoreTLSClientCertSecretName = "etcdbr-client-tls" // #nosec G101 - this is not a credential itself but the name of the kubernetes secret resource. // BackupStoreSecretName is the name of the kubernetes Secret containing the backup store credentials. BackupStoreSecretName = "etcd-backup" )
Secret names
const ( CAKeyFileName = "ca.key" CACertFileName = "ca.crt" ServerKeyFileName = "server.key" ServerCertFileName = "server.crt" ClientKeyFileName = "client.key" ClientCertFileName = "client.crt" )
const (
// TestConfigMapCheckSum is a test check-sum for the configmap which is stored as a value against checksum/etcd-configmap annotation put on the etcd sts pods.
TestConfigMapCheckSum = "08ee0a880e10172e337ac57fb20411980a987405a0eaf9a05b8err69ca0f0d69"
)
Variables ¶
var ( // TestInternalErr is a generic test internal server error used to construct TestAPIInternalErr. TestInternalErr = errors.New("fake get internal error") // TestAPIInternalErr is an API internal server error meant to be used to mimic HTTP response code 500 for tests. TestAPIInternalErr = apierrors.NewInternalError(TestInternalErr) )
Functions ¶
func BeNotFoundError ¶ added in v0.28.0
func BeNotFoundError() gomegatypes.GomegaMatcher
BeNotFoundError checks if error is NotFound.
func CheckDruidError ¶ added in v0.23.0
func CheckDruidError(g *WithT, expectedError *druiderr.DruidError, actualError error)
CheckDruidError checks that an actual error is a DruidError and further checks its underline cause, error code and operation.
func CheckDruidErrorList ¶ added in v0.34.0
func CheckDruidErrorList(g *WithT, actual, expected []error)
CheckDruidErrorList checks if the actual errors match the expected Druid errors by invoking CheckDruidError for each error.
func CheckEtcdOwnerReference ¶
func CheckEtcdOwnerReference(refs []metav1.OwnerReference, etcdOwnerUID types.UID) bool
CheckEtcdOwnerReference checks if one of the owner references points to etcd owner UID.
func CheckEtcdPodLabels ¶ added in v0.35.0
func CheckEtcdPodLabels(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd, labels map[string]string) error
CheckEtcdPodLabels checks if all pods for a given etcd have the given labels.
func CheckLastErrors ¶ added in v0.34.0
func CheckLastErrors(g *WithT, lastErrors []druidapicommon.LastError, expectedLastErrors *druidapicommon.LastError)
CheckLastErrors checks the LastErrors field in the task status with the expected values.
func CheckLastOperation ¶ added in v0.34.0
func CheckLastOperation(g *WithT, actualOp *druidapicommon.LastOperation, expectedLastOperation *druidapicommon.LastOperation)
CheckLastOperation checks the LastOperation field in the task status with the expected values.
func CmdIterator ¶
func ContainerIterator ¶
func CreateBackupSecret ¶ added in v0.35.0
func CreateBackupSecret(ctx context.Context, c client.Client, name, namespace string, provider druidv1alpha1.StorageProvider) error
CreateBackupSecret creates a backup secret based on the specified provider.
func CreateDefaultFakeClient ¶ added in v0.23.0
CreateDefaultFakeClient returns a default fake client.Client without any configured reactions to errors.
func CreateEtcdCopyBackupsJob ¶
CreateEtcdCopyBackupsJob creates an instance of a Job owned by a EtcdCopyBackupsTask with the given name.
func CreateEtcdCopyBackupsTask ¶
func CreateEtcdCopyBackupsTask(name, namespace string, provider druidv1alpha1.StorageProvider, withOptionalFields bool) *druidv1alpha1.EtcdCopyBackupsTask
CreateEtcdCopyBackupsTask creates an instance of EtcdCopyBackupsTask for the given provider and optional fields boolean.
func CreateEvent ¶ added in v0.23.0
func CreateEvent(name, namespace, reason, message, eventType string, involvedObject client.Object, involvedObjectGVK schema.GroupVersionKind) *corev1.Event
CreateEvent creates an event with the given parameters.
func CreateImageVector ¶ added in v0.23.0
func CreateImageVector(withEtcdWrapperImage, withBackupRestoreImage bool) imagevector.ImageVector
CreateImageVector creates an image vector initializing it will different image sources.
func CreateLease ¶
func CreateLease(name, namespace, etcdName string, etcdUID types.UID, componentName string) *coordinationv1.Lease
CreateLease creates a lease with its owner reference set to etcd.
func CreatePVC ¶ added in v0.23.0
func CreatePVC(sts *appsv1.StatefulSet, podName string, phase corev1.PersistentVolumeClaimPhase) *corev1.PersistentVolumeClaim
CreatePVC creates a PVC for the given StatefulSet pod.
func CreateSecrets ¶
CreateSecrets creates all the given secrets
func CreateStatefulSet ¶
func CreateStatefulSet(name, namespace string, etcdUID types.UID, replicas int32) *appsv1.StatefulSet
CreateStatefulSet creates a statefulset with its owner reference set to etcd.
func CreateTestFakeClientForAllObjectsInNamespace ¶ added in v0.23.0
func CreateTestFakeClientForAllObjectsInNamespace(deleteAllErr, listErr *apierrors.StatusError, namespace string, matchingLabels map[string]string, existingObjects ...client.Object) client.Client
CreateTestFakeClientForAllObjectsInNamespace is a convenience function which creates a test client which uses a fake client as a delegate and reacts to the configured errors for all objects in the given namespace matching the given labels.
func CreateTestFakeClientForObjects ¶ added in v0.23.0
func CreateTestFakeClientForObjects(getErr, createErr, patchErr, deleteErr *apierrors.StatusError, existingObjects []client.Object, objKeys ...client.ObjectKey) client.Client
CreateTestFakeClientForObjects is a convenience function which creates a test client which uses a fake client as a delegate and reacts to the configured errors for the given object key.
func CreateTestFakeClientForObjectsInNamespaceWithGVK ¶ added in v0.23.0
func CreateTestFakeClientForObjectsInNamespaceWithGVK(errors []ErrorsForGVK, namespace string, existingObjects ...client.Object) client.Client
CreateTestFakeClientForObjectsInNamespaceWithGVK is a convenience function which creates a test client which uses a fake client as a delegate and reacts to the configured errors for all objects in the given namespace for the given GroupVersionKinds.
func CreateTestFakeClientWithSchemeForObjects ¶ added in v0.23.0
func CreateTestFakeClientWithSchemeForObjects(scheme *runtime.Scheme, getErr, createErr, patchErr, deleteErr *apierrors.StatusError, existingObjects []client.Object, objKeys ...client.ObjectKey) client.Client
CreateTestFakeClientWithSchemeForObjects is a convenience function which creates a test client which uses a fake client with the given scheme as a delegate and reacts to the configured errors for the given object keys.
func EnvIterator ¶
func GenerateBackupSecretData ¶ added in v0.35.0
func GenerateBackupSecretData(provider druidv1alpha1.StorageProvider) (map[string][]byte, error)
GenerateBackupSecretData generates backup secret data based on the specified provider.
func GenerateCACert ¶ added in v0.35.0
GenerateCACert generates a PEM-encoded CA certificate.
func GenerateCAKeyCertToDirectory ¶ added in v0.35.0
GenerateCAKeyCertToDirectory generates a CA key and certificate and saves them to the specified directory.
func GeneratePKIResourcesToDirectory ¶ added in v0.35.0
GeneratePKIResourcesToDirectory generates CA, server, and client TLS key and certificate files in the specified directory, for an Etcd cluster. Generated files are: - ca.key: CA private key - ca.crt: CA certificate - server.key: Server private key - server.crt: Server certificate - client.key: Client private key - client.crt: Client certificate
func GenerateRandomAlphanumericString ¶ added in v0.23.0
GenerateRandomAlphanumericString generates a random alphanumeric string of the given length.
func GenerateTestNamespaceName ¶ added in v0.28.0
GenerateTestNamespaceName generates a unique namespace name for testing purposes.
func GenerateTestNamespaceNameWithTestCaseName ¶ added in v0.35.0
func GenerateTestNamespaceNameWithTestCaseName(t *testing.T, prefix, tcName string, suffixLength int) string
GenerateTestNamespaceNameWithTestCaseName generates a unique namespace name for testing purposes, incorporating the test case name into the namespace name.
func GetBackupRestoreTLSConfig ¶ added in v0.31.0
func GetBackupRestoreTLSConfig() *druidv1alpha1.TLSConfig
GetBackupRestoreTLSConfig returns a default TLSConfig for backup-restore communication.
func GetClientTLSConfig ¶ added in v0.31.0
func GetClientTLSConfig() *druidv1alpha1.TLSConfig
GetClientTLSConfig returns a default TLSConfig for client communication.
func GetEnvOrDefault ¶ added in v0.35.0
GetEnvOrDefault gets the environment variable by key or returns the default value if it is not set.
func GetEnvOrError ¶ added in v0.35.0
GetEnvOrError gets the environment variable by key and returns an error if it is not set.
func GetPeerTLSConfig ¶ added in v0.31.0
func GetPeerTLSConfig() *druidv1alpha1.TLSConfig
GetPeerTLSConfig returns a default TLSConfig for peer communication.
func IsEtcdRemoved ¶
IsEtcdRemoved checks if the given etcd object is removed
func IsLeaseRemoved ¶
IsLeaseRemoved checks if the given etcd object is removed
func MatchEtcdOwnerReference ¶ added in v0.23.0
func MatchEtcdOwnerReference(etcdName string, etcdUID types.UID) gomegatypes.GomegaMatcher
MatchEtcdOwnerReference is a custom gomega matcher which creates a matcher for ObjectMeta.OwnerReferences
func MatchFinalizer ¶
func MatchFinalizer(finalizer string) gomegatypes.GomegaMatcher
func MatchResourceAnnotations ¶ added in v0.23.0
func MatchResourceAnnotations(expected map[string]string) gomegatypes.GomegaMatcher
MatchResourceAnnotations returns a custom gomega matcher which matches annotations set on a resource against the expected annotations.
func MatchResourceLabels ¶ added in v0.23.0
func MatchResourceLabels(expected map[string]string) gomegatypes.GomegaMatcher
MatchResourceLabels returns a custom gomega matcher which matches labels set on the resource against the expected labels.
func MatchSpecLabelSelector ¶ added in v0.23.0
func MatchSpecLabelSelector(expected map[string]string) gomegatypes.GomegaMatcher
MatchSpecLabelSelector returns a custom gomega matcher which matches label selector on a resource against the expected labels.
func MergeMaps ¶ added in v0.23.0
func MergeMaps[K comparable, V any](sourceMaps ...map[K]V) map[K]V
MergeMaps merges the contents of maps. All maps will be processed in the order in which they are sent. For overlapping keys across source maps, value in the merged map for this key will be from the last occurrence of the key-value.
func OwnerRefIterator ¶
func ParseQuantity ¶
func VerifyPeerTLSEnabledOnAllMemberLeases ¶ added in v0.35.0
func VerifyPeerTLSEnabledOnAllMemberLeases(ctx context.Context, c client.Client, etcd *druidv1alpha1.Etcd) error
VerifyPeerTLSEnabledOnAllMemberLeases checks if peer TLS is enabled on all member leases of the given Etcd cluster.
func VolumeIterator ¶
func VolumeMountIterator ¶
Types ¶
type ClientMethod ¶ added in v0.23.0
type ClientMethod string
ClientMethod is a name of the method on client.Client for which an error is recorded.
const ( // ClientMethodGet is the name of the Get method on client.Client. ClientMethodGet ClientMethod = "Get" // ClientMethodList is the name of the List method on client.Client. ClientMethodList ClientMethod = "List" // ClientMethodApply is the name of the Apply method on client.Client. ClientMethodApply ClientMethod = "Apply" // ClientMethodCreate is the name of the Create method on client.Client. ClientMethodCreate ClientMethod = "Create" // ClientMethodDelete is the name of the Delete method on client.Client. ClientMethodDelete ClientMethod = "Delete" // ClientMethodDeleteAll is the name of the DeleteAllOf method on client.Client. ClientMethodDeleteAll ClientMethod = "DeleteAll" // ClientMethodPatch is the name of the Patch method on client.Client. ClientMethodPatch ClientMethod = "Patch" // ClientMethodUpdate is the name of the Update method on client.Client. ClientMethodUpdate ClientMethod = "Update" )
type ErrorsForGVK ¶ added in v0.23.0
type ErrorsForGVK struct {
GVK schema.GroupVersionKind
DeleteAllErr *apierrors.StatusError
ListErr *apierrors.StatusError
}
type EtcdBuilder ¶
type EtcdBuilder struct {
// contains filtered or unexported fields
}
EtcdBuilder is a builder for Etcd resources.
func EtcdBuilderWithDefaults ¶
func EtcdBuilderWithDefaults(name, namespace string) *EtcdBuilder
EtcdBuilderWithDefaults creates a new EtcdBuilder with default values set.
func EtcdBuilderWithoutDefaults ¶
func EtcdBuilderWithoutDefaults(name, namespace string) *EtcdBuilder
EtcdBuilderWithoutDefaults creates a new EtcdBuilder without any default values set.
func (*EtcdBuilder) Build ¶
func (eb *EtcdBuilder) Build() *druidv1alpha1.Etcd
Build returns the built Etcd resource.
func (*EtcdBuilder) WithAnnotations ¶ added in v0.23.0
func (eb *EtcdBuilder) WithAnnotations(annotations map[string]string) *EtcdBuilder
WithAnnotations merges the existing annotations if any with the annotations passed. Any existing entry will be replaced by the one that is present in the annotations passed to this method.
func (*EtcdBuilder) WithBackupPort ¶ added in v0.23.0
func (eb *EtcdBuilder) WithBackupPort(port *int32) *EtcdBuilder
WithBackupPort sets the backup port on the Etcd resource.
func (*EtcdBuilder) WithBackupRestoreContainerImage ¶ added in v0.35.0
func (eb *EtcdBuilder) WithBackupRestoreContainerImage(image string) *EtcdBuilder
WithBackupRestoreContainerImage sets the backup-restore container image on the Etcd resource.
func (*EtcdBuilder) WithBackupRestoreTLS ¶ added in v0.31.0
func (eb *EtcdBuilder) WithBackupRestoreTLS() *EtcdBuilder
WithBackupRestoreTLS adds backup-restore TLS configuration to the Etcd resource.
func (*EtcdBuilder) WithClientTLS ¶ added in v0.23.0
func (eb *EtcdBuilder) WithClientTLS() *EtcdBuilder
WithClientTLS adds client TLS configuration to the Etcd resource.
func (*EtcdBuilder) WithComponentProtectionDisabled ¶ added in v0.35.0
func (eb *EtcdBuilder) WithComponentProtectionDisabled() *EtcdBuilder
WithComponentProtectionDisabled adds the annotation to disable etcd component protection on the Etcd resource.
func (*EtcdBuilder) WithConditionAllMembersUpdated ¶ added in v0.27.0
func (eb *EtcdBuilder) WithConditionAllMembersUpdated(updated bool) *EtcdBuilder
WithConditionAllMembersUpdated sets the ConditionTypeAllMembersUpdated condition on the Etcd resource.
func (*EtcdBuilder) WithDefaultBackup ¶ added in v0.23.0
func (eb *EtcdBuilder) WithDefaultBackup() *EtcdBuilder
WithDefaultBackup creates a default backup spec and initializes etcd with it.
func (*EtcdBuilder) WithDefragmentation ¶ added in v0.35.0
func (eb *EtcdBuilder) WithDefragmentation(schedule string, timeout time.Duration) *EtcdBuilder
WithDefragmentation sets the defragmentation schedule and timeout on the Etcd resource.
func (*EtcdBuilder) WithDeltaSnapshotPeriod ¶ added in v0.35.0
func (eb *EtcdBuilder) WithDeltaSnapshotPeriod(deltaSnapshotPeriod time.Duration) *EtcdBuilder
WithDeltaSnapshotPeriod sets the delta snapshot period on the Etcd resource.
func (*EtcdBuilder) WithEtcdClientPort ¶ added in v0.23.0
func (eb *EtcdBuilder) WithEtcdClientPort(clientPort *int32) *EtcdBuilder
WithEtcdClientPort sets the client port on the Etcd resource.
func (*EtcdBuilder) WithEtcdClientServiceAnnotations ¶ added in v0.23.0
func (eb *EtcdBuilder) WithEtcdClientServiceAnnotations(annotations map[string]string) *EtcdBuilder
WithEtcdClientServiceAnnotations sets the annotations on the Etcd client service.
func (*EtcdBuilder) WithEtcdClientServiceLabels ¶ added in v0.23.0
func (eb *EtcdBuilder) WithEtcdClientServiceLabels(labels map[string]string) *EtcdBuilder
WithEtcdClientServiceLabels sets the labels on the Etcd client service.
func (*EtcdBuilder) WithEtcdClientServiceTrafficDistribution ¶ added in v0.27.0
func (eb *EtcdBuilder) WithEtcdClientServiceTrafficDistribution(trafficDistribution *string) *EtcdBuilder
WithEtcdClientServiceTrafficDistribution sets the traffic distribution on the Etcd client service.
func (*EtcdBuilder) WithEtcdContainerImage ¶ added in v0.35.0
func (eb *EtcdBuilder) WithEtcdContainerImage(image string) *EtcdBuilder
WithEtcdContainerImage sets the etcd container image on the Etcd resource.
func (*EtcdBuilder) WithEtcdServerPort ¶ added in v0.23.0
func (eb *EtcdBuilder) WithEtcdServerPort(serverPort *int32) *EtcdBuilder
WithEtcdServerPort sets the server port on the Etcd resource.
func (*EtcdBuilder) WithEtcdWrapperPort ¶ added in v0.31.0
func (eb *EtcdBuilder) WithEtcdWrapperPort(wrapperPort *int32) *EtcdBuilder
WithEtcdWrapperPort sets the wrapper port on the Etcd resource.
func (*EtcdBuilder) WithGRPCGatewayEnabled ¶ added in v0.35.0
func (eb *EtcdBuilder) WithGRPCGatewayEnabled() *EtcdBuilder
WithGRPCGatewayEnabled enables the gRPC gateway on the Etcd resource.
func (*EtcdBuilder) WithGarbageCollection ¶ added in v0.35.0
func (eb *EtcdBuilder) WithGarbageCollection(period time.Duration, policy druidv1alpha1.GarbageCollectionPolicy, maxBackups *int32) *EtcdBuilder
WithGarbageCollection sets the garbage collection period, policy and max backups limit based GC on the Etcd resource.
func (*EtcdBuilder) WithLabels ¶ added in v0.23.0
func (eb *EtcdBuilder) WithLabels(labels map[string]string) *EtcdBuilder
WithLabels merges the labels that already exists with the ones that are passed to this method. If an entry is already present in the existing labels then it gets overwritten with the new value present in the passed in labels.
func (*EtcdBuilder) WithLastOperation ¶ added in v0.23.0
func (eb *EtcdBuilder) WithLastOperation(operation *druidapicommon.LastOperation) *EtcdBuilder
WithLastOperation sets the last operation on the Etcd resource.
func (*EtcdBuilder) WithPeerTLS ¶ added in v0.23.0
func (eb *EtcdBuilder) WithPeerTLS() *EtcdBuilder
WithPeerTLS adds peer TLS configuration to the Etcd resource.
func (*EtcdBuilder) WithProviderABS ¶
func (eb *EtcdBuilder) WithProviderABS(prefix string) *EtcdBuilder
WithProviderABS sets the ABS storage provider on the Etcd resource.
func (*EtcdBuilder) WithProviderGCS ¶
func (eb *EtcdBuilder) WithProviderGCS(prefix string) *EtcdBuilder
WithProviderGCS sets the GCS storage provider on the Etcd resource.
func (*EtcdBuilder) WithProviderLocal ¶ added in v0.21.0
func (eb *EtcdBuilder) WithProviderLocal(prefix string) *EtcdBuilder
WithProviderLocal sets the Local storage provider on the Etcd resource.
func (*EtcdBuilder) WithProviderOSS ¶
func (eb *EtcdBuilder) WithProviderOSS(prefix string) *EtcdBuilder
WithProviderOSS sets the OSS storage provider on the Etcd resource.
func (*EtcdBuilder) WithProviderS3 ¶
func (eb *EtcdBuilder) WithProviderS3(prefix string) *EtcdBuilder
WithProviderS3 sets the S3 storage provider on the Etcd resource.
func (*EtcdBuilder) WithProviderSwift ¶
func (eb *EtcdBuilder) WithProviderSwift(prefix string) *EtcdBuilder
WithProviderSwift sets the Swift storage provider on the Etcd resource.
func (*EtcdBuilder) WithReadyStatus ¶
func (eb *EtcdBuilder) WithReadyStatus() *EtcdBuilder
WithReadyStatus sets the status of the Etcd resource to ready.
func (*EtcdBuilder) WithReplicas ¶
func (eb *EtcdBuilder) WithReplicas(replicas int32) *EtcdBuilder
WithReplicas sets the replicas field on the Etcd resource.
func (*EtcdBuilder) WithRunAsRoot ¶ added in v0.31.0
func (eb *EtcdBuilder) WithRunAsRoot(runAsRoot *bool) *EtcdBuilder
WithRunAsRoot sets the RunAsRoot field on the Etcd resource.
func (*EtcdBuilder) WithSpecLabels ¶ added in v0.35.0
func (eb *EtcdBuilder) WithSpecLabels(labels map[string]string) *EtcdBuilder
WithSpecLabels sets the spec.labels field on the Etcd resource.
func (*EtcdBuilder) WithStatusConditions ¶ added in v0.34.0
func (eb *EtcdBuilder) WithStatusConditions(conditions []druidv1alpha1.Condition) *EtcdBuilder
WithStatusConditions sets the status conditions on the Etcd resource.
func (*EtcdBuilder) WithStorageProvider ¶
func (eb *EtcdBuilder) WithStorageProvider(provider druidv1alpha1.StorageProvider, prefix string) *EtcdBuilder
WithStorageProvider sets the storage provider on the Etcd resource.
func (*EtcdBuilder) WithoutBackupSecretRef ¶ added in v0.35.0
func (eb *EtcdBuilder) WithoutBackupSecretRef() *EtcdBuilder
WithoutBackupSecretRef removes the secretRef from the backup store of the Etcd resource.
func (*EtcdBuilder) WithoutProvider ¶ added in v0.35.0
func (eb *EtcdBuilder) WithoutProvider() *EtcdBuilder
WithoutProvider removes the backup store from the Etcd resource.
type EtcdOpsTaskBuilder ¶ added in v0.34.0
type EtcdOpsTaskBuilder struct {
// contains filtered or unexported fields
}
func EtcdOpsTaskBuilderWithDefaults ¶ added in v0.34.0
func EtcdOpsTaskBuilderWithDefaults(name, namespace string) *EtcdOpsTaskBuilder
func EtcdOpsTaskBuilderWithoutDefaults ¶ added in v0.34.0
func EtcdOpsTaskBuilderWithoutDefaults(name, namespace string) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) Build ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) Build() *druidv1alpha1.EtcdOpsTask
func (*EtcdOpsTaskBuilder) WithEtcdName ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithEtcdName(etcdName string) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithLastOperation ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithLastOperation(lastOp *druidapicommon.LastOperation) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithLastTransitionTime ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithLastTransitionTime(time metav1.Time) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithOnDemandSnapshotConfig ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithOnDemandSnapshotConfig(config *druidv1alpha1.OnDemandSnapshotConfig) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithStartedAt ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithStartedAt(time metav1.Time) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithState ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithState(state druidv1alpha1.TaskState) *EtcdOpsTaskBuilder
func (*EtcdOpsTaskBuilder) WithTTLSecondsAfterFinished ¶ added in v0.34.0
func (eb *EtcdOpsTaskBuilder) WithTTLSecondsAfterFinished(ttl int32) *EtcdOpsTaskBuilder
type FakeEtcdOpsTaskHandler ¶ added in v0.34.0
type FakeEtcdOpsTaskHandler struct {
AdmitResult handler.Result
RunResult handler.Result
CleanupResult handler.Result
// contains filtered or unexported fields
}
func NewFakeEtcdOpsTaskHandler ¶ added in v0.34.0
func NewFakeEtcdOpsTaskHandler(name string, etcdRef types.NamespacedName, logger logr.Logger) *FakeEtcdOpsTaskHandler
NewFakeEtcdOpsTaskHandler returns a fake whose Admit, Run, and Cleanup all immediately signal completion. You can override any of the results via the fluent helper methods below.
func (*FakeEtcdOpsTaskHandler) Admit ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) Admit(ctx context.Context) handler.Result
----- handler.Handler implementation ------------------------------------------
func (*FakeEtcdOpsTaskHandler) Cleanup ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) Cleanup(ctx context.Context) handler.Result
func (*FakeEtcdOpsTaskHandler) Execute ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) Execute(ctx context.Context) handler.Result
func (*FakeEtcdOpsTaskHandler) WithAdmit ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) WithAdmit(r handler.Result) *FakeEtcdOpsTaskHandler
----- helpers -------------------------------------------------
func (*FakeEtcdOpsTaskHandler) WithCleanup ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) WithCleanup(r handler.Result) *FakeEtcdOpsTaskHandler
func (*FakeEtcdOpsTaskHandler) WithExecute ¶ added in v0.34.0
func (f *FakeEtcdOpsTaskHandler) WithExecute(r handler.Result) *FakeEtcdOpsTaskHandler
type FakeManager ¶ added in v0.23.0
type FakeManager struct {
manager.Manager
Client client.Client
Cache cache.Cache
EventRecorder record.EventRecorder
APIReader client.Reader
Logger logr.Logger
Scheme *runtime.Scheme
}
FakeManager fakes a manager.Manager.
func (FakeManager) GetAPIReader ¶ added in v0.23.0
func (f FakeManager) GetAPIReader() client.Reader
func (FakeManager) GetCache ¶ added in v0.23.0
func (f FakeManager) GetCache() cache.Cache
func (FakeManager) GetClient ¶ added in v0.23.0
func (f FakeManager) GetClient() client.Client
func (FakeManager) GetEventRecorderFor ¶ added in v0.23.0
func (f FakeManager) GetEventRecorderFor(_ string) record.EventRecorder
func (FakeManager) GetLogger ¶ added in v0.23.0
func (f FakeManager) GetLogger() logr.Logger
func (FakeManager) GetScheme ¶ added in v0.23.0
func (f FakeManager) GetScheme() *runtime.Scheme
type FakeResponse ¶ added in v0.34.0
FakeResponse is a struct to mock the HTTP response for testing purposes.
type MockRoundTripper ¶ added in v0.34.0
MockRoundTripper is a mock implementation of http.RoundTripper for testing purposes.
type TestClientBuilder ¶ added in v0.23.0
type TestClientBuilder struct {
// contains filtered or unexported fields
}
TestClientBuilder builds a client.Client which will also react to the configured errors.
func NewTestClientBuilder ¶ added in v0.23.0
func NewTestClientBuilder() *TestClientBuilder
NewTestClientBuilder creates a new instance of TestClientBuilder.
func (*TestClientBuilder) Build ¶ added in v0.23.0
func (b *TestClientBuilder) Build() client.Client
Build creates a new instance of client.Client which will react to the configured errors.
func (*TestClientBuilder) RecordErrorForObjects ¶ added in v0.23.0
func (b *TestClientBuilder) RecordErrorForObjects(method ClientMethod, err *apierrors.StatusError, objectKeys ...client.ObjectKey) *TestClientBuilder
RecordErrorForObjects records an error for a specific client.Client method and object keys.
func (*TestClientBuilder) RecordErrorForObjectsMatchingLabels ¶ added in v0.23.0
func (b *TestClientBuilder) RecordErrorForObjectsMatchingLabels(method ClientMethod, namespace string, matchingLabels map[string]string, err *apierrors.StatusError) *TestClientBuilder
RecordErrorForObjectsMatchingLabels records an error for a specific client.Client method and objects in a given namespace matching the given labels.
func (*TestClientBuilder) RecordErrorForObjectsWithGVK ¶ added in v0.23.0
func (b *TestClientBuilder) RecordErrorForObjectsWithGVK(method ClientMethod, namespace string, gvk schema.GroupVersionKind, err *apierrors.StatusError) *TestClientBuilder
RecordErrorForObjectsWithGVK records an error for a specific client.Client method and objects in a given namespace of a given GroupVersionKind.
func (*TestClientBuilder) WithClient ¶ added in v0.23.0
func (b *TestClientBuilder) WithClient(cl client.Client) *TestClientBuilder
WithClient initializes the delegating fake client builder with the given client.
func (*TestClientBuilder) WithObjects ¶ added in v0.23.0
func (b *TestClientBuilder) WithObjects(objects ...client.Object) *TestClientBuilder
WithObjects initializes the delegating fake client builder with objects.
func (*TestClientBuilder) WithScheme ¶ added in v0.23.0
func (b *TestClientBuilder) WithScheme(scheme *runtime.Scheme) *TestClientBuilder
WithScheme initializes the delegating fake client builder with the given scheme.
func (*TestClientBuilder) WithStatusSubresource ¶ added in v0.34.0
func (b *TestClientBuilder) WithStatusSubresource(obj client.Object) *TestClientBuilder
WithStatusSubresource initializes the delegating fake client builder with a status subresource for the given object.