Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes-sigs/cluster-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b5a33bc532e6e63aa651e4f0dfc73c1b6189565f
Choose a base ref
..
head repository: kubernetes-sigs/cluster-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 822ebcf7a1283162616f76117bd6967f0588f1c3
Choose a head ref
Showing with 6 additions and 6 deletions.
  1. +4 −4 controlplane/kubeadm/internal/controllers/upgrade.go
  2. +2 −2 controlplane/kubeadm/internal/workload_cluster_test.go
8 changes: 4 additions & 4 deletions controlplane/kubeadm/internal/controllers/upgrade.go
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ func (r *KubeadmControlPlaneReconciler) upgradeControlPlane(
return ctrl.Result{}, errors.Wrap(err, "failed to set cluster-admin ClusterRoleBinding for kubeadm")
}

kubeadmCmMutators := make([]func(*bootstrapv1.ClusterConfiguration, *[]string), 0)
kubeadmCmMutators = append(kubeadmCmMutators, workloadCluster.UpdateKubernetesVersionInKubeadmConfigMap(parsedVersion))
kubeadmCMMutators := make([]func(*bootstrapv1.ClusterConfiguration, *[]string), 0)
kubeadmCMMutators = append(kubeadmCMMutators, workloadCluster.UpdateKubernetesVersionInKubeadmConfigMap(parsedVersion))

if controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration != nil {
// We intentionally only parse major/minor/patch so that the subsequent code
@@ -91,7 +91,7 @@ func (r *KubeadmControlPlaneReconciler) upgradeControlPlane(
meta := controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local.ImageMeta
extraArgs := controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local.ExtraArgs

kubeadmCmMutators = append(kubeadmCmMutators,
kubeadmCMMutators = append(kubeadmCMMutators,
workloadCluster.UpdateImageRepositoryInKubeadmConfigMap(imageRepository),
workloadCluster.UpdateFeatureGatesInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.FeatureGates),
workloadCluster.UpdateEtcdVersionInKubeadmConfigMap(meta.ImageRepository, meta.ImageTag),
@@ -102,7 +102,7 @@ func (r *KubeadmControlPlaneReconciler) upgradeControlPlane(
}

// collectively update Kubeadm config map
if err = workloadCluster.UpdateClusterConfiguration(ctx, parsedVersion, kubeadmCmMutators...); err != nil {
if err = workloadCluster.UpdateClusterConfiguration(ctx, parsedVersion, kubeadmCMMutators...); err != nil {
return ctrl.Result{}, err
}

4 changes: 2 additions & 2 deletions controlplane/kubeadm/internal/workload_cluster_test.go
Original file line number Diff line number Diff line change
@@ -1270,15 +1270,15 @@ func TestUpdateFeatureGatesInKubeadmConfigMap(t *testing.T) {
wantFeatureGates map[string]bool
}{
{
name: "it update feature gates",
name: "it updates feature gates",
clusterConfigurationData: yaml.Raw(`
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration`),
newFeatureGates: map[string]bool{"EtcdLearnerMode": true},
wantFeatureGates: map[string]bool{"EtcdLearnerMode": true},
},
{
name: "it should preserve existing feature gates if then new value is nil",
name: "it should preserve existing feature gates if new value is nil",
clusterConfigurationData: yaml.Raw(`
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration