Skip to content

Commit a12bcda

Browse files
authored
Merge pull request #13030 from sbueringer/pr-repro-rollout-1.11
[release-1.11] 🌱 Avoid KCP rollouts if only ControlPlaneComponentHealthCheckSeconds is changed
2 parents 2e10e39 + 8203bf4 commit a12bcda

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

controlplane/kubeadm/internal/filters.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,26 @@ func matchInitOrJoinConfiguration(machineConfig *bootstrapv1.KubeadmConfig, kcp
316316
}
317317
machineConfig = machineConfig.DeepCopy()
318318

319+
// Cleanup ControlPlaneComponentHealthCheckSeconds from machineConfig,
320+
// because through conversion apiServer.timeoutForControlPlane in v1beta1 is converted to
321+
// initConfiguration/joinConfiguration.timeouts.controlPlaneComponentHealthCheckSeconds in v1beta2 and
322+
// this can lead to a diff here that would lead to a rollout.
323+
// Note: Changes to ControlPlaneComponentHealthCheckSeconds will apply for the next join, but they will not lead to a rollout.
324+
machineConfig.Spec.InitConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = nil
325+
machineConfig.Spec.JoinConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = nil
326+
319327
// takes the KubeadmConfigSpec from KCP and applies the transformations required
320328
// to allow a comparison with the KubeadmConfig referenced from the machine.
321329
kcpConfig := getAdjustedKcpConfig(kcp, machineConfig)
322330

331+
// Cleanup ControlPlaneComponentHealthCheckSeconds from kcpConfig,
332+
// because through conversion apiServer.timeoutForControlPlane in v1beta1 is converted to
333+
// initConfiguration/joinConfiguration.timeouts.controlPlaneComponentHealthCheckSeconds in v1beta2 and
334+
// this can lead to a diff here that would lead to a rollout.
335+
// Note: Changes to ControlPlaneComponentHealthCheckSeconds will apply for the next join, but they will not lead to a rollout.
336+
kcpConfig.InitConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = nil
337+
kcpConfig.JoinConfiguration.Timeouts.ControlPlaneComponentHealthCheckSeconds = nil
338+
323339
// Default both KubeadmConfigSpecs before comparison.
324340
// *Note* This assumes that newly added default values never
325341
// introduce a semantic difference to the unset value.

controlplane/kubeadm/internal/filters_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,11 @@ func TestMatchesKubeadmBootstrapConfig(t *testing.T) {
11271127
KubeadmConfigSpec: bootstrapv1.KubeadmConfigSpec{
11281128
ClusterConfiguration: bootstrapv1.ClusterConfiguration{},
11291129
InitConfiguration: bootstrapv1.InitConfiguration{},
1130-
JoinConfiguration: bootstrapv1.JoinConfiguration{},
1130+
JoinConfiguration: bootstrapv1.JoinConfiguration{
1131+
Timeouts: bootstrapv1.Timeouts{
1132+
ControlPlaneComponentHealthCheckSeconds: ptr.To[int32](1),
1133+
},
1134+
},
11311135
},
11321136
},
11331137
}
@@ -1161,7 +1165,11 @@ func TestMatchesKubeadmBootstrapConfig(t *testing.T) {
11611165
Name: "test",
11621166
},
11631167
Spec: bootstrapv1.KubeadmConfigSpec{
1164-
JoinConfiguration: bootstrapv1.JoinConfiguration{},
1168+
JoinConfiguration: bootstrapv1.JoinConfiguration{
1169+
Timeouts: bootstrapv1.Timeouts{
1170+
ControlPlaneComponentHealthCheckSeconds: ptr.To[int32](2),
1171+
},
1172+
},
11651173
},
11661174
},
11671175
}

test/e2e/data/infrastructure-docker/v1.10/clusterclass-quick-start.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ spec:
554554
apiServer:
555555
extraArgs:
556556
v: "0"
557+
timeoutForControlPlane: 4m
557558
# host.docker.internal is required by kubetest when running on MacOS because of the way ports are proxied.
558559
certSANs: [localhost, host.docker.internal, "::", "::1", "127.0.0.1", "0.0.0.0"]
559560
initConfiguration:

0 commit comments

Comments
 (0)