Merge pull request #17214 from justinsb/reconcile_dryrun_should_be_an_update

reconcile: if --yes is not provided, print the same output as `update cluster` does
This commit is contained in:
Kubernetes Prow Robot 2025-01-15 04:20:33 -08:00 committed by GitHub
commit 961a786b65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -116,13 +116,19 @@ func NewCmdReconcileCluster(f *util.Factory, out io.Writer) *cobra.Command {
// "update" is probably now smart enough to automatically not update the control plane if it is already at the desired version,
// but we do it explicitly here to be clearer / safer.
func RunReconcileCluster(ctx context.Context, f *util.Factory, out io.Writer, c *CoreUpdateClusterOptions) error {
if !c.Yes {
return fmt.Errorf("reconcile is only supported with --yes")
}
if c.Target == cloudup.TargetTerraform {
return fmt.Errorf("reconcile is not supported with terraform")
}
if !c.Yes {
// A reconcile without --yes is the same as a dry run
opt := *c
if _, err := RunCoreUpdateCluster(ctx, f, out, &opt); err != nil {
return err
}
return nil
}
fmt.Fprintf(out, "Updating control plane configuration\n")
{
opt := *c