in internal/workload/podspec_updates.go [808:831]
func (s *updateState) updateContainerEnv(c *corev1.Container) {
for i := 0; i < len(s.mods.EnvVars); i++ {
var found bool
v := s.mods.EnvVars[i]
operatorEnv := v.OperatorManagedValue
// If this EnvVar is not for this container and not for all containers
// don't add it to this container.
if v.ContainerName != c.Name && v.ContainerName != "" {
continue
}
for j := 0; j < len(c.Env); j++ {
if operatorEnv.Name == c.Env[j].Name {
found = true
c.Env[j] = operatorEnv
}
}
if !found {
c.Env = append(c.Env, operatorEnv)
}
}
}