Skip to content

Commit

Permalink
fix only initContainers without hash problem (#1453)
Browse files Browse the repository at this point in the history
Signed-off-by: chrisdeng <[email protected]>
Co-authored-by: chrisdeng <[email protected]>
  • Loading branch information
a932846905 and chrisdeng authored Nov 10, 2023
1 parent 0b2fc0e commit 4e80be5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/webhook/pod/mutating/sidecarset.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ func buildSidecars(isUpdated bool, pod *corev1.Pod, oldPod *corev1.Pod, matchedS
SidecarSetName: sidecarSet.Name,
}

isInjecting := false
//process initContainers
//only when created pod, inject initContainer and pullSecrets
if !isUpdated {
Expand All @@ -381,15 +382,14 @@ func buildSidecars(isUpdated bool, pod *corev1.Pod, oldPod *corev1.Pod, matchedS
initContainer.Env = append(initContainer.Env, corev1.EnvVar{Name: sidecarcontrol.SidecarEnvKey, Value: "true"})
// merged Env from sidecar.Env and transfer envs
initContainer.Env = util.MergeEnvVar(initContainer.Env, transferEnvs)

isInjecting = true
sidecarInitContainers = append(sidecarInitContainers, initContainer)
}
//process imagePullSecrets
sidecarSecrets = append(sidecarSecrets, sidecarSet.Spec.ImagePullSecrets...)
}

sidecarList := sets.NewString()
isInjecting := false
//process containers
for i := range sidecarSet.Spec.Containers {
sidecarContainer := &sidecarSet.Spec.Containers[i]
Expand Down

0 comments on commit 4e80be5

Please sign in to comment.