From 6291555593d50260385530122090bceb7ff523ba Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Thu, 23 Nov 2023 21:13:55 +0100 Subject: [PATCH] Remove kubelet_node_{custom_flags,config_extra_args} There is no need to have an extra variables for this, just use different values per host (using Ansible group_vars, for example) --- docs/ansible/vars.md | 8 ++------ roles/kubernetes/node/defaults/main.yml | 6 ------ .../node/templates/kubelet-config.v1beta1.yaml.j2 | 3 --- roles/kubernetes/node/templates/kubelet.env.v1beta1.j2 | 2 +- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/docs/ansible/vars.md b/docs/ansible/vars.md index b172f4ada27..4015fa878d4 100644 --- a/docs/ansible/vars.md +++ b/docs/ansible/vars.md @@ -296,8 +296,8 @@ node_taints: For all kube components, custom flags can be passed in. This allows for edge cases where users need changes to the default deployment that may not be applicable to all deployments. -Extra flags for the kubelet can be specified using these variables, -in the form of dicts of key-value pairs of configuration parameters that will be inserted into the kubelet YAML config file. The `kubelet_node_config_extra_args` apply kubelet settings only to nodes and not control planes. Example: +Extra flags for the kubelet can be specified using these variables, in the form of dicts of key-value pairs of +configuration parameters that will be inserted into the kubelet YAML config file. Example: ```yml kubelet_config_extra_args: @@ -312,14 +312,10 @@ kubelet_config_extra_args: The possible vars are: * *kubelet_config_extra_args* -* *kubelet_node_config_extra_args* Previously, the same parameters could be passed as flags to kubelet binary with the following vars: * *kubelet_custom_flags* -* *kubelet_node_custom_flags* - -The `kubelet_node_custom_flags` apply kubelet settings only to nodes and not control planes. Example: ```yml kubelet_custom_flags: diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index 278b75e98aa..8146677e958 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -126,9 +126,6 @@ kubelet_config_extra_args_cgroupfs: systemCgroups: /system.slice cgroupRoot: / -## Support parameters to be passed to kubelet via kubelet-config.yaml only on nodes, not masters -kubelet_node_config_extra_args: {} - # Maximum number of container log files that can be present for a container. kubelet_logfiles_max_nr: 5 @@ -138,9 +135,6 @@ kubelet_logfiles_max_size: 10Mi ## Support custom flags to be passed to kubelet kubelet_custom_flags: [] -## Support custom flags to be passed to kubelet only on nodes, not masters -kubelet_node_custom_flags: [] - # If non-empty, will use this string as identification instead of the actual hostname kube_override_hostname: >- {%- if cloud_provider is defined and cloud_provider in ['aws'] -%} diff --git a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 b/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 index 66ce2bb5eec..565eeaa2f8c 100644 --- a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 +++ b/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 @@ -77,9 +77,6 @@ resolvConf: "{{ kube_resolv_conf }}" {% if kubelet_config_extra_args %} {{ kubelet_config_extra_args | to_nice_yaml(indent=2) }} {% endif %} -{% if inventory_hostname in groups['kube_node'] and kubelet_node_config_extra_args %} -{{ kubelet_node_config_extra_args | to_nice_yaml(indent=2) }} -{% endif %} {% if kubelet_feature_gates or kube_feature_gates %} featureGates: {% for feature in (kubelet_feature_gates | default(kube_feature_gates, true)) %} diff --git a/roles/kubernetes/node/templates/kubelet.env.v1beta1.j2 b/roles/kubernetes/node/templates/kubelet.env.v1beta1.j2 index a5aa369df57..7a77101c9a2 100644 --- a/roles/kubernetes/node/templates/kubelet.env.v1beta1.j2 +++ b/roles/kubernetes/node/templates/kubelet.env.v1beta1.j2 @@ -15,7 +15,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" --runtime-cgroups={{ kubelet_runtime_cgroups }} \ {% endset %} -KUBELET_ARGS="{{ kubelet_args_base }} {% if kubelet_custom_flags is string %} {{kubelet_custom_flags}} {% else %}{% for flag in kubelet_custom_flags %} {{flag}} {% endfor %}{% endif %}{% if inventory_hostname in groups['kube_node'] %}{% if kubelet_node_custom_flags is string %} {{kubelet_node_custom_flags}} {% else %}{% for flag in kubelet_node_custom_flags %} {{flag}} {% endfor %}{% endif %}{% endif %}" +KUBELET_ARGS="{{ kubelet_args_base }} {{ kubelet_custom_flags | join(' ') }}" {% if kubelet_flexvolumes_plugins_dir is defined %} KUBELET_VOLUME_PLUGIN="--volume-plugin-dir={{ kubelet_flexvolumes_plugins_dir }}" {% endif %}