diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-09-21 09:03:28 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-09-22 16:49:15 -0400 |
commit | 72e19cf51e88cdbdc8431c242e4670323eac3379 (patch) | |
tree | 03d0b00ade2b73761605a4246133ea8f1129488e /libpod | |
parent | 909cbfe217204ef6beceea9f6983974338d524e1 (diff) | |
download | podman-72e19cf51e88cdbdc8431c242e4670323eac3379.tar.gz podman-72e19cf51e88cdbdc8431c242e4670323eac3379.tar.bz2 podman-72e19cf51e88cdbdc8431c242e4670323eac3379.zip |
Generate kube should'd add podman default environment vars
Currently we add the default PATH, TERM and container from Podman
to every kubernetes.yaml file. These values should not be recorded
in the yaml files.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
<MH: Fixed cherry-pick conflicts>
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/kube.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index 812bb101b..af3b0916e 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -10,6 +10,7 @@ import ( "time" "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/env" "github.com/containers/podman/v3/pkg/lookup" "github.com/containers/podman/v3/pkg/namespaces" "github.com/containers/podman/v3/pkg/specgen" @@ -570,12 +571,16 @@ func ocicniPortMappingToContainerPort(portMappings []ocicni.PortMapping) ([]v1.C // libpodEnvVarsToKubeEnvVars converts a key=value string slice to []v1.EnvVar func libpodEnvVarsToKubeEnvVars(envs []string) ([]v1.EnvVar, error) { + defaultEnv := env.DefaultEnvVariables() envVars := make([]v1.EnvVar, 0, len(envs)) for _, e := range envs { split := strings.SplitN(e, "=", 2) if len(split) != 2 { return envVars, errors.Errorf("environment variable %s is malformed; should be key=value", e) } + if defaultEnv[split[0]] == split[1] { + continue + } ev := v1.EnvVar{ Name: split[0], Value: split[1], |