Skip to content

Commit

Permalink
fix only initContainers without hash problem
Browse files Browse the repository at this point in the history
Signed-off-by: chrisdeng <chrisdeng@futunn.com>
  • Loading branch information
chrisdeng committed Nov 9, 2023
1 parent 0b2fc0e commit 9975fcb
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 9975fcb

Please sign in to comment.