Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
ensure --admission-control is removed for 1.10 (#3108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored May 30, 2018
1 parent f8753ad commit c5a958b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions pkg/acsengine/defaults-apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ func setAPIServerConfig(cs *api.ContainerService) {
delete(o.KubernetesConfig.APIServerConfig, key)
}
}

// Enforce flags removal that don't work with specific versions, to accommodate upgrade
// Remove flags that are not compatible with 1.10
if common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.10.0") {
for _, key := range []string{"--admission-control"} {
delete(o.KubernetesConfig.APIServerConfig, key)
}
}
}

func getDefaultAdmissionControls(cs *api.ContainerService) (string, string) {
Expand Down
7 changes: 4 additions & 3 deletions pkg/acsengine/defaults-apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,14 @@ func TestAPIServerConfigEnableSecureKubelet(t *testing.T) {
func TestAPIServerConfigDefaultAdmissionControls(t *testing.T) {
// Test --enable-admission-plugins for v1.10 and above
version := "1.10.0"
enableAdmissionPluginsKey := "--enable-admission-plugins"
admissonControlKey := "--admission-control"
cs := createContainerService("testcluster", version, 3, 2)
cs.Properties.OrchestratorProfile.KubernetesConfig.APIServerConfig = map[string]string{}
cs.Properties.OrchestratorProfile.KubernetesConfig.APIServerConfig[admissonControlKey] = "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,DenyEscalatingExec,AlwaysPullImages"
setAPIServerConfig(cs)
a := cs.Properties.OrchestratorProfile.KubernetesConfig.APIServerConfig

enableAdmissionPluginsKey := "--enable-admission-plugins"
admissonControlKey := "--admission-control"

// --enable-admission-plugins should be set for v1.10 and above
if _, found := a[enableAdmissionPluginsKey]; !found {
t.Fatalf("Admission control key '%s' not set in API server config for version %s", enableAdmissionPluginsKey, version)
Expand Down

0 comments on commit c5a958b

Please sign in to comment.