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

ensure --admission-control is removed for 1.10 #3108

Merged
merged 1 commit into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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