Skip to content

Commit

Permalink
fix: use webhook namespace if pod namespace is empty
Browse files Browse the repository at this point in the history
Signed-off-by: Leopold Jacquot <[email protected]>
  • Loading branch information
L3o-pold committed Jul 26, 2023
1 parent 244a625 commit 27a5a40
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 27a5a40

Please sign in to comment.