Skip to content

Commit

Permalink
fix: use admission webhook namespace if pod namespace is empty (#503)
Browse files Browse the repository at this point in the history
Signed-off-by: Leopold Jacquot <leopold.jacquot@infomaniak.com>
  • Loading branch information
L3o-pold authored Jul 28, 2023
1 parent 27a7efd commit ffd3e0a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions webhooks/pod_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (m *PodMutator) Handle(ctx context.Context, req admission.Request) admissio
}()
pod := &corev1.Pod{}
err := m.decoder.Decode(req, pod)

if pod.Namespace == "" {
pod.Namespace = req.Namespace
}

if err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
Expand Down

0 comments on commit ffd3e0a

Please sign in to comment.