Skip to content

Commit

Permalink
Merge pull request #966 from k8s-infra-cherrypick-robot/cherry-pick-9…
Browse files Browse the repository at this point in the history
…54-to-release-0.5

[release-0.5] Fix loading resource checked status when created
  • Loading branch information
k8s-ci-robot authored Feb 6, 2024
2 parents 53f06c7 + 26d626f commit 5f42d01
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/kwokctl/snapshot/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,19 @@ func (l *Loader) apply(ctx context.Context, obj *unstructured.Unstructured) *uns
return nil
}
logger.Debug("Updated")
} else {
logger.Debug("Created")
}

if newObj != nil {
status, ok, _ := unstructured.NestedFieldNoCopy(obj.Object, "status")
if ok && !reflect.DeepEqual(newObj.Object["status"], status) {
newObj.Object["status"] = status
newObj, err = ri.UpdateStatus(ctx, newObj, metav1.UpdateOptions{FieldValidation: "Ignore"})
if err != nil {
logger.Error("Failed to update status", err)
if newObj != nil {
status, ok, _ := unstructured.NestedFieldNoCopy(obj.Object, "status")
if ok && !reflect.DeepEqual(newObj.Object["status"], status) {
newObj.Object["status"] = status
newObj, err = ri.UpdateStatus(ctx, newObj, metav1.UpdateOptions{FieldValidation: "Ignore"})
if err != nil {
logger.Error("Failed to update resource status", err)
}
}
}
} else {
logger.Debug("Created")
}

l.successCounter++
Expand Down

0 comments on commit 5f42d01

Please sign in to comment.