From 9aa1aa471affd2d10b456b638dea69d4cc47c4e8 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Wed, 14 Feb 2018 09:22:14 -0800 Subject: [PATCH] Make the admission controllers shared between localkube and kubeadm. --- pkg/localkube/apiserver.go | 9 +-------- pkg/minikube/bootstrapper/kubeadm/versions.go | 8 ++++++++ pkg/util/constants.go | 12 ++++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pkg/localkube/apiserver.go b/pkg/localkube/apiserver.go index 160d7a0604d8..191eede02e37 100644 --- a/pkg/localkube/apiserver.go +++ b/pkg/localkube/apiserver.go @@ -48,14 +48,7 @@ func StartAPIServer(lk LocalkubeServer) func() error { config.SecureServing.ServerCert.CertKey.CertFile = lk.GetPublicKeyCertPath() config.SecureServing.ServerCert.CertKey.KeyFile = lk.GetPrivateKeyCertPath() - config.Admission.PluginNames = []string{ - "NamespaceLifecycle", - "LimitRanger", - "ServiceAccount", - "DefaultStorageClass", - "ResourceQuota", - "MutatingAdmissionWebhook", - } + config.Admission.PluginNames = util.DefaultAdmissionControllers // use localkube etcd config.Etcd.StorageConfig.ServerList = []string{embed.DefaultListenClientURLs} diff --git a/pkg/minikube/bootstrapper/kubeadm/versions.go b/pkg/minikube/bootstrapper/kubeadm/versions.go index 55b740d82e0e..c54700724085 100644 --- a/pkg/minikube/bootstrapper/kubeadm/versions.go +++ b/pkg/minikube/bootstrapper/kubeadm/versions.go @@ -191,6 +191,14 @@ var versionSpecificOpts = []VersionedExtraOption{ // Cgroup args NewUnversionedOption(Kubelet, "cadvisor-port", "0"), NewUnversionedOption(Kubelet, "cgroup-driver", "cgroupfs"), + { + Option: util.ExtraOption{ + Component: Apiserver, + Key: "admission-control", + Value: strings.Join(util.DefaultAdmissionControllers, ","), + }, + GreaterThanOrEqual: semver.MustParse("1.9.0-alpha.0"), + }, } func VersionIsBetween(version, gte, lte semver.Version) bool { diff --git a/pkg/util/constants.go b/pkg/util/constants.go index 16f26d37de39..d0d0336f91a7 100644 --- a/pkg/util/constants.go +++ b/pkg/util/constants.go @@ -32,6 +32,18 @@ const ( DefaultServiceCIDR = "10.96.0.0/12" ) +var DefaultAdmissionControllers = []string{ + "Initializers", + "NamespaceLifecycle", + "LimitRanger", + "ServiceAccount", + "DefaultStorageClass", + "DefaultTolerationSeconds", + "NodeRestriction", + "ResourceQuota", + "MutatingAdmissionWebhook", +} + // GetServiceClusterIP returns the first IP of the ServiceCIDR func GetServiceClusterIP(serviceCIDR string) (net.IP, error) { ip, _, err := net.ParseCIDR(serviceCIDR)