Skip to content

Commit

Permalink
Make the admission controllers shared between localkube and kubeadm.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc committed Feb 15, 2018
1 parent 0f16813 commit 399c2bc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/localkube/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"path"
"strconv"

"k8s.io/minikube/pkg/util"

"github.com/coreos/etcd/embed"

apiserveroptions "k8s.io/apiserver/pkg/server/options"
Expand Down Expand Up @@ -48,14 +50,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}
Expand Down
8 changes: 8 additions & 0 deletions pkg/minikube/bootstrapper/kubeadm/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 399c2bc

Please sign in to comment.