mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
kubelet_pods.go: clean makeEnvironmentVariables
For the simplicity and clarity, I think we can safely delete the `delete(serviceEnv, envVar.Name)` and the duplicate comments at function makeEnvironmentVariables of kubelet_pods.go:774-779. 1. `delete(serviceEnv, envVar.Name)` and `if _, present := tmpEnv[k]; !present` of line 796 are the same logic that is to merge the non-present keys of serviceEnv into tmpEnv. 2. And the keys deleted from serviceEnv are guarantee to be in tmpEnv, this doesn't affect mappingFunc. 3. the delete may miss some key from container.EnvFrom
This commit is contained in:
parent
a8035dbc3b
commit
afe28c6fc8
@ -779,12 +779,6 @@ func (kl *Kubelet) makeEnvironmentVariables(pod *v1.Pod, container *v1.Container
|
||||
runtimeVal = string(runtimeValBytes)
|
||||
}
|
||||
}
|
||||
// Accesses apiserver+Pods.
|
||||
// So, the master may set service env vars, or kubelet may. In case both are doing
|
||||
// it, we delete the key from the kubelet-generated ones so we don't have duplicate
|
||||
// env vars.
|
||||
// TODO: remove this next line once all platforms use apiserver+Pods.
|
||||
delete(serviceEnv, envVar.Name)
|
||||
|
||||
tmpEnv[envVar.Name] = runtimeVal
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user