Skip to content

Commit f9c9a25

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#61427 from hyperbolic2346/mwilson/admission
Automatic merge from submit-queue (batch tested with PRs 61402, 61143, 61427, 60592). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Changing admission controller settings **What this PR does / why we need it**: By default, the admission controller settings in a CDK cluster didn't match the set recommended here: https://kubernetes.io/docs/admin/admission-controllers/#is-there-a-recommended-set-of-admission-controllers-to-use Now they do. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/517 **Special notes for your reviewer**: **Release note**: ```release-note Updated admission controller settings for Juju deployed Kubernetes clusters ```
2 parents 2bc231e + ffaab76 commit f9c9a25

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ def configure_apiserver(etcd_connection_string, leader_etcd_version):
11441144
api_opts['etcd-certfile'] = etcd_cert
11451145
api_opts['etcd-servers'] = etcd_connection_string
11461146

1147-
admission_control = [
1147+
admission_control_pre_1_9 = [
11481148
'Initializers',
11491149
'NamespaceLifecycle',
11501150
'LimitRanger',
@@ -1153,19 +1153,35 @@ def configure_apiserver(etcd_connection_string, leader_etcd_version):
11531153
'DefaultTolerationSeconds'
11541154
]
11551155

1156+
admission_control = [
1157+
'NamespaceLifecycle',
1158+
'LimitRanger',
1159+
'ServiceAccount',
1160+
'PersistentVolumeLabel',
1161+
'DefaultStorageClass',
1162+
'DefaultTolerationSeconds',
1163+
'MutatingAdmissionWebhook',
1164+
'ValidatingAdmissionWebhook',
1165+
'ResourceQuota'
1166+
]
1167+
11561168
auth_mode = hookenv.config('authorization-mode')
11571169
if 'Node' in auth_mode:
11581170
admission_control.append('NodeRestriction')
11591171

11601172
api_opts['authorization-mode'] = auth_mode
11611173

1162-
if get_version('kube-apiserver') < (1, 6):
1174+
kube_version = get_version('kube-apiserver')
1175+
if kube_version < (1, 6):
11631176
hookenv.log('Removing DefaultTolerationSeconds from admission-control')
1164-
admission_control.remove('DefaultTolerationSeconds')
1165-
if get_version('kube-apiserver') < (1, 7):
1177+
admission_control_pre_1_9.remove('DefaultTolerationSeconds')
1178+
if kube_version < (1, 7):
11661179
hookenv.log('Removing Initializers from admission-control')
1167-
admission_control.remove('Initializers')
1168-
api_opts['admission-control'] = ','.join(admission_control)
1180+
admission_control_pre_1_9.remove('Initializers')
1181+
if kube_version < (1, 9):
1182+
api_opts['admission-control'] = ','.join(admission_control_pre_1_9)
1183+
else:
1184+
api_opts['admission-control'] = ','.join(admission_control)
11691185

11701186
configure_kubernetes_service('kube-apiserver', api_opts, 'api-extra-args')
11711187
restart_apiserver()

0 commit comments

Comments
 (0)