Skip to content

Commit ffd3e0a

Browse files
authored
fix: use admission webhook namespace if pod namespace is empty (#503)
Signed-off-by: Leopold Jacquot <[email protected]>
1 parent 27a7efd commit ffd3e0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

webhooks/pod_webhook.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ func (m *PodMutator) Handle(ctx context.Context, req admission.Request) admissio
6565
}()
6666
pod := &corev1.Pod{}
6767
err := m.decoder.Decode(req, pod)
68+
69+
if pod.Namespace == "" {
70+
pod.Namespace = req.Namespace
71+
}
72+
6873
if err != nil {
6974
return admission.Errored(http.StatusBadRequest, err)
7075
}

0 commit comments

Comments
 (0)