diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-09-21 09:03:28 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-09-21 09:03:31 -0400 |
commit | 185294cb8c8945f7a1ec43429426f61f14bcb7fc (patch) | |
tree | b487b1d55f7588ef132c7e56fc2aaf879fab2894 /libpod/kube.go | |
parent | 9b5522d9adff9e8b2413e626bfc62d1df28ce534 (diff) | |
download | podman-185294cb8c8945f7a1ec43429426f61f14bcb7fc.tar.gz podman-185294cb8c8945f7a1ec43429426f61f14bcb7fc.tar.bz2 podman-185294cb8c8945f7a1ec43429426f61f14bcb7fc.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>
Diffstat (limited to 'libpod/kube.go')
-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 54e8a7c50..9b96dd99d 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -11,6 +11,7 @@ import ( "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/libpod/network/types" + "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 []types.OCICNIPortMapping) ([ // 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], |