Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/gardenlet/operation/botanist/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ func (b *Botanist) DefaultEtcd(role string, class etcd.Class) (etcd.Interface, e

// Prefix etcd member names with the seed name so that members can be distinguished across
// control plane migrations between seeds. Self-hosted shoots have no Seed object.
if !b.Shoot.IsSelfHosted() {
// spec.memberNamePrefix requires etcd-druid v0.37+, only available when UpgradeEtcdVersion is enabled.
//
// TODO(acumino): Remove this `UpgradeEtcdVersion` feature gate check once the feature gate is permanently enabled and the feature gate is removed.
// TODO(acumino): Rework this feature gate condition once `UpgradeEtcdVersion` is enabled by default.
if !b.Shoot.IsSelfHosted() &&
b.Config != nil && b.Config.ETCDConfig != nil && b.Config.ETCDConfig.FeatureGates["UpgradeEtcdVersion"] {
values.MemberNamePrefix = b.Seed.GetInfo().Name
}

Expand Down
39 changes: 39 additions & 0 deletions pkg/gardenlet/operation/botanist/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ var _ = Describe("Etcd", func() {
botanist.Shoot = &shootpkg.Shoot{
ControlPlaneNamespace: namespace,
}
botanist.Config = &gardenletconfigv1alpha1.GardenletConfiguration{
ETCDConfig: &gardenletconfigv1alpha1.ETCDConfig{
FeatureGates: map[string]bool{"UpgradeEtcdVersion": true},
},
}
botanist.Seed.SetInfo(&gardencorev1beta1.Seed{ObjectMeta: metav1.ObjectMeta{Name: "test-seed"}})
botanist.Shoot.SetInfo(&gardencorev1beta1.Shoot{
Spec: gardencorev1beta1.ShootSpec{
Expand Down Expand Up @@ -226,6 +231,40 @@ var _ = Describe("Etcd", func() {
})
})

Context("UpgradeEtcdVersion feature gate disabled", func() {
BeforeEach(func() {
botanist.Config.ETCDConfig.FeatureGates["UpgradeEtcdVersion"] = false
validator.expectedMemberNamePrefix = Equal("")
})

It("should not set MemberNamePrefix when UpgradeEtcdVersion is disabled", func() {
oldNewEtcd := NewEtcd
defer func() { NewEtcd = oldNewEtcd }()
NewEtcd = validator.NewEtcd

etcd, err := botanist.DefaultEtcd(role, class)
Expect(etcd).NotTo(BeNil())
Expect(err).NotTo(HaveOccurred())
})
})

Context("UpgradeEtcdVersion feature gate not specified", func() {
BeforeEach(func() {
botanist.Config.ETCDConfig.FeatureGates = nil
validator.expectedMemberNamePrefix = Equal("")
})

It("should not set MemberNamePrefix when FeatureGates is nil", func() {
oldNewEtcd := NewEtcd
defer func() { NewEtcd = oldNewEtcd }()
NewEtcd = validator.NewEtcd

etcd, err := botanist.DefaultEtcd(role, class)
Expect(etcd).NotTo(BeNil())
Expect(err).NotTo(HaveOccurred())
})
})

It("should return an error because the maintenance time window cannot be parsed", func() {
botanist.Shoot.GetInfo().Spec.Maintenance.TimeWindow = &gardencorev1beta1.MaintenanceTimeWindow{
Begin: "foobar",
Expand Down
Loading