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 14, 2018
1 parent 0f16813 commit b46c3b9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
9 changes: 1 addition & 8 deletions pkg/localkube/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/bootstrapper/kubeadm/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ kind: MasterConfiguration
api:
advertiseAddress: {{.AdvertiseAddress}}
bindPort: {{.APIServerPort}}
kubernetesVersion: {{.KubernetesVersion}}
certificatesDir: {{.CertDir}}
networking:
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 b46c3b9

Please sign in to comment.