1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-09 10:48:10 +00:00

Apply MCS label when privileged is false

This commit is contained in:
Sebastiaan van Steenis 2019-08-30 16:33:22 +02:00 committed by Alena Prokharchyk
parent 798632b3a4
commit 32bf922fc5

View File

@ -122,6 +122,8 @@ func GetProcessConfig(process v3.Process, host *hosts.Host) (*container.Config,
if len(process.RestartPolicy) > 0 { if len(process.RestartPolicy) > 0 {
hostCfg.RestartPolicy = container.RestartPolicy{Name: process.RestartPolicy} hostCfg.RestartPolicy = container.RestartPolicy{Name: process.RestartPolicy}
} }
// The MCS label only needs to be applied when container is not running privileged, and running privileged negates need for applying the label
if !process.Privileged {
for _, securityOpt := range host.DockerInfo.SecurityOptions { for _, securityOpt := range host.DockerInfo.SecurityOptions {
// If Docker is configured with selinux-enabled:true, we need to specify MCS label to allow files from service-sidekick to be shared between containers // If Docker is configured with selinux-enabled:true, we need to specify MCS label to allow files from service-sidekick to be shared between containers
if securityOpt == "selinux" { if securityOpt == "selinux" {
@ -142,6 +144,7 @@ func GetProcessConfig(process v3.Process, host *hosts.Host) (*container.Config,
} }
} }
} }
}
return imageCfg, hostCfg, process.HealthCheck.URL return imageCfg, hostCfg, process.HealthCheck.URL
} }