mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Only set admission review reponse patch type if the patch is not empty
This commit is contained in:
parent
2a17cfbd45
commit
6acc75b418
@ -97,8 +97,10 @@ func mutateConfigmaps(ar v1.AdmissionReview) *v1.AdmissionResponse {
|
||||
reviewResponse.Patch = []byte(configMapPatch2)
|
||||
}
|
||||
|
||||
pt := v1.PatchTypeJSONPatch
|
||||
reviewResponse.PatchType = &pt
|
||||
if len(reviewResponse.Patch) != 0 {
|
||||
pt := v1.PatchTypeJSONPatch
|
||||
reviewResponse.PatchType = &pt
|
||||
}
|
||||
|
||||
return &reviewResponse
|
||||
}
|
||||
|
@ -56,8 +56,10 @@ func mutateCustomResource(ar v1.AdmissionReview) *v1.AdmissionResponse {
|
||||
if cr.Data["mutation-stage-1"] == "yes" {
|
||||
reviewResponse.Patch = []byte(customResourcePatch2)
|
||||
}
|
||||
pt := v1.PatchTypeJSONPatch
|
||||
reviewResponse.PatchType = &pt
|
||||
if len(reviewResponse.Patch) != 0 {
|
||||
pt := v1.PatchTypeJSONPatch
|
||||
reviewResponse.PatchType = &pt
|
||||
}
|
||||
return &reviewResponse
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user