Merge pull request #895 from estesp/add-hostname-env

Add HOSTNAME to env by default for pod containers
This commit is contained in:
Lantao Liu 2018-09-05 10:31:34 -07:00 committed by GitHub
commit 1e471b1a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,6 +341,8 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP
for _, e := range config.GetEnvs() { for _, e := range config.GetEnvs() {
g.AddProcessEnv(e.GetKey(), e.GetValue()) g.AddProcessEnv(e.GetKey(), e.GetValue())
} }
// add the HOSTNAME variable to the environment to match Docker runtime default
g.AddProcessEnv("HOSTNAME", sandboxConfig.GetHostname())
securityContext := config.GetLinux().GetSecurityContext() securityContext := config.GetLinux().GetSecurityContext()
selinuxOpt := securityContext.GetSelinuxOptions() selinuxOpt := securityContext.GetSelinuxOptions()