diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-21 11:27:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 11:27:43 -0400 |
commit | f2c2e1c5202b7186f9310050b298ef73486d5e5b (patch) | |
tree | 39f138c81e1fe2b8931e3e3d7c566990db02d513 /libpod | |
parent | b922e61cec379c136d4138f13e4fc44d2fa3df11 (diff) | |
parent | 185294cb8c8945f7a1ec43429426f61f14bcb7fc (diff) | |
download | podman-f2c2e1c5202b7186f9310050b298ef73486d5e5b.tar.gz podman-f2c2e1c5202b7186f9310050b298ef73486d5e5b.tar.bz2 podman-f2c2e1c5202b7186f9310050b298ef73486d5e5b.zip |
Merge pull request #11676 from rhatdan/kube
Generate kube shouldn't add podman default environment vars
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 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], |