Skip to content

Commit

Permalink
Change response for pod with user in no class to 200
Browse files Browse the repository at this point in the history
This fixes the issue where the webhook returns a 400 response in the case where the
pods user doesn't belong to any class. This caused issues for deployments trying to
start up pods but being unable to because of the error response from the webhook.

Signed-off-by: Isaiah Stapleton <[email protected]>
  • Loading branch information
IsaiahStapleton committed Sep 19, 2024
1 parent 02b05c5 commit 3630af2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion container-images/assign-class-label/mutate.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def mutate_pod() -> Response:
)
).model_dump()
),
400,
200,
{'content-type': 'application/json'},
)

Expand Down
8 changes: 4 additions & 4 deletions container-images/assign-class-label/tests/test_mutate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_request_no_metadata(client):
},
)

assert res.status_code == 400
assert res.status_code == 200
assert res.json == {
'apiVersion': 'admission.k8s.io/v1',
'kind': 'AdmissionReview',
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_no_user(client):
},
)

assert res.status_code == 400
assert res.status_code == 200
assert res.json == {
'apiVersion': 'admission.k8s.io/v1',
'kind': 'AdmissionReview',
Expand All @@ -195,7 +195,7 @@ def test_no_user(client):
},
)

assert res.status_code == 400
assert res.status_code == 200
assert res.json == {
'apiVersion': 'admission.k8s.io/v1',
'kind': 'AdmissionReview',
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_empty_group_members(client):
},
)

assert res.status_code == 400
assert res.status_code == 200
assert res.json == {
'apiVersion': 'admission.k8s.io/v1',
'kind': 'AdmissionReview',
Expand Down

0 comments on commit 3630af2

Please sign in to comment.