mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #87781 from caesarxuchao/fix-webhook-image-bugs
Only set admission review reponse patch type if the patch is not empty
This commit is contained in:
commit
8f5e8279f6
@ -97,8 +97,10 @@ func mutateConfigmaps(ar v1.AdmissionReview) *v1.AdmissionResponse {
|
|||||||
reviewResponse.Patch = []byte(configMapPatch2)
|
reviewResponse.Patch = []byte(configMapPatch2)
|
||||||
}
|
}
|
||||||
|
|
||||||
pt := v1.PatchTypeJSONPatch
|
if len(reviewResponse.Patch) != 0 {
|
||||||
reviewResponse.PatchType = &pt
|
pt := v1.PatchTypeJSONPatch
|
||||||
|
reviewResponse.PatchType = &pt
|
||||||
|
}
|
||||||
|
|
||||||
return &reviewResponse
|
return &reviewResponse
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,10 @@ func mutateCustomResource(ar v1.AdmissionReview) *v1.AdmissionResponse {
|
|||||||
if cr.Data["mutation-stage-1"] == "yes" {
|
if cr.Data["mutation-stage-1"] == "yes" {
|
||||||
reviewResponse.Patch = []byte(customResourcePatch2)
|
reviewResponse.Patch = []byte(customResourcePatch2)
|
||||||
}
|
}
|
||||||
pt := v1.PatchTypeJSONPatch
|
if len(reviewResponse.Patch) != 0 {
|
||||||
reviewResponse.PatchType = &pt
|
pt := v1.PatchTypeJSONPatch
|
||||||
|
reviewResponse.PatchType = &pt
|
||||||
|
}
|
||||||
return &reviewResponse
|
return &reviewResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user