Skip to content

Commit

Permalink
log error if get lables and annotations failed (koderover#2537)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zhao <[email protected]>
  • Loading branch information
PetrusZ authored Apr 19, 2023
1 parent 9c505d9 commit 098113c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/microservice/aslan/core/common/service/kube/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ func CreateOrPatchResource(applyParam *ResourceApplyParam, log *zap.SugaredLogge

podLabels, _, err := unstructured.NestedStringMap(u.Object, "spec", "template", "metadata", "labels")
if err != nil {
log.Errorf("get pod labels failed err: %v", err)
podLabels = nil
}
err = unstructured.SetNestedStringMap(u.Object, MergeLabels(labels, podLabels), "spec", "template", "metadata", "labels")
Expand All @@ -316,6 +317,7 @@ func CreateOrPatchResource(applyParam *ResourceApplyParam, log *zap.SugaredLogge

podAnnotations, _, err := unstructured.NestedStringMap(u.Object, "spec", "template", "metadata", "annotations")
if err != nil {
log.Errorf("get pod annotations failed err: %v", err)
podAnnotations = nil
}
err = unstructured.SetNestedStringMap(u.Object, ApplyUpdatedAnnotations(podAnnotations), "spec", "template", "metadata", "annotations")
Expand Down

0 comments on commit 098113c

Please sign in to comment.