kubeadm: add Priority to admission control
This commit is contained in:
@@ -40,7 +40,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
DefaultCloudConfigPath = "/etc/kubernetes/cloud-config"
|
DefaultCloudConfigPath = "/etc/kubernetes/cloud-config"
|
||||||
|
|
||||||
defaultv17AdmissionControl = "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,ResourceQuota"
|
defaultV18AdmissionControl = "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,ResourceQuota"
|
||||||
|
defaultV19AdmissionControl = "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,ResourceQuota"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateInitStaticPodManifestFiles will write all static pod manifest files needed to bring up the control plane.
|
// CreateInitStaticPodManifestFiles will write all static pod manifest files needed to bring up the control plane.
|
||||||
@@ -140,7 +141,7 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration, k8sVersion *versio
|
|||||||
defaultArguments := map[string]string{
|
defaultArguments := map[string]string{
|
||||||
"advertise-address": cfg.API.AdvertiseAddress,
|
"advertise-address": cfg.API.AdvertiseAddress,
|
||||||
"insecure-port": "0",
|
"insecure-port": "0",
|
||||||
"admission-control": defaultv17AdmissionControl,
|
"admission-control": defaultV19AdmissionControl,
|
||||||
"service-cluster-ip-range": cfg.Networking.ServiceSubnet,
|
"service-cluster-ip-range": cfg.Networking.ServiceSubnet,
|
||||||
"service-account-key-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.ServiceAccountPublicKeyName),
|
"service-account-key-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.ServiceAccountPublicKeyName),
|
||||||
"client-ca-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.CACertName),
|
"client-ca-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.CACertName),
|
||||||
@@ -165,6 +166,10 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration, k8sVersion *versio
|
|||||||
|
|
||||||
command := []string{"kube-apiserver"}
|
command := []string{"kube-apiserver"}
|
||||||
|
|
||||||
|
if k8sVersion.Minor() == 8 {
|
||||||
|
defaultArguments["admission-control"] = defaultV18AdmissionControl
|
||||||
|
}
|
||||||
|
|
||||||
command = append(command, kubeadmutil.BuildArgumentListFromMap(defaultArguments, cfg.APIServerExtraArgs)...)
|
command = append(command, kubeadmutil.BuildArgumentListFromMap(defaultArguments, cfg.APIServerExtraArgs)...)
|
||||||
command = append(command, getAuthzParameters(cfg.AuthorizationModes)...)
|
command = append(command, getAuthzParameters(cfg.AuthorizationModes)...)
|
||||||
|
|
||||||
|
@@ -351,6 +351,43 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
"--etcd-keyfile=faz",
|
"--etcd-keyfile=faz",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cfg: &kubeadmapi.MasterConfiguration{
|
||||||
|
API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
||||||
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
|
Etcd: kubeadmapi.Etcd{CertFile: "fiz", KeyFile: "faz"},
|
||||||
|
CertificatesDir: testCertsDir,
|
||||||
|
KubernetesVersion: "v1.9.0-beta.0",
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"kube-apiserver",
|
||||||
|
"--insecure-port=0",
|
||||||
|
"--admission-control=Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,ResourceQuota",
|
||||||
|
"--service-cluster-ip-range=bar",
|
||||||
|
"--service-account-key-file=" + testCertsDir + "/sa.pub",
|
||||||
|
"--client-ca-file=" + testCertsDir + "/ca.crt",
|
||||||
|
"--tls-cert-file=" + testCertsDir + "/apiserver.crt",
|
||||||
|
"--tls-private-key-file=" + testCertsDir + "/apiserver.key",
|
||||||
|
"--kubelet-client-certificate=" + testCertsDir + "/apiserver-kubelet-client.crt",
|
||||||
|
"--kubelet-client-key=" + testCertsDir + "/apiserver-kubelet-client.key",
|
||||||
|
fmt.Sprintf("--secure-port=%d", 123),
|
||||||
|
"--allow-privileged=true",
|
||||||
|
"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname",
|
||||||
|
"--enable-bootstrap-token-auth=true",
|
||||||
|
"--proxy-client-cert-file=/var/lib/certs/front-proxy-client.crt",
|
||||||
|
"--proxy-client-key-file=/var/lib/certs/front-proxy-client.key",
|
||||||
|
"--requestheader-username-headers=X-Remote-User",
|
||||||
|
"--requestheader-group-headers=X-Remote-Group",
|
||||||
|
"--requestheader-extra-headers-prefix=X-Remote-Extra-",
|
||||||
|
"--requestheader-client-ca-file=" + testCertsDir + "/front-proxy-ca.crt",
|
||||||
|
"--requestheader-allowed-names=front-proxy-client",
|
||||||
|
"--authorization-mode=Node,RBAC",
|
||||||
|
"--advertise-address=2001:db8::1",
|
||||||
|
"--etcd-servers=http://127.0.0.1:2379",
|
||||||
|
"--etcd-certfile=fiz",
|
||||||
|
"--etcd-keyfile=faz",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, rt := range tests {
|
for _, rt := range tests {
|
||||||
|
Reference in New Issue
Block a user