Skip to content

Commit

Permalink
Return nil when observedState is not found in status
Browse files Browse the repository at this point in the history
  • Loading branch information
maqiuyujoyce committed Mar 26, 2024
1 parent 906af1c commit 78a6fa7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/krmtotf/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ func (r *Resource) AllTopLevelFieldsAreImmutableOrComputed() bool {
}

func getObservedStateFromStatus(status map[string]interface{}) map[string]interface{} {
observedState, exists, _ := unstructured.NestedMap(status, k8s.ObservedStateFieldName)
if !exists {
observedState = make(map[string]interface{})
}
observedState, _, _ := unstructured.NestedMap(status, k8s.ObservedStateFieldName)
return observedState
}

Expand Down

0 comments on commit 78a6fa7

Please sign in to comment.