Skip to content

Commit

Permalink
don't apply when there are no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
3u13r committed Nov 23, 2023
1 parent eb57753 commit 639b036
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/kubecmd/kubecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (k *KubeCmd) UpgradeNodeVersion(ctx context.Context, conf *config.Config, f
return fmt.Errorf("updating image version: %w", err)
}

// TODO(3u13r): remove `reconcileKubeadmConfigMap` after v2.14.0 has been released.
if err := k.reconcileKubeadmConfigMap(ctx); err != nil {
return fmt.Errorf("reconciling kubeadm config: %w", err)
}
Expand Down Expand Up @@ -422,6 +423,11 @@ func (k *KubeCmd) reconcileKubeadmConfigMap(ctx context.Context) error {
return fmt.Errorf("marshaling ClusterConfiguration: %w", err)
}

if kubeadmConfig.Data[constants.ClusterConfigurationKey] == string(newConfigYAML) {
k.log.Debugf("No changes to kubeadm config required")
return nil
}

kubeadmConfig.Data[constants.ClusterConfigurationKey] = string(newConfigYAML)
k.log.Debugf("Triggering kubeadm config update now")
if _, err = k.kubectl.UpdateConfigMap(ctx, kubeadmConfig); err != nil {
Expand Down

0 comments on commit 639b036

Please sign in to comment.