Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.5] 🐛 Skip checking clusterConfiguration.dns fields when KCP checking MachineNeedRollout #10304

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
4 changes: 4 additions & 0 deletions controlplane/kubeadm/internal/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ func matchClusterConfiguration(kcp *controlplanev1.KubeadmControlPlane, machine
if machineClusterConfig == nil {
machineClusterConfig = &bootstrapv1.ClusterConfiguration{}
}

kcpLocalClusterConfiguration := kcp.Spec.KubeadmConfigSpec.ClusterConfiguration
if kcpLocalClusterConfiguration == nil {
kcpLocalClusterConfiguration = &bootstrapv1.ClusterConfiguration{}
}

// Skip checking DNS fields because we can update the configuration of the working cluster in place.
machineClusterConfig.DNS = kcpLocalClusterConfiguration.DNS

// Compare and return.
return reflect.DeepEqual(machineClusterConfig, kcpLocalClusterConfiguration)
}
Expand Down
25 changes: 25 additions & 0 deletions controlplane/kubeadm/internal/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ func TestMatchClusterConfiguration(t *testing.T) {
}
g.Expect(matchClusterConfiguration(kcp, m)).To(BeTrue())
})
t.Run("Return true although the DNS fields are different", func(t *testing.T) {
g := NewWithT(t)
kcp := &controlplanev1.KubeadmControlPlane{
Spec: controlplanev1.KubeadmControlPlaneSpec{
KubeadmConfigSpec: bootstrapv1.KubeadmConfigSpec{
ClusterConfiguration: &bootstrapv1.ClusterConfiguration{
DNS: bootstrapv1.DNS{
ImageMeta: bootstrapv1.ImageMeta{
ImageTag: "v1.10.1",
ImageRepository: "gcr.io/capi-test",
},
},
},
},
},
}
m := &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
controlplanev1.KubeadmClusterConfigurationAnnotation: "{\"dns\":{\"imageRepository\":\"gcr.io/capi-test\",\"imageTag\":\"v1.9.3\"}}",
},
},
}
g.Expect(matchClusterConfiguration(kcp, m)).To(BeTrue())
})
}

func TestGetAdjustedKcpConfig(t *testing.T) {
Expand Down
Loading