From 9b1e6ef85ed2893d0c8f4feab2a34db13306a4d8 Mon Sep 17 00:00:00 2001 From: "wangchongyang.yangtuo" Date: Mon, 21 Mar 2022 11:06:04 +0800 Subject: [PATCH] fix:add volumes used by initContainers Signed-off-by: wangchongyang.yangtuo --- pkg/webhook/pod/mutating/sidecarset.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/webhook/pod/mutating/sidecarset.go b/pkg/webhook/pod/mutating/sidecarset.go index 284e867529..fcce25ec8f 100644 --- a/pkg/webhook/pod/mutating/sidecarset.go +++ b/pkg/webhook/pod/mutating/sidecarset.go @@ -261,6 +261,10 @@ func buildSidecars(isUpdated bool, pod *corev1.Pod, oldPod *corev1.Pod, matchedS transferEnvs := sidecarcontrol.GetSidecarTransferEnvs(initContainer, pod) initContainer.Env = append(initContainer.Env, transferEnvs...) sidecarInitContainers = append(sidecarInitContainers, initContainer) + // insert volumes that initContainers used + for _, mount := range initContainer.VolumeMounts { + volumesInSidecars = append(volumesInSidecars, *volumesMap[mount.Name]) + } } //process imagePullSecrets