Cleanup logging for reconcile cluster

This commit is contained in:
Peter Rifel 2025-02-23 21:04:31 -06:00
parent 3823fe705a
commit 5ac11aa55a
No known key found for this signature in database
4 changed files with 7 additions and 5 deletions

View File

@ -166,7 +166,7 @@ func RunReconcileCluster(ctx context.Context, f *util.Factory, out io.Writer, c
} }
} }
fmt.Fprintf(out, "Doing rolling-update for control plane\n") fmt.Fprintf(out, "Performing rolling-update for control plane\n")
{ {
opt := &RollingUpdateOptions{} opt := &RollingUpdateOptions{}
opt.InitDefaults() opt.InitDefaults()
@ -192,7 +192,7 @@ func RunReconcileCluster(ctx context.Context, f *util.Factory, out io.Writer, c
} }
} }
fmt.Fprintf(out, "Doing rolling-update for nodes\n") fmt.Fprintf(out, "Performing rolling-update for nodes\n")
{ {
opt := &RollingUpdateOptions{} opt := &RollingUpdateOptions{}
opt.InitDefaults() opt.InitDefaults()

View File

@ -285,7 +285,6 @@ func RunRollingUpdateCluster(ctx context.Context, f *util.Factory, out io.Writer
countByRole[instanceGroup.Spec.Role] = countByRole[instanceGroup.Spec.Role] + minSize countByRole[instanceGroup.Spec.Role] = countByRole[instanceGroup.Spec.Role] + minSize
} }
if countByRole[kopsapi.InstanceGroupRoleAPIServer]+countByRole[kopsapi.InstanceGroupRoleControlPlane] <= 1 { if countByRole[kopsapi.InstanceGroupRoleAPIServer]+countByRole[kopsapi.InstanceGroupRoleControlPlane] <= 1 {
fmt.Fprintf(out, "Detected single-control-plane cluster; won't detach before draining\n")
options.DeregisterControlPlaneNodes = false options.DeregisterControlPlaneNodes = false
} }

View File

@ -478,7 +478,7 @@ func RunUpdateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Up
fmt.Fprintf(sb, "\n") fmt.Fprintf(sb, "\n")
} }
if !firstRun { if !firstRun && !c.Reconcile {
// TODO: Detect if rolling-update is needed // TODO: Detect if rolling-update is needed
fmt.Fprintf(sb, "\n") fmt.Fprintf(sb, "\n")
fmt.Fprintf(sb, "Changes may require instances to restart: kops rolling-update cluster\n") fmt.Fprintf(sb, "Changes may require instances to restart: kops rolling-update cluster\n")

View File

@ -20,6 +20,8 @@ import (
"context" "context"
stderrors "errors" stderrors "errors"
"fmt" "fmt"
"maps"
"slices"
"sort" "sort"
"sync" "sync"
"time" "time"
@ -230,7 +232,8 @@ func (c *RollingUpdateCluster) RollingUpdate(ctx context.Context, groups map[str
} }
} }
klog.Infof("Rolling update completed for cluster %q!", c.ClusterName) igNames := slices.Sorted(maps.Keys(groups))
klog.Infof("Completed rolling update for cluster %q instance groups %v", c.ClusterName, igNames)
return errors.NewAggregate(errs) return errors.NewAggregate(errs)
} }