Skip to content

Commit

Permalink
Feature DynamicKubeletConfig is deprecated in 1.22 and will not move …
Browse files Browse the repository at this point in the history
…to GA (#7938)

* Feature DynamicKubeletConfig is deprecated in 1.22 and will not move to GA

* Add check for dynamic_kubelet_configuration with kube >= 1.22
  • Loading branch information
cristicalin authored and mmelyp committed Nov 15, 2021
1 parent 6814d60 commit 9e4938b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ k8s_image_pull_policy: IfNotPresent
kubernetes_audit: false

# dynamic kubelet configuration
# Note: Feature DynamicKubeletConfig is deprecated in 1.22 and will not move to GA.
# It is planned to be removed from Kubernetes in the version 1.23.
# Please use alternative ways to update kubelet configuration.
dynamic_kubelet_configuration: false

# define kubelet config dir for dynamic kubelet
Expand Down
4 changes: 3 additions & 1 deletion roles/kubernetes/node/tasks/kubelet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
path: "{{ dynamic_kubelet_configuration_dir }}"
mode: 0600
state: directory
when: dynamic_kubelet_configuration
when:
- dynamic_kubelet_configuration
- kube_version is version('v1.22.0', '<')

- name: Set kubelet api version to v1beta1
set_fact:
Expand Down
2 changes: 1 addition & 1 deletion roles/kubernetes/node/templates/kubelet.env.v1beta1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--container-runtime=remote \
--container-runtime-endpoint=unix://{{ cri_socket }} \
{% endif %}
{% if dynamic_kubelet_configuration %}
{% if dynamic_kubelet_configuration and kube_version is version('v1.22.0', '<') %}
--dynamic-config-dir={{ dynamic_kubelet_configuration_dir }} \
{% endif %}
--runtime-cgroups={{ kubelet_runtime_cgroups }} \
Expand Down
10 changes: 10 additions & 0 deletions roles/kubernetes/preinstall/tasks/0020-verify-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@
when:
- kube_version is version('v1.21.0', '>=')

- name: Stop when dynamic_kubelet_configuration enabled for kubernetes >= 1.22
assert:
that: not dynamic_kubelet_configuration
msg: >
Feature DynamicKubeletConfig is deprecated in 1.22 and will not move to GA.
It is planned to be removed from Kubernetes in the version 1.23.
Please use alternative ways to update kubelet configuration.
when:
- kube_version is version('v1.22.0', '>=')

# This assertion will fail on the safe side: One can indeed schedule more pods
# on a node than the CIDR-range has space for when additional pods use the host
# network namespace. It is impossible to ascertain the number of such pods at
Expand Down
1 change: 0 additions & 1 deletion tests/files/packet_oracle7-canal-ha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mode: ha
# Kubespray settings
calico_datastore: etcd
kube_network_plugin: canal
dynamic_kubelet_configuration: true
deploy_netchecker: true
dns_min_replicas: 1

Expand Down
1 change: 0 additions & 1 deletion tests/files/packet_ubuntu16-canal-kubeadm-ha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ mode: ha
# Kubespray settings
calico_datastore: etcd
kube_network_plugin: canal
dynamic_kubelet_configuration: true
deploy_netchecker: true
dns_min_replicas: 1

0 comments on commit 9e4938b

Please sign in to comment.