diff --git a/charts/druid/values.yaml b/charts/druid/values.yaml index f73069e92..1ae815c8f 100644 --- a/charts/druid/values.yaml +++ b/charts/druid/values.yaml @@ -11,8 +11,7 @@ resources: cpu: 50m memory: 128Mi -featureGates: - UseEtcdWrapper: true +featureGates: {} controllerManager: server: diff --git a/docs/deployment/feature-gates.md b/docs/deployment/feature-gates.md index 663904b52..18cf35ef3 100644 --- a/docs/deployment/feature-gates.md +++ b/docs/deployment/feature-gates.md @@ -20,15 +20,16 @@ The following tables are a summary of the feature gates that you can set on etcd ## Feature Gates for Alpha or Beta Features -| Feature | Default | Stage | Since | Until | -|------------------|---------|---------|--------|-------| -| `UseEtcdWrapper` | `false` | `Alpha` | `0.19` | `0.21`| -| `UseEtcdWrapper` | `true` | `Beta` | `0.22` | | +| Feature | Default | Stage | Since | Until | +|---------|---------|-------|-------|-------| ## Feature Gates for Graduated or Deprecated Features -| Feature | Default | Stage | Since | Until | -|---------|---------|-------|-------|-------| +| Feature | Default | Stage | Since | Until | +|------------------|---------|---------|--------|--------| +| `UseEtcdWrapper` | `false` | `Alpha` | `0.19` | `0.21` | +| `UseEtcdWrapper` | `true` | `Beta` | `0.22` | `0.24` | +| `UseEtcdWrapper` | `true` | `GA` | `0.25` | | ## Using a Feature diff --git a/internal/component/statefulset/builder.go b/internal/component/statefulset/builder.go index f2c921def..c6c8a8eab 100644 --- a/internal/component/statefulset/builder.go +++ b/internal/component/statefulset/builder.go @@ -6,8 +6,6 @@ package statefulset import ( "fmt" - "strconv" - "strings" druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1" "github.com/gardener/etcd-druid/internal/common" @@ -58,7 +56,6 @@ type stsBuilder struct { client client.Client etcd *druidv1alpha1.Etcd replicas int32 - useEtcdWrapper bool provider *string etcdImage string etcdBackupRestoreImage string @@ -79,11 +76,10 @@ func newStsBuilder(client client.Client, logger logr.Logger, etcd *druidv1alpha1.Etcd, replicas int32, - useEtcdWrapper bool, imageVector imagevector.ImageVector, skipSetOrUpdateForbiddenFields bool, sts *appsv1.StatefulSet) (*stsBuilder, error) { - etcdImage, etcdBackupRestoreImage, initContainerImage, err := utils.GetEtcdImages(etcd, imageVector, useEtcdWrapper) + etcdImage, etcdBackupRestoreImage, initContainerImage, err := utils.GetEtcdImages(etcd, imageVector) if err != nil { return nil, err } @@ -96,7 +92,6 @@ func newStsBuilder(client client.Client, logger: logger, etcd: etcd, replicas: replicas, - useEtcdWrapper: useEtcdWrapper, provider: provider, etcdImage: etcdImage, etcdBackupRestoreImage: etcdBackupRestoreImage, @@ -247,23 +242,7 @@ func (b *stsBuilder) getVolumeClaimTemplates() []corev1.PersistentVolumeClaim { } func (b *stsBuilder) getPodInitContainers() []corev1.Container { - initContainers := make([]corev1.Container, 0, 2) - if !b.useEtcdWrapper { - return initContainers - } - initContainers = append(initContainers, corev1.Container{ - Name: common.InitContainerNameChangePermissions, - Image: b.initContainerImage, - ImagePullPolicy: corev1.PullIfNotPresent, - Command: []string{"sh", "-c", "--"}, - Args: []string{fmt.Sprintf("chown -R %d:%d %s", nonRootUser, nonRootUser, common.VolumeMountPathEtcdData)}, - VolumeMounts: []corev1.VolumeMount{b.getEtcdDataVolumeMount()}, - SecurityContext: &corev1.SecurityContext{ - RunAsGroup: ptr.To[int64](0), - RunAsNonRoot: ptr.To(false), - RunAsUser: ptr.To[int64](0), - }, - }) + initContainers := make([]corev1.Container, 0, 1) if b.etcd.IsBackupStoreEnabled() { if b.provider != nil && *b.provider == druidstore.Local { etcdBackupVolumeMount := b.getEtcdBackupVolumeMount() @@ -344,16 +323,9 @@ func (b *stsBuilder) getEtcdBackupVolumeMount() *corev1.VolumeMount { switch *b.provider { case druidstore.Local: if b.etcd.Spec.Backup.Store.Container != nil { - if b.useEtcdWrapper { - return &corev1.VolumeMount{ - Name: common.VolumeNameLocalBackup, - MountPath: fmt.Sprintf("/home/nonroot/%s", ptr.Deref(b.etcd.Spec.Backup.Store.Container, "")), - } - } else { - return &corev1.VolumeMount{ - Name: common.VolumeNameLocalBackup, - MountPath: ptr.Deref(b.etcd.Spec.Backup.Store.Container, ""), - } + return &corev1.VolumeMount{ + Name: common.VolumeNameLocalBackup, + MountPath: fmt.Sprintf("/home/nonroot/%s", ptr.Deref(b.etcd.Spec.Backup.Store.Container, "")), } } case druidstore.GCS: @@ -496,9 +468,7 @@ func (b *stsBuilder) getBackupRestoreContainerCommandArgs() []string { commandArgs = append(commandArgs, fmt.Sprintf("--etcd-connection-timeout=%s", defaultEtcdConnectionTimeout)) commandArgs = append(commandArgs, "--enable-member-lease-renewal=true") // Enable/Disable use Etcd Wrapper in BackupRestore container. Once `use-etcd-wrapper` feature-gate is GA then this value will always be true. - if b.useEtcdWrapper { - commandArgs = append(commandArgs, "--use-etcd-wrapper=true") - } + commandArgs = append(commandArgs, "--use-etcd-wrapper=true") var quota = defaultQuota if b.etcd.Spec.Etcd.Quota != nil { @@ -601,13 +571,7 @@ func (b *stsBuilder) getEtcdContainerReadinessProbe() *corev1.Probe { func (b *stsBuilder) getEtcdContainerReadinessHandler() corev1.ProbeHandler { multiNodeCluster := b.etcd.Spec.Replicas > 1 - if multiNodeCluster && !b.useEtcdWrapper { - return corev1.ProbeHandler{ - Exec: &corev1.ExecAction{ - Command: b.getEtcdContainerReadinessProbeCommand(), - }, - } - } + scheme := utils.IfConditionOr(b.etcd.Spec.Backup.TLS == nil, corev1.URISchemeHTTP, corev1.URISchemeHTTPS) path := utils.IfConditionOr(multiNodeCluster, "/readyz", "/healthz") port := utils.IfConditionOr(multiNodeCluster, common.DefaultPortEtcdWrapper, common.DefaultPortEtcdBackupRestore) @@ -621,33 +585,7 @@ func (b *stsBuilder) getEtcdContainerReadinessHandler() corev1.ProbeHandler { } } -func (b *stsBuilder) getEtcdContainerReadinessProbeCommand() []string { - cmdBuilder := strings.Builder{} - cmdBuilder.WriteString("ETCDCTL_API=3 etcdctl") - if b.etcd.Spec.Etcd.ClientUrlTLS != nil { - dataKey := ptr.Deref(b.etcd.Spec.Etcd.ClientUrlTLS.TLSCASecretRef.DataKey, "ca.crt") - cmdBuilder.WriteString(fmt.Sprintf(" --cacert=%s/%s", common.VolumeMountPathEtcdCA, dataKey)) - cmdBuilder.WriteString(fmt.Sprintf(" --cert=%s/tls.crt", common.VolumeMountPathEtcdClientTLS)) - cmdBuilder.WriteString(fmt.Sprintf(" --key=%s/tls.key", common.VolumeMountPathEtcdClientTLS)) - cmdBuilder.WriteString(fmt.Sprintf(" --endpoints=https://%s-local:%d", b.etcd.Name, b.clientPort)) - } else { - cmdBuilder.WriteString(fmt.Sprintf(" --endpoints=http://%s-local:%d", b.etcd.Name, b.clientPort)) - } - cmdBuilder.WriteString(" get foo") - cmdBuilder.WriteString(" --consistency=l") - - return []string{ - "/bin/sh", - "-ec", - cmdBuilder.String(), - } -} - func (b *stsBuilder) getEtcdContainerCommandArgs() []string { - if !b.useEtcdWrapper { - // safe to return an empty string array here since etcd-custom-image:v3.4.13-bootstrap-12 (as well as v3.4.26) now uses an entry point that calls bootstrap.sh - return []string{} - } commandArgs := []string{"start-etcd"} commandArgs = append(commandArgs, fmt.Sprintf("--backup-restore-host-port=%s-local:%d", b.etcd.Name, common.DefaultPortEtcdBackupRestore)) commandArgs = append(commandArgs, fmt.Sprintf("--etcd-server-name=%s-local", b.etcd.Name)) @@ -665,23 +603,10 @@ func (b *stsBuilder) getEtcdContainerCommandArgs() []string { } func (b *stsBuilder) getEtcdContainerEnvVars() []corev1.EnvVar { - if b.useEtcdWrapper { - return []corev1.EnvVar{} - } - backTLSEnabled := b.etcd.Spec.Backup.TLS != nil - scheme := utils.IfConditionOr(backTLSEnabled, "https", "http") - endpoint := fmt.Sprintf("%s://%s-local:%d", scheme, b.etcd.Name, b.backupPort) - - return []corev1.EnvVar{ - {Name: "ENABLE_TLS", Value: strconv.FormatBool(backTLSEnabled)}, - {Name: "BACKUP_ENDPOINT", Value: endpoint}, - } + return []corev1.EnvVar{} } func (b *stsBuilder) getPodSecurityContext() *corev1.PodSecurityContext { - if !b.useEtcdWrapper { - return nil - } return &corev1.PodSecurityContext{ RunAsGroup: ptr.To[int64](nonRootUser), RunAsNonRoot: ptr.To(true), diff --git a/internal/component/statefulset/statefulset.go b/internal/component/statefulset/statefulset.go index e21948215..b301425b1 100644 --- a/internal/component/statefulset/statefulset.go +++ b/internal/component/statefulset/statefulset.go @@ -12,7 +12,6 @@ import ( "github.com/gardener/etcd-druid/internal/common" "github.com/gardener/etcd-druid/internal/component" druiderr "github.com/gardener/etcd-druid/internal/errors" - "github.com/gardener/etcd-druid/internal/features" "github.com/gardener/etcd-druid/internal/utils" "github.com/gardener/gardener/pkg/controllerutils" @@ -23,7 +22,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/component-base/featuregate" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -37,18 +35,16 @@ const ( ) type _resource struct { - client client.Client - imageVector imagevector.ImageVector - useEtcdWrapper bool - logger logr.Logger + client client.Client + imageVector imagevector.ImageVector + logger logr.Logger } // New returns a new statefulset component operator. -func New(client client.Client, imageVector imagevector.ImageVector, featureGates map[featuregate.Feature]bool) component.Operator { +func New(client client.Client, imageVector imagevector.ImageVector) component.Operator { return &_resource{ - client: client, - imageVector: imageVector, - useEtcdWrapper: featureGates[features.UseEtcdWrapper], + client: client, + imageVector: imageVector, } } @@ -225,7 +221,7 @@ func (r _resource) getExistingStatefulSet(ctx component.OperatorContext, etcdObj func (r _resource) createOrPatchWithReplicas(ctx component.OperatorContext, etcd *druidv1alpha1.Etcd, sts *appsv1.StatefulSet, replicas int32, skipSetOrUpdateForbiddenFields bool) error { stsClone := sts.DeepCopy() mutatingFn := func() error { - if builder, err := newStsBuilder(r.client, ctx.Logger, etcd, replicas, r.useEtcdWrapper, r.imageVector, skipSetOrUpdateForbiddenFields, stsClone); err != nil { + if builder, err := newStsBuilder(r.client, ctx.Logger, etcd, replicas, r.imageVector, skipSetOrUpdateForbiddenFields, stsClone); err != nil { return err } else { return builder.Build(ctx) diff --git a/internal/component/statefulset/statefulset_test.go b/internal/component/statefulset/statefulset_test.go index 450b59a81..e86718b68 100644 --- a/internal/component/statefulset/statefulset_test.go +++ b/internal/component/statefulset/statefulset_test.go @@ -12,7 +12,6 @@ import ( "github.com/gardener/etcd-druid/internal/common" "github.com/gardener/etcd-druid/internal/component" druiderr "github.com/gardener/etcd-druid/internal/errors" - "github.com/gardener/etcd-druid/internal/features" druidstore "github.com/gardener/etcd-druid/internal/store" "github.com/gardener/etcd-druid/internal/utils" testutils "github.com/gardener/etcd-druid/test/utils" @@ -23,7 +22,6 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/component-base/featuregate" "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" @@ -72,7 +70,7 @@ func TestGetExistingResourceNames(t *testing.T) { existingObjects = append(existingObjects, emptyStatefulSet(etcd.ObjectMeta)) } cl := testutils.CreateTestFakeClientForObjects(tc.getErr, nil, nil, nil, existingObjects, getObjectKey(etcd.ObjectMeta)) - operator := New(cl, nil, nil) + operator := New(cl, nil) opCtx := component.NewOperatorContext(context.Background(), logr.Discard(), uuid.NewString()) actualStsNames, err := operator.GetExistingResourceNames(opCtx, etcd.ObjectMeta) if tc.expectedErr != nil { @@ -115,19 +113,17 @@ func TestSyncWhenNoSTSExists(t *testing.T) { g := NewWithT(t) t.Parallel() - iv := testutils.CreateImageVector(false, false, true, true) + iv := testutils.CreateImageVector(true, true) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { t.Parallel() // *************** Build test environment *************** etcd := testutils.EtcdBuilderWithDefaults(testutils.TestEtcdName, testutils.TestNamespace).WithReplicas(tc.replicas).Build() cl := testutils.CreateTestFakeClientForObjects(nil, tc.createErr, nil, nil, []client.Object{buildBackupSecret()}, getObjectKey(etcd.ObjectMeta)) - etcdImage, etcdBRImage, initContainerImage, err := utils.GetEtcdImages(etcd, iv, true) + etcdImage, etcdBRImage, initContainerImage, err := utils.GetEtcdImages(etcd, iv) g.Expect(err).ToNot(HaveOccurred()) - stsMatcher := NewStatefulSetMatcher(g, cl, etcd, tc.replicas, true, initContainerImage, etcdImage, etcdBRImage, ptr.To(druidstore.Local)) - operator := New(cl, iv, map[featuregate.Feature]bool{ - features.UseEtcdWrapper: true, - }) + stsMatcher := NewStatefulSetMatcher(g, cl, etcd, tc.replicas, initContainerImage, etcdImage, etcdBRImage, ptr.To(druidstore.Local)) + operator := New(cl, iv) // *************** Test and assert *************** opCtx := component.NewOperatorContext(context.Background(), logr.Discard(), uuid.NewString()) opCtx.Data[common.CheckSumKeyConfigMap] = testutils.TestConfigMapCheckSum diff --git a/internal/component/statefulset/stsmatcher.go b/internal/component/statefulset/stsmatcher.go index 010eabcef..52ddcf794 100644 --- a/internal/component/statefulset/stsmatcher.go +++ b/internal/component/statefulset/stsmatcher.go @@ -7,7 +7,6 @@ package statefulset import ( "context" "fmt" - "strconv" druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1" "github.com/gardener/etcd-druid/internal/common" @@ -43,7 +42,6 @@ type StatefulSetMatcher struct { cl client.Client replicas int32 etcd *druidv1alpha1.Etcd - useEtcdWrapper bool initContainerImage string etcdImage string etcdBRImage string @@ -58,7 +56,6 @@ func NewStatefulSetMatcher(g *WithT, cl client.Client, etcd *druidv1alpha1.Etcd, replicas int32, - useEtcdWrapper bool, initContainerImage, etcdImage, etcdBRImage string, provider *string) StatefulSetMatcher { return StatefulSetMatcher{ @@ -66,7 +63,6 @@ func NewStatefulSetMatcher(g *WithT, cl: cl, replicas: replicas, etcd: etcd, - useEtcdWrapper: useEtcdWrapper, initContainerImage: initContainerImage, etcdImage: etcdImage, etcdBRImage: etcdBRImage, @@ -164,20 +160,7 @@ func (s StatefulSetMatcher) matchPodHostAliases() gomegatypes.GomegaMatcher { } func (s StatefulSetMatcher) matchPodInitContainers() gomegatypes.GomegaMatcher { - if !s.useEtcdWrapper { - return BeEmpty() - } initContainerMatcherElements := make(map[string]gomegatypes.GomegaMatcher) - changePermissionsInitContainerMatcher := MatchFields(IgnoreExtras, Fields{ - "Name": Equal(common.InitContainerNameChangePermissions), - "Image": Equal(s.initContainerImage), - "ImagePullPolicy": Equal(corev1.PullIfNotPresent), - "Command": HaveExactElements("sh", "-c", "--"), - "Args": HaveExactElements("chown -R 65532:65532 /var/etcd/data"), - "VolumeMounts": ConsistOf(s.matchEtcdDataVolMount()), - "SecurityContext": matchPodInitContainerSecurityContext(), - }) - initContainerMatcherElements[common.InitContainerNameChangePermissions] = changePermissionsInitContainerMatcher if s.etcd.IsBackupStoreEnabled() && s.provider != nil && *s.provider == druidstore.Local { changeBackupBucketPermissionsMatcher := MatchFields(IgnoreExtras, Fields{ "Name": Equal(common.InitContainerNameChangeBackupBucketPermissions), @@ -262,13 +245,6 @@ func (s StatefulSetMatcher) matchBackupRestoreContainer() gomegatypes.GomegaMatc } func (s StatefulSetMatcher) matchEtcdContainerReadinessHandler() gomegatypes.GomegaMatcher { - if s.etcd.Spec.Replicas > 1 && !s.useEtcdWrapper { - return MatchFields(IgnoreExtras|IgnoreMissing, Fields{ - "Exec": PointTo(MatchFields(IgnoreExtras, Fields{ - "Command": s.matchEtcdContainerReadinessProbeCmd(), - })), - }) - } scheme := utils.IfConditionOr(s.etcd.Spec.Backup.TLS == nil, corev1.URISchemeHTTP, corev1.URISchemeHTTPS) path := utils.IfConditionOr(s.etcd.Spec.Replicas > 1, "/readyz", "/healthz") port := utils.IfConditionOr(s.etcd.Spec.Replicas > 1, int32(9095), int32(8080)) @@ -302,9 +278,6 @@ func (s StatefulSetMatcher) matchEtcdContainerReadinessProbeCmd() gomegatypes.Go } func (s StatefulSetMatcher) matchEtcdContainerCmdArgs() gomegatypes.GomegaMatcher { - if !s.useEtcdWrapper { - return BeEmpty() - } cmdArgs := make([]string, 0, 8) cmdArgs = append(cmdArgs, "start-etcd") cmdArgs = append(cmdArgs, fmt.Sprintf("--backup-restore-host-port=%s-local:8080", s.etcd.Name)) @@ -368,11 +341,7 @@ func (s StatefulSetMatcher) getEtcdBackupVolumeMountMatcher() gomegatypes.Gomega switch *s.provider { case druidstore.Local: if s.etcd.Spec.Backup.Store.Container != nil { - if s.useEtcdWrapper { - return matchVolMount(common.VolumeNameLocalBackup, fmt.Sprintf("/home/nonroot/%s", ptr.Deref(s.etcd.Spec.Backup.Store.Container, ""))) - } else { - return matchVolMount(common.VolumeNameLocalBackup, ptr.Deref(s.etcd.Spec.Backup.Store.Container, "")) - } + return matchVolMount(common.VolumeNameLocalBackup, fmt.Sprintf("/home/nonroot/%s", ptr.Deref(s.etcd.Spec.Backup.Store.Container, ""))) } case druidstore.GCS: return matchVolMount(common.VolumeNameProviderBackupSecret, common.VolumeMountPathGCSBackupSecret) @@ -383,26 +352,10 @@ func (s StatefulSetMatcher) getEtcdBackupVolumeMountMatcher() gomegatypes.Gomega } func (s StatefulSetMatcher) matchEtcdContainerEnvVars() gomegatypes.GomegaMatcher { - if s.useEtcdWrapper { - return BeEmpty() - } - scheme := utils.IfConditionOr(s.etcd.Spec.Backup.TLS != nil, "https", "http") - return ConsistOf( - MatchFields(IgnoreExtras, Fields{ - "Name": Equal("ENABLE_TLS"), - "Value": Equal(strconv.FormatBool(s.etcd.Spec.Backup.TLS != nil)), - }), - MatchFields(IgnoreExtras, Fields{ - "Name": Equal("BACKUP_ENDPOINT"), - "Value": Equal(fmt.Sprintf("%s://%s-local:%d", scheme, s.etcd.Name, s.backupPort)), - }), - ) + return BeEmpty() } func (s StatefulSetMatcher) matchEtcdPodSecurityContext() gomegatypes.GomegaMatcher { - if !s.useEtcdWrapper { - Equal(nil) - } return PointTo(MatchFields(IgnoreExtras|IgnoreMissing, Fields{ "RunAsGroup": PointTo(Equal(int64(65532))), "RunAsNonRoot": PointTo(Equal(true)), diff --git a/internal/controller/compaction/config.go b/internal/controller/compaction/config.go index ae77cc231..03a36d7bb 100644 --- a/internal/controller/compaction/config.go +++ b/internal/controller/compaction/config.go @@ -8,16 +8,13 @@ import ( "time" "github.com/gardener/etcd-druid/internal/controller/utils" - "github.com/gardener/etcd-druid/internal/features" flag "github.com/spf13/pflag" "k8s.io/component-base/featuregate" ) // featureList holds the feature gate names that are relevant for the Compaction Controller. -var featureList = []featuregate.Feature{ - features.UseEtcdWrapper, -} +var featureList []featuregate.Feature const ( enableBackupCompactionFlagName = "enable-backup-compaction" diff --git a/internal/controller/compaction/reconciler.go b/internal/controller/compaction/reconciler.go index 6240a33cd..bf042f857 100644 --- a/internal/controller/compaction/reconciler.go +++ b/internal/controller/compaction/reconciler.go @@ -12,7 +12,6 @@ import ( druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1" "github.com/gardener/etcd-druid/internal/common" - "github.com/gardener/etcd-druid/internal/features" "github.com/gardener/etcd-druid/internal/images" druidmetrics "github.com/gardener/etcd-druid/internal/metrics" druidstore "github.com/gardener/etcd-druid/internal/store" @@ -28,7 +27,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/component-base/featuregate" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -261,7 +259,7 @@ func (r *Reconciler) delete(ctx context.Context, logger logr.Logger, etcd *druid func (r *Reconciler) createCompactionJob(ctx context.Context, logger logr.Logger, etcd *druidv1alpha1.Etcd) (*batchv1.Job, error) { activeDeadlineSeconds := r.config.ActiveDeadlineDuration.Seconds() - _, etcdBackupImage, _, err := utils.GetEtcdImages(etcd, r.imageVector, r.config.FeatureGates[features.UseEtcdWrapper]) + _, etcdBackupImage, _, err := utils.GetEtcdImages(etcd, r.imageVector) if err != nil { return nil, fmt.Errorf("couldn't fetch etcd backup image: %v", err) } @@ -313,7 +311,7 @@ func (r *Reconciler) createCompactionJob(ctx context.Context, logger logr.Logger }, } - if vms, err := getCompactionJobVolumeMounts(etcd, r.config.FeatureGates); err != nil { + if vms, err := getCompactionJobVolumeMounts(etcd); err != nil { return nil, fmt.Errorf("error while creating compaction job in %v for %v : %v", etcd.Namespace, etcd.Name, @@ -372,7 +370,7 @@ func getLabels(etcd *druidv1alpha1.Etcd) map[string]string { return utils.MergeMaps(druidv1alpha1.GetDefaultLabels(etcd.ObjectMeta), jobLabels) } -func getCompactionJobVolumeMounts(etcd *druidv1alpha1.Etcd, featureMap map[featuregate.Feature]bool) ([]v1.VolumeMount, error) { +func getCompactionJobVolumeMounts(etcd *druidv1alpha1.Etcd) ([]v1.VolumeMount, error) { vms := []v1.VolumeMount{ { Name: "etcd-workspace-dir", @@ -386,17 +384,10 @@ func getCompactionJobVolumeMounts(etcd *druidv1alpha1.Etcd, featureMap map[featu } switch provider { case druidstore.Local: - if featureMap[features.UseEtcdWrapper] { - vms = append(vms, v1.VolumeMount{ - Name: "host-storage", - MountPath: "/home/nonroot/" + ptr.Deref(etcd.Spec.Backup.Store.Container, ""), - }) - } else { - vms = append(vms, v1.VolumeMount{ - Name: "host-storage", - MountPath: ptr.Deref(etcd.Spec.Backup.Store.Container, ""), - }) - } + vms = append(vms, v1.VolumeMount{ + Name: "host-storage", + MountPath: "/home/nonroot/" + ptr.Deref(etcd.Spec.Backup.Store.Container, ""), + }) case druidstore.GCS: vms = append(vms, v1.VolumeMount{ Name: common.VolumeNameProviderBackupSecret, diff --git a/internal/controller/etcd/config.go b/internal/controller/etcd/config.go index 5ff97434d..7e1c47c2f 100644 --- a/internal/controller/etcd/config.go +++ b/internal/controller/etcd/config.go @@ -10,7 +10,6 @@ import ( "time" "github.com/gardener/etcd-druid/internal/controller/utils" - "github.com/gardener/etcd-druid/internal/features" gardenerconstants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants" flag "github.com/spf13/pflag" @@ -39,9 +38,7 @@ const ( ) // featureList holds the feature gate names that are relevant for the Etcd Controller. -var featureList = []featuregate.Feature{ - features.UseEtcdWrapper, -} +var featureList []featuregate.Feature // Config defines the configuration for the Etcd Controller. type Config struct { diff --git a/internal/controller/etcd/reconciler.go b/internal/controller/etcd/reconciler.go index 353372fe0..f70682d54 100644 --- a/internal/controller/etcd/reconciler.go +++ b/internal/controller/etcd/reconciler.go @@ -126,7 +126,7 @@ func createAndInitializeOperatorRegistry(client client.Client, config *Config, i reg.Register(component.PodDisruptionBudgetKind, poddistruptionbudget.New(client)) reg.Register(component.RoleKind, role.New(client)) reg.Register(component.RoleBindingKind, rolebinding.New(client)) - reg.Register(component.StatefulSetKind, statefulset.New(client, imageVector, config.FeatureGates)) + reg.Register(component.StatefulSetKind, statefulset.New(client, imageVector)) return reg } diff --git a/internal/controller/etcdcopybackupstask/config.go b/internal/controller/etcdcopybackupstask/config.go index 74d9c184b..1c231ccaf 100644 --- a/internal/controller/etcdcopybackupstask/config.go +++ b/internal/controller/etcdcopybackupstask/config.go @@ -6,16 +6,13 @@ package etcdcopybackupstask import ( "github.com/gardener/etcd-druid/internal/controller/utils" - "github.com/gardener/etcd-druid/internal/features" flag "github.com/spf13/pflag" "k8s.io/component-base/featuregate" ) // featureList holds the feature gate names that are relevant for the EtcdCopyBackupTask Controller. -var featureList = []featuregate.Feature{ - features.UseEtcdWrapper, -} +var featureList []featuregate.Feature const ( workersFlagName = "etcd-copy-backups-task-workers" diff --git a/internal/controller/etcdcopybackupstask/reconciler.go b/internal/controller/etcdcopybackupstask/reconciler.go index 45219814c..bdf6cad30 100644 --- a/internal/controller/etcdcopybackupstask/reconciler.go +++ b/internal/controller/etcdcopybackupstask/reconciler.go @@ -12,7 +12,6 @@ import ( druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1" "github.com/gardener/etcd-druid/internal/common" - "github.com/gardener/etcd-druid/internal/features" "github.com/gardener/etcd-druid/internal/images" druidstore "github.com/gardener/etcd-druid/internal/store" "github.com/gardener/etcd-druid/internal/utils" @@ -275,7 +274,7 @@ func getConditionType(jobConditionType batchv1.JobConditionType) druidv1alpha1.C } func (r *Reconciler) createJobObject(ctx context.Context, task *druidv1alpha1.EtcdCopyBackupsTask) (*batchv1.Job, error) { - etcdBackupImage, err := utils.GetEtcdBackupRestoreImage(r.imageVector, r.Config.FeatureGates[features.UseEtcdWrapper]) + etcdBackupImage, err := utils.GetEtcdBackupRestoreImage(r.imageVector) if err != nil { return nil, err } @@ -305,8 +304,8 @@ func (r *Reconciler) createJobObject(ctx context.Context, task *druidv1alpha1.Et // Formulate the job's volume mounts. volumeMounts := append( - createVolumeMountsFromStore(&sourceStore, sourceProvider, sourcePrefix, r.Config.FeatureGates[features.UseEtcdWrapper]), - createVolumeMountsFromStore(&targetStore, targetProvider, "", r.Config.FeatureGates[features.UseEtcdWrapper])...) + createVolumeMountsFromStore(&sourceStore, sourceProvider, sourcePrefix), + createVolumeMountsFromStore(&targetStore, targetProvider, "")...) // Formulate the job's volumes from the source store. sourceVolumes, err := r.createVolumesFromStore(ctx, &sourceStore, task.Namespace, sourceProvider, sourcePrefix) @@ -353,32 +352,30 @@ func (r *Reconciler) createJobObject(ctx context.Context, task *druidv1alpha1.Et }, } - if r.Config.FeatureGates[features.UseEtcdWrapper] { - if targetProvider == druidstore.Local { - // init container to change file permissions of the folders used as store to 65532 (nonroot) - // used only with local provider - job.Spec.Template.Spec.InitContainers = []corev1.Container{ - { - Name: "change-backup-bucket-permissions", - Image: *initContainerImage, - Command: []string{"sh", "-c", "--"}, - Args: []string{fmt.Sprintf("%s%s%s%s", "chown -R 65532:65532 /home/nonroot/", *targetStore.Container, " /home/nonroot/", *sourceStore.Container)}, - VolumeMounts: volumeMounts, - SecurityContext: &corev1.SecurityContext{ - RunAsGroup: ptr.To[int64](0), - RunAsNonRoot: ptr.To(false), - RunAsUser: ptr.To[int64](0), - }, + if targetProvider == druidstore.Local { + // init container to change file permissions of the folders used as store to 65532 (nonroot) + // used only with local provider + job.Spec.Template.Spec.InitContainers = []corev1.Container{ + { + Name: "change-backup-bucket-permissions", + Image: *initContainerImage, + Command: []string{"sh", "-c", "--"}, + Args: []string{fmt.Sprintf("%s%s%s%s", "chown -R 65532:65532 /home/nonroot/", *targetStore.Container, " /home/nonroot/", *sourceStore.Container)}, + VolumeMounts: volumeMounts, + SecurityContext: &corev1.SecurityContext{ + RunAsGroup: ptr.To[int64](0), + RunAsNonRoot: ptr.To(false), + RunAsUser: ptr.To[int64](0), }, - } - } - job.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{ - RunAsGroup: ptr.To[int64](65532), - RunAsNonRoot: ptr.To(true), - RunAsUser: ptr.To[int64](65532), - FSGroup: ptr.To[int64](65532), + }, } } + job.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{ + RunAsGroup: ptr.To[int64](65532), + RunAsNonRoot: ptr.To(true), + RunAsUser: ptr.To[int64](65532), + FSGroup: ptr.To[int64](65532), + } if err := controllerutil.SetControllerReference(task, job, r.Scheme()); err != nil { return nil, fmt.Errorf("could not set owner reference for job %v: %w", client.ObjectKeyFromObject(job), err) @@ -477,20 +474,13 @@ func (r *Reconciler) createVolumesFromStore(ctx context.Context, store *druidv1a // createVolumesFromStore generates a slice of volumes for an EtcdCopyBackups job based on the given StoreSpec, namespace, // provider, and prefix. The prefix is used to differentiate between source and target volumes. // This function creates the necessary Volume configurations for various storage providers and returns any errors encountered. -func createVolumeMountsFromStore(store *druidv1alpha1.StoreSpec, provider, volumeMountPrefix string, useEtcdWrapper bool) (volumeMounts []corev1.VolumeMount) { +func createVolumeMountsFromStore(store *druidv1alpha1.StoreSpec, provider, volumeMountPrefix string) (volumeMounts []corev1.VolumeMount) { switch provider { case druidstore.Local: - if useEtcdWrapper { - volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: volumeMountPrefix + "host-storage", - MountPath: "/home/nonroot/" + *store.Container, - }) - } else { - volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: volumeMountPrefix + "host-storage", - MountPath: *store.Container, - }) - } + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: volumeMountPrefix + "host-storage", + MountPath: "/home/nonroot/" + *store.Container, + }) case druidstore.GCS: volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: getVolumeNamePrefix(volumeMountPrefix) + common.VolumeNameProviderBackupSecret, diff --git a/internal/controller/etcdcopybackupstask/reconciler_test.go b/internal/controller/etcdcopybackupstask/reconciler_test.go index e1082641d..2741a34cb 100644 --- a/internal/controller/etcdcopybackupstask/reconciler_test.go +++ b/internal/controller/etcdcopybackupstask/reconciler_test.go @@ -460,7 +460,7 @@ var _ = Describe("EtcdCopyBackupsTaskController", func() { }) It("should create the correct volume mounts", func() { - volumeMounts := createVolumeMountsFromStore(storeSpec, provider, volumeMountPrefix, false) + volumeMounts := createVolumeMountsFromStore(storeSpec, provider, volumeMountPrefix) Expect(volumeMounts).To(HaveLen(1)) expectedMountPath := "" @@ -469,7 +469,7 @@ var _ = Describe("EtcdCopyBackupsTaskController", func() { switch provider { case druidstore.Local: expectedMountName = volumeMountPrefix + "host-storage" - expectedMountPath = *storeSpec.Container + expectedMountPath = "/home/nonroot/" + *storeSpec.Container case druidstore.GCS: expectedMountName = volumeMountPrefix + common.VolumeNameProviderBackupSecret expectedMountPath = getGCSSecretVolumeMountPathWithPrefixAndSuffix(volumeMountPrefix, "/") diff --git a/internal/features/features.go b/internal/features/features.go index 0bd7c799b..40297ac14 100644 --- a/internal/features/features.go +++ b/internal/features/features.go @@ -22,11 +22,12 @@ const ( // owner @unmarshall @aaronfern // alpha: v0.19 // beta: v0.22 + // GA: v0.25 UseEtcdWrapper featuregate.Feature = "UseEtcdWrapper" ) var defaultFeatures = map[featuregate.Feature]featuregate.FeatureSpec{ - UseEtcdWrapper: {Default: true, PreRelease: featuregate.Beta}, + UseEtcdWrapper: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, } // GetDefaultFeatures returns the default feature gates known to etcd-druid. diff --git a/internal/images/images.yaml b/internal/images/images.yaml index fe16e9984..a595ba5cc 100644 --- a/internal/images/images.yaml +++ b/internal/images/images.yaml @@ -1,24 +1,14 @@ images: +- name: etcd-wrapper + sourceRepository: github.com/gardener/etcd-wrapper + repository: europe-docker.pkg.dev/gardener-project/public/gardener/etcd-wrapper + tag: "v0.3.0" - name: etcd-backup-restore - resourceId: - name: 'etcdbrctl' - sourceRepository: github.com/gardener/etcd-backup-restore - repository: europe-docker.pkg.dev/gardener-project/public/gardener/etcdbrctl - tag: "v0.24.9" -- name: etcd - sourceRepository: github.com/gardener/etcd-custom-image - repository: europe-docker.pkg.dev/gardener-project/public/gardener/etcd - tag: "v3.4.26-7" -- name: etcd-backup-restore-distroless resourceId: name: 'etcdbrctl' sourceRepository: github.com/gardener/etcd-backup-restore repository: europe-docker.pkg.dev/gardener-project/public/gardener/etcdbrctl tag: "v0.32.0" -- name: etcd-wrapper - sourceRepository: github.com/gardener/etcd-wrapper - repository: europe-docker.pkg.dev/gardener-project/public/gardener/etcd-wrapper - tag: "v0.3.0" - name: alpine repository: europe-docker.pkg.dev/gardener-project/public/3rd/alpine tag: "3.20.3" diff --git a/internal/utils/image.go b/internal/utils/image.go index 7a0f98ec1..307694f5e 100755 --- a/internal/utils/image.go +++ b/internal/utils/image.go @@ -17,8 +17,8 @@ import ( // It will give preference to images that are set in the etcd spec and only if the image is not found in it should // it be picked up from the image vector if it's set there. // A return value of nil for either of the images indicates that the image is not set. -func GetEtcdImages(etcd *druidv1alpha1.Etcd, iv imagevector.ImageVector, useEtcdWrapper bool) (string, string, string, error) { - etcdImageKey, etcdBRImageKey, initContainerImageKey := getEtcdImageKeys(useEtcdWrapper) +func GetEtcdImages(etcd *druidv1alpha1.Etcd, iv imagevector.ImageVector) (string, string, string, error) { + etcdImageKey, etcdBRImageKey, initContainerImageKey := getEtcdImageKeys() etcdImage, err := chooseImage(etcdImageKey, etcd.Spec.Etcd.Image, iv) if err != nil { return "", "", "", err @@ -35,16 +35,8 @@ func GetEtcdImages(etcd *druidv1alpha1.Etcd, iv imagevector.ImageVector, useEtcd return *etcdImage, *etcdBackupRestoreImage, *initContainerImage, nil } -func getEtcdImageKeys(useEtcdWrapper bool) (etcdImageKey string, etcdBRImageKey string, alpine string) { - alpine = common.ImageKeyAlpine - if useEtcdWrapper { - etcdImageKey = common.ImageKeyEtcdWrapper - etcdBRImageKey = common.ImageKeyEtcdBackupRestoreDistroless - } else { - etcdImageKey = common.ImageKeyEtcd - etcdBRImageKey = common.ImageKeyEtcdBackupRestore - } - return +func getEtcdImageKeys() (string, string, string) { + return common.ImageKeyEtcdWrapper, common.ImageKeyEtcdBackupRestore, common.ImageKeyAlpine } // chooseImage selects an image based on the given key, specImage, and image vector. @@ -62,8 +54,8 @@ func chooseImage(key string, specImage *string, iv imagevector.ImageVector) (*st } // GetEtcdBackupRestoreImage returns the image for backup-restore from the given image vector. -func GetEtcdBackupRestoreImage(iv imagevector.ImageVector, useEtcdWrapper bool) (*string, error) { - _, etcdbrImageKey, _ := getEtcdImageKeys(useEtcdWrapper) +func GetEtcdBackupRestoreImage(iv imagevector.ImageVector) (*string, error) { + _, etcdbrImageKey, _ := getEtcdImageKeys() return chooseImage(etcdbrImageKey, nil, iv) } diff --git a/internal/utils/image_test.go b/internal/utils/image_test.go index 641afb564..ad2cde941 100644 --- a/internal/utils/image_test.go +++ b/internal/utils/image_test.go @@ -20,12 +20,11 @@ func TestGetEtcdImages(t *testing.T) { name string run func(g *WithT, etcd *druidv1alpha1.Etcd) }{ - {"etcd spec defines etcd and etcdBR images", testWithEtcdAndEtcdBRImages}, - {"etcd spec has no image defined and image vector has etcd and etcdBR images set", testWithNoImageInSpecAndIVWithEtcdAndBRImages}, - {"", testSpecWithEtcdBRImageAndIVWithEtcdImage}, + {"etcd spec defines etcd and etcdBR images", testWithEtcdWrapperAndEtcdBRImagesInSpec}, + {"etcd spec has no image defined and image vector has etcd and etcdBR images set", testWithNoImageInSpecAndIVWithEtcdWrapperAndBRImages}, + {"", testSpecWithEtcdBRImageAndIVWithEtcdWrapperImage}, {"", testSpecAndIVWithoutEtcdBRImage}, {"", testWithSpecAndIVNotHavingAnyImages}, - {"", testWithNoImagesInSpecAndIVWithAllImagesWithWrapper}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -36,9 +35,9 @@ func TestGetEtcdImages(t *testing.T) { } } -func testWithEtcdAndEtcdBRImages(g *WithT, etcd *druidv1alpha1.Etcd) { - iv := testutils.CreateImageVector(true, true, false, false) - etcdImg, etcdBRImg, initContainerImg, err := GetEtcdImages(etcd, iv, false) +func testWithEtcdWrapperAndEtcdBRImagesInSpec(g *WithT, etcd *druidv1alpha1.Etcd) { + iv := testutils.CreateImageVector(false, false) + etcdImg, etcdBRImg, initContainerImg, err := GetEtcdImages(etcd, iv) g.Expect(err).To(BeNil()) g.Expect(etcdImg).ToNot(BeEmpty()) g.Expect(etcdImg).To(Equal(*etcd.Spec.Etcd.Image)) @@ -49,14 +48,14 @@ func testWithEtcdAndEtcdBRImages(g *WithT, etcd *druidv1alpha1.Etcd) { g.Expect(initContainerImg).To(Equal(vectorInitContainerImage.String())) } -func testWithNoImageInSpecAndIVWithEtcdAndBRImages(g *WithT, etcd *druidv1alpha1.Etcd) { +func testWithNoImageInSpecAndIVWithEtcdWrapperAndBRImages(g *WithT, etcd *druidv1alpha1.Etcd) { etcd.Spec.Etcd.Image = nil etcd.Spec.Backup.Image = nil - iv := testutils.CreateImageVector(true, true, false, false) - etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv, false) + iv := testutils.CreateImageVector(true, true) + etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv) g.Expect(err).To(BeNil()) g.Expect(etcdImage).ToNot(BeEmpty()) - vectorEtcdImage, err := iv.FindImage(common.ImageKeyEtcd) + vectorEtcdImage, err := iv.FindImage(common.ImageKeyEtcdWrapper) g.Expect(err).To(BeNil()) g.Expect(etcdImage).To(Equal(vectorEtcdImage.String())) g.Expect(etcdBackupRestoreImage).ToNot(BeNil()) @@ -68,13 +67,13 @@ func testWithNoImageInSpecAndIVWithEtcdAndBRImages(g *WithT, etcd *druidv1alpha1 g.Expect(initContainerImage).To(Equal(vectorInitContainerImage.String())) } -func testSpecWithEtcdBRImageAndIVWithEtcdImage(g *WithT, etcd *druidv1alpha1.Etcd) { +func testSpecWithEtcdBRImageAndIVWithEtcdWrapperImage(g *WithT, etcd *druidv1alpha1.Etcd) { etcd.Spec.Etcd.Image = nil - iv := testutils.CreateImageVector(true, false, false, false) - etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv, false) + iv := testutils.CreateImageVector(true, false) + etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv) g.Expect(err).To(BeNil()) g.Expect(etcdImage).ToNot(BeEmpty()) - vectorEtcdImage, err := iv.FindImage(common.ImageKeyEtcd) + vectorEtcdImage, err := iv.FindImage(common.ImageKeyEtcdWrapper) g.Expect(err).To(BeNil()) g.Expect(etcdImage).To(Equal(vectorEtcdImage.String())) g.Expect(etcdBackupRestoreImage).ToNot(BeNil()) @@ -86,8 +85,8 @@ func testSpecWithEtcdBRImageAndIVWithEtcdImage(g *WithT, etcd *druidv1alpha1.Etc func testSpecAndIVWithoutEtcdBRImage(g *WithT, etcd *druidv1alpha1.Etcd) { etcd.Spec.Backup.Image = nil - iv := testutils.CreateImageVector(true, false, false, false) - etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv, false) + iv := testutils.CreateImageVector(true, false) + etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv) g.Expect(err).ToNot(BeNil()) g.Expect(etcdImage).To(BeEmpty()) g.Expect(etcdBackupRestoreImage).To(BeEmpty()) @@ -96,29 +95,10 @@ func testSpecAndIVWithoutEtcdBRImage(g *WithT, etcd *druidv1alpha1.Etcd) { func testWithSpecAndIVNotHavingAnyImages(g *WithT, etcd *druidv1alpha1.Etcd) { etcd.Spec.Backup.Image = nil - iv := testutils.CreateImageVector(false, false, false, false) - etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv, false) + iv := testutils.CreateImageVector(false, false) + etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv) g.Expect(err).ToNot(BeNil()) g.Expect(etcdImage).To(BeEmpty()) g.Expect(etcdBackupRestoreImage).To(BeEmpty()) g.Expect(initContainerImage).To(BeEmpty()) } - -func testWithNoImagesInSpecAndIVWithAllImagesWithWrapper(g *WithT, etcd *druidv1alpha1.Etcd) { - etcd.Spec.Etcd.Image = nil - etcd.Spec.Backup.Image = nil - iv := testutils.CreateImageVector(true, true, true, true) - etcdImage, etcdBackupRestoreImage, initContainerImage, err := GetEtcdImages(etcd, iv, true) - g.Expect(err).To(BeNil()) - g.Expect(etcdImage).ToNot(BeEmpty()) - vectorEtcdImage, err := iv.FindImage(common.ImageKeyEtcdWrapper) - g.Expect(err).To(BeNil()) - g.Expect(etcdImage).To(Equal(vectorEtcdImage.String())) - g.Expect(etcdBackupRestoreImage).ToNot(BeEmpty()) - vectorBackupRestoreImage, err := iv.FindImage(common.ImageKeyEtcdBackupRestoreDistroless) - g.Expect(err).To(BeNil()) - g.Expect(etcdBackupRestoreImage).To(Equal(vectorBackupRestoreImage.String())) - vectorInitContainerImage, err := iv.FindImage(common.ImageKeyAlpine) - g.Expect(err).To(BeNil()) - g.Expect(initContainerImage).To(Equal(vectorInitContainerImage.String())) -} diff --git a/skaffold.yaml b/skaffold.yaml index c834d1879..e3e1d8924 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -62,14 +62,6 @@ profiles: value: etcdcomponents: enabled: true - - name: do-not-use-feature-gates - activation: - - env: "USE_ETCD_DRUID_FEATURE_GATES=false" - patches: - - op: add - path: /deploy/helm/releases/0/setValues/featureGates - value: - UseEtcdWrapper: false --- apiVersion: skaffold/v4beta10 kind: Config diff --git a/test/it/controller/etcd/helper.go b/test/it/controller/etcd/helper.go index f519b669e..6a6ec0356 100644 --- a/test/it/controller/etcd/helper.go +++ b/test/it/controller/etcd/helper.go @@ -13,7 +13,6 @@ import ( druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1" "github.com/gardener/etcd-druid/internal/controller/etcd" - "github.com/gardener/etcd-druid/internal/features" "github.com/gardener/etcd-druid/internal/utils" "github.com/gardener/etcd-druid/test/it/controller/assets" "github.com/gardener/etcd-druid/test/it/setup" @@ -54,9 +53,7 @@ func initializeEtcdReconcilerTestEnv(t *testing.T, itTestEnv setup.DruidTestEnvi EnableEtcdSpecAutoReconcile: autoReconcile, DisableEtcdServiceAccountAutomount: false, EtcdStatusSyncPeriod: 2 * time.Second, - FeatureGates: map[featuregate.Feature]bool{ - features.UseEtcdWrapper: true, - }, + FeatureGates: map[featuregate.Feature]bool{}, EtcdMember: etcd.MemberConfig{ NotReadyThreshold: 5 * time.Minute, UnknownThreshold: 1 * time.Minute, diff --git a/test/utils/constants.go b/test/utils/constants.go index 6a300ec64..6f859daf3 100644 --- a/test/utils/constants.go +++ b/test/utils/constants.go @@ -14,14 +14,10 @@ const ( const ( // TestImageRepo is a constant for image repository name TestImageRepo = "test-repo" - // ETCDImageSourceTag is the ImageSource tag for etcd image. - ETCDImageSourceTag = "etcd-test-tag" // ETCDWrapperImageTag is the ImageSource tag for etcd-wrapper image. ETCDWrapperImageTag = "etcd-wrapper-test-tag" // ETCDBRImageTag is the ImageSource tag for etcd-backup-restore image. ETCDBRImageTag = "backup-restore-test-tag" - // ETCDBRDistrolessImageTag is the ImageSource tag for etc-backup-restore distroless image. - ETCDBRDistrolessImageTag = "backup-restore-distroless-test-tag" // InitContainerTag is the ImageSource tag for the init container image. InitContainerTag = "init-container-test-tag" ) diff --git a/test/utils/imagevector.go b/test/utils/imagevector.go index c49192deb..668880086 100644 --- a/test/utils/imagevector.go +++ b/test/utils/imagevector.go @@ -12,13 +12,13 @@ import ( ) // CreateImageVector creates an image vector initializing it will different image sources. -func CreateImageVector(withEtcdImage, withBackupRestoreImage, withEtcdWrapperImage, withBackupRestoreDistrolessImage bool) imagevector.ImageVector { +func CreateImageVector(withEtcdWrapperImage, withBackupRestoreImage bool) imagevector.ImageVector { var imageSources []*imagevector.ImageSource - if withEtcdImage { + if withEtcdWrapperImage { imageSources = append(imageSources, &imagevector.ImageSource{ - Name: common.ImageKeyEtcd, + Name: common.ImageKeyEtcdWrapper, Repository: TestImageRepo, - Tag: ptr.To(ETCDImageSourceTag), + Tag: ptr.To(ETCDWrapperImageTag), }) } if withBackupRestoreImage { @@ -29,20 +29,6 @@ func CreateImageVector(withEtcdImage, withBackupRestoreImage, withEtcdWrapperIma }) } - if withEtcdWrapperImage { - imageSources = append(imageSources, &imagevector.ImageSource{ - Name: common.ImageKeyEtcdWrapper, - Repository: TestImageRepo, - Tag: ptr.To(ETCDWrapperImageTag), - }) - } - if withBackupRestoreDistrolessImage { - imageSources = append(imageSources, &imagevector.ImageSource{ - Name: common.ImageKeyEtcdBackupRestoreDistroless, - Repository: TestImageRepo, - Tag: ptr.To(ETCDBRDistrolessImageTag), - }) - } imageSources = append(imageSources, &imagevector.ImageSource{ Name: common.ImageKeyAlpine, Repository: TestImageRepo,