From 035b03d64c23cb8d4bd55ae2c118f823d54294b9 Mon Sep 17 00:00:00 2001 From: Lester Guerzon Date: Mon, 6 Nov 2023 22:13:08 +0800 Subject: [PATCH] feat: write log when marking InstanceGroup as needs update Signed-off-by: Lester Guerzon --- pkg/cloudinstances/cloud_instance_group.go | 1 + upup/pkg/fi/cloudup/awsup/aws_cloud.go | 2 ++ upup/pkg/fi/cloudup/gce/instancegroups.go | 2 ++ upup/pkg/fi/cloudup/hetzner/cloud.go | 1 + upup/pkg/fi/cloudup/openstack/server_group.go | 1 + upup/pkg/fi/cloudup/scaleway/cloud.go | 1 + 6 files changed, 8 insertions(+) diff --git a/pkg/cloudinstances/cloud_instance_group.go b/pkg/cloudinstances/cloud_instance_group.go index 5b1271d059f97..fd5f82d2b8fc4 100644 --- a/pkg/cloudinstances/cloud_instance_group.go +++ b/pkg/cloudinstances/cloud_instance_group.go @@ -88,6 +88,7 @@ func (group *CloudInstanceGroup) AdjustNeedUpdate() { if makeNotReady { group.NeedUpdate = append(group.NeedUpdate, member) member.Status = CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s node %s has needs-update annotation\n", group.HumanName, member.Node.Name) } else { newReady = append(newReady, member) } diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index 9d49bcd25bd16..d3338bfeb376c 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -970,6 +970,7 @@ func buildKarpenterGroup(c AWSCloud, cluster *kops.Cluster, ig *kops.InstanceGro status = cloudinstances.CloudInstanceStatusUpToDate } else { status = cloudinstances.CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s node %s launch configuration is behind\n", karpenterGroup.HumanName, id) } cloudInstance, _ := karpenterGroup.NewCloudInstance(id, status, nodeMap[id]) addCloudInstanceData(cloudInstance, instance) @@ -1256,6 +1257,7 @@ func buildCloudInstance(i *autoscaling.Instance, instances map[string]*ec2.Insta status := cloudinstances.CloudInstanceStatusUpToDate if newConfigName != currentConfigName { status = cloudinstances.CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s node %s launch configuration is behind\n", cg.HumanName, id) } cm, err := cg.NewCloudInstance(id, status, nodeMap[id]) if err != nil { diff --git a/upup/pkg/fi/cloudup/gce/instancegroups.go b/upup/pkg/fi/cloudup/gce/instancegroups.go index f140b4345d698..d3a1322412b8a 100644 --- a/upup/pkg/fi/cloudup/gce/instancegroups.go +++ b/upup/pkg/fi/cloudup/gce/instancegroups.go @@ -189,8 +189,10 @@ func getCloudGroups(c GCECloud, cluster *kops.Cluster, instancegroups []*kops.In if i.Version != nil && latestInstanceTemplate == i.Version.InstanceTemplate { g.Ready = append(g.Ready, cm) + fmt.Printf("InstanceGroup %s nodes launch templates are NOT behind\n", cm.CloudInstanceGroup.HumanName) } else { g.NeedUpdate = append(g.NeedUpdate, cm) + fmt.Printf("InstanceGroup %s nodes launch templates are behind\n", cm.CloudInstanceGroup.HumanName) } } diff --git a/upup/pkg/fi/cloudup/hetzner/cloud.go b/upup/pkg/fi/cloudup/hetzner/cloud.go index ec6e5d67a9492..629ddeba3ac1e 100644 --- a/upup/pkg/fi/cloudup/hetzner/cloud.go +++ b/upup/pkg/fi/cloudup/hetzner/cloud.go @@ -371,6 +371,7 @@ func buildCloudInstanceGroup(ig *kops.InstanceGroup, sg []*hcloud.Server, nodeMa status := cloudinstances.CloudInstanceStatusUpToDate if _, ok := server.Labels[TagKubernetesInstanceNeedsUpdate]; ok { status = cloudinstances.CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s node %s has %s label\n", cloudInstanceGroup.HumanName, server.Name, server.Labels[TagKubernetesInstanceNeedsUpdate]) } id := strconv.Itoa(server.ID) diff --git a/upup/pkg/fi/cloudup/openstack/server_group.go b/upup/pkg/fi/cloudup/openstack/server_group.go index ab27670e8020c..260f9c79d2ef9 100644 --- a/upup/pkg/fi/cloudup/openstack/server_group.go +++ b/upup/pkg/fi/cloudup/openstack/server_group.go @@ -113,6 +113,7 @@ func osBuildCloudInstanceGroup(c OpenstackCloud, cluster *kops.Cluster, ig *kops status := cloudinstances.CloudInstanceStatusUpToDate if generationName != observedName || instance.Status == errorStatus { status = cloudinstances.CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s instance %s generationName and observedName mismatch or instance in error\n", cg.HumanName, instance.ID) } cm, err := cg.NewCloudInstance(instance.ID, status, nodeMap[instance.ID]) if err != nil { diff --git a/upup/pkg/fi/cloudup/scaleway/cloud.go b/upup/pkg/fi/cloudup/scaleway/cloud.go index 092734df43809..2a355f5d8e348 100644 --- a/upup/pkg/fi/cloudup/scaleway/cloud.go +++ b/upup/pkg/fi/cloudup/scaleway/cloud.go @@ -398,6 +398,7 @@ func buildCloudGroup(s *scwCloudImplementation, ig *kops.InstanceGroup, sg []*in for _, tag := range server.Tags { if tag == TagNeedsUpdate { status = cloudinstances.CloudInstanceStatusNeedsUpdate + fmt.Printf("InstanceGroup %s node %s has tag %s\n", cloudInstanceGroup.HumanName, server.Name, tag) } } cloudInstance, err := cloudInstanceGroup.NewCloudInstance(server.ID, status, nodeMap[server.ID])