cli: allow upgrade to succeed if desired attestation config == actual config (#2094)

This commit is contained in:
Malte Poll 2023-07-12 11:53:00 +02:00 committed by GitHub
parent ef404b5839
commit 37af5f5f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -345,9 +345,13 @@ func (u *upgradeApplyCmd) upgradeAttestConfigIfDiff(cmd *cobra.Command, newConfi
return fmt.Errorf("getting cluster attestation config: %w", err) return fmt.Errorf("getting cluster attestation config: %w", err)
} }
// If the current config is equal, or there is an error when comparing the configs, we skip the upgrade. // If the current config is equal, or there is an error when comparing the configs, we skip the upgrade.
if equal, err := newConfig.EqualTo(clusterAttestationConfig); err != nil || equal { equal, err := newConfig.EqualTo(clusterAttestationConfig)
if err != nil {
return fmt.Errorf("comparing attestation configs: %w", err) return fmt.Errorf("comparing attestation configs: %w", err)
} }
if equal {
return nil
}
if !flags.yes { if !flags.yes {
ok, err := askToConfirm(cmd, "You are about to change your cluster's attestation config. Are you sure you want to continue?") ok, err := askToConfirm(cmd, "You are about to change your cluster's attestation config. Are you sure you want to continue?")