1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-25 06:33:56 +00:00

Move admission controller options to ServiceOptions

This commit is contained in:
moelsayed
2018-08-29 23:42:12 +02:00
committed by Alena Prokharchyk
parent 6b141295aa
commit 6b6a7803a7

View File

@@ -37,6 +37,8 @@ const (
KubeletDockerConfigPath = "/var/lib/kubelet/config.json" KubeletDockerConfigPath = "/var/lib/kubelet/config.json"
) )
var admissionControlOptionNames = []string{"enable-admission-plugins", "admission-control"}
func GeneratePlan(ctx context.Context, rkeConfig *v3.RancherKubernetesEngineConfig, hostsInfoMap map[string]types.Info) (v3.RKEPlan, error) { func GeneratePlan(ctx context.Context, rkeConfig *v3.RancherKubernetesEngineConfig, hostsInfoMap map[string]types.Info) (v3.RKEPlan, error) {
clusterPlan := v3.RKEPlan{} clusterPlan := v3.RKEPlan{}
myCluster, err := ParseCluster(ctx, rkeConfig, "", "", nil, nil, nil) myCluster, err := ParseCluster(ctx, rkeConfig, "", "", nil, nil, nil)
@@ -126,7 +128,6 @@ func (c *Cluster) BuildKubeAPIProcess(prefixPath string) v3.Process {
"kubelet-preferred-address-types": "InternalIP,ExternalIP,Hostname", "kubelet-preferred-address-types": "InternalIP,ExternalIP,Hostname",
"service-cluster-ip-range": c.Services.KubeAPI.ServiceClusterIPRange, "service-cluster-ip-range": c.Services.KubeAPI.ServiceClusterIPRange,
"service-node-port-range": c.Services.KubeAPI.ServiceNodePortRange, "service-node-port-range": c.Services.KubeAPI.ServiceNodePortRange,
"admission-control": "ServiceAccount,NamespaceLifecycle,LimitRanger,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota,DefaultTolerationSeconds",
"storage-backend": "etcd3", "storage-backend": "etcd3",
"client-ca-file": pki.GetCertPath(pki.CACertName), "client-ca-file": pki.GetCertPath(pki.CACertName),
"tls-cert-file": pki.GetCertPath(pki.KubeAPICertName), "tls-cert-file": pki.GetCertPath(pki.KubeAPICertName),
@@ -172,7 +173,12 @@ func (c *Cluster) BuildKubeAPIProcess(prefixPath string) v3.Process {
} }
if c.Services.KubeAPI.PodSecurityPolicy { if c.Services.KubeAPI.PodSecurityPolicy {
CommandArgs["runtime-config"] = "extensions/v1beta1/podsecuritypolicy=true" CommandArgs["runtime-config"] = "extensions/v1beta1/podsecuritypolicy=true"
CommandArgs["admission-control"] = CommandArgs["admission-control"] + ",PodSecurityPolicy" for _, optionName := range admissionControlOptionNames {
if _, ok := CommandArgs[optionName]; ok {
CommandArgs[optionName] = CommandArgs[optionName] + ",PodSecurityPolicy"
break
}
}
} }
VolumesFrom := []string{ VolumesFrom := []string{