From ab1759502ce6599e70b6a20fdb7a9c1c07b032c7 Mon Sep 17 00:00:00 2001 From: xiehui <615810790@qq.com> Date: Mon, 21 Mar 2022 20:45:53 +0800 Subject: [PATCH] sidecarset forbid updating of sidecar container name Signed-off-by: xiehui <615810790@qq.com> --- .../sidecarset/validating/sidecarset_create_update_handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/webhook/sidecarset/validating/sidecarset_create_update_handler.go b/pkg/webhook/sidecarset/validating/sidecarset_create_update_handler.go index 979118cbcb..ec3a9e0b4e 100644 --- a/pkg/webhook/sidecarset/validating/sidecarset_create_update_handler.go +++ b/pkg/webhook/sidecarset/validating/sidecarset_create_update_handler.go @@ -249,6 +249,9 @@ func validateSidecarContainerConflict(newContainers, oldContainers []appsv1alpha allErrs = append(allErrs, field.Invalid(fldPath.Child("upgradeStrategy").Child("upgradeType"), container.Name, fmt.Sprintf("container %v upgradeType is immutable", container.Name))) } + } else { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), + container.Name, fmt.Sprintf("container %v is not found", container.Name))) } }