fix applying AlwaysPullImages to commandArgs
Earlier we checked for AlwaysPullImages only if PodSecurityPolicy
is true clause, need both checks separately.
@@ -234,18 +234,21 @@ func (c *Cluster) BuildKubeAPIProcess(host *hosts.Host, prefixPath string, svcOp
CommandArgs["advertise-address"] = host.InternalAddress
}
- if c.Services.KubeAPI.PodSecurityPolicy {
- CommandArgs["runtime-config"] = "policy/v1beta1/podsecuritypolicy=true"
+ admissionControlOptionName := ""
for _, optionName := range admissionControlOptionNames {
if _, ok := CommandArgs[optionName]; ok {
- if c.Services.KubeAPI.AlwaysPullImages {
- CommandArgs[optionName] = CommandArgs[optionName] + ",PodSecurityPolicy,AlwaysPullImages"
- } else {
- CommandArgs[optionName] = CommandArgs[optionName] + ",PodSecurityPolicy"
- }
+ admissionControlOptionName = optionName
break
}
}
+
+ if c.Services.KubeAPI.PodSecurityPolicy {
+ CommandArgs["runtime-config"] = "policy/v1beta1/podsecuritypolicy=true"
+ CommandArgs[admissionControlOptionName] = CommandArgs[admissionControlOptionName] + ",PodSecurityPolicy"
+ }
+
+ if c.Services.KubeAPI.AlwaysPullImages {
+ CommandArgs[admissionControlOptionName] = CommandArgs[admissionControlOptionName] + ",AlwaysPullImages"
}
VolumesFrom := []string{
