Skip to content

Commit

Permalink
fix meta accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Feb 26, 2021
1 parent d4bfb2f commit cbc6bb2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/kube/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ func NewGenericWorkloadFromPod(podResource kubeAPICoreV1.Pod, originalObject int
workload.OriginalObjectJSON = bytes

var unst unstructured.Unstructured
json.Unmarshal(bytes, &unst)

objMeta, err := meta.Accessor(unst)
err = json.Unmarshal(bytes, &unst.Object)
if err != nil {
logrus.Error("Couldn't marshal JSON for pod ", err)
return workload, err
}
objMeta, err := meta.Accessor(&unst)
if err != nil {
logrus.Error("Couldn't create meta accessor for unstructred ", err)
return workload, err
}
workload.ObjectMeta = objMeta
Expand Down

0 comments on commit cbc6bb2

Please sign in to comment.