Skip to content

Commit

Permalink
Merge pull request #6 from dormullor/main
Browse files Browse the repository at this point in the history
Fix Instance group equality check
  • Loading branch information
dorroddorrod authored Nov 10, 2022
2 parents de6bc22 + 666a089 commit 0060ed1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 2m
deadline: 5m

skip-files:
- "zz_generated\\..+\\.go$"
Expand Down
15 changes: 7 additions & 8 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,18 @@ func ClusterResourceUpToDate(old, new *kopsapi.ClusterSpec) bool {

// InstanceGroupListResourceUpToDate checks if the instance group list resource is up to date
func InstanceGroupListResourceUpToDate(old []kopsapi.InstanceGroupSpec, new *kopsapi.InstanceGroupList) bool {
for index := range old {
if !InstanceGroupResourceUpToDate(&old[index], &new.Items[index].Spec) {
return false
for _, oldInstance := range old {
for _, newInstance := range new.Items {
if oldInstance.NodeLabels["kops.k8s.io/instancegroup"] == newInstance.Spec.NodeLabels["kops.k8s.io/instancegroup"] {
if !reflect.DeepEqual(oldInstance, newInstance.Spec) {
return false
}
}
}
}
return true
}

// InstanceGroupResourceUpToDate checks if the instance group resource is up to date
func InstanceGroupResourceUpToDate(old, new *kopsapi.InstanceGroupSpec) bool {
return reflect.DeepEqual(old, new)
}

// GetClusterStatus returns the cluster status
func GetClusterStatus(kopsCluster *kopsapi.Cluster, cloud fi.Cloud) (*kopsapi.ClusterStatus, error) {
status, err := cloud.FindClusterStatus(kopsCluster)
Expand Down

0 comments on commit 0060ed1

Please sign in to comment.