Skip to content

Commit

Permalink
Reformatting is not what I wanted here
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanemahuta committed Jun 10, 2021
1 parent 3b8e6f5 commit f06754c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/webhook/handler/unmarshal_req_obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ func (u *unmarshalReqObjImpl) deserializeRawExtension(gvk schema.GroupVersionKin
}

func (u *unmarshalReqObjImpl) ensureNamespaceSet(obj runtime.Object, namespace string) {
if metaAcc, ok := obj.(v1.ObjectMetaAccessor); ok && metaAcc.GetObjectMeta() != nil && len(metaAcc.GetObjectMeta().GetNamespace()) == 0 {
metaAcc.GetObjectMeta().SetNamespace(namespace)
metaAcc, ok := obj.(v1.ObjectMetaAccessor)
if !ok {
return
}
objMeta := metaAcc.GetObjectMeta()
if objMeta == nil {
return
}
if len(objMeta.GetNamespace()) > 0 {
return
}
objMeta.SetNamespace(namespace)
}

0 comments on commit f06754c

Please sign in to comment.