Merge pull request #11568 from VannTen/cleanup/dont_rely_on_kube_node_existing
Only require minimum structure in inventory, part IIpull/11583/head
commit
bbd90f7657
|
@ -9,6 +9,6 @@ metrics_server_requests_cpu: 100m
|
||||||
metrics_server_requests_memory: 200Mi
|
metrics_server_requests_memory: 200Mi
|
||||||
metrics_server_host_network: false
|
metrics_server_host_network: false
|
||||||
metrics_server_replicas: 1
|
metrics_server_replicas: 1
|
||||||
# metrics_server_extra_tolerations: []
|
metrics_server_extra_tolerations: []
|
||||||
# metrics_server_extra_affinity: {}
|
metrics_server_extra_affinity: {}
|
||||||
# metrics_server_nodeselector: {}
|
metrics_server_nodeselector: {}
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
---
|
---
|
||||||
# If all control plane nodes have the node role, there are no tainted control plane nodes and toleration should not be specified.
|
|
||||||
- name: Check all control plane nodes are node or not
|
|
||||||
set_fact:
|
|
||||||
control_plane_nodes_are_not_tainted: "{{ groups['kube_node'] | intersect(groups['kube_control_plane']) == groups['kube_control_plane'] }}"
|
|
||||||
|
|
||||||
- name: Metrics Server | Delete addon dir
|
- name: Metrics Server | Delete addon dir
|
||||||
file:
|
file:
|
||||||
path: "{{ kube_config_dir }}/addons/metrics_server"
|
path: "{{ kube_config_dir }}/addons/metrics_server"
|
||||||
|
|
|
@ -85,16 +85,12 @@ spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: tmp
|
- name: tmp
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{% if not control_plane_nodes_are_not_tainted or metrics_server_extra_tolerations is defined %}
|
|
||||||
tolerations:
|
tolerations:
|
||||||
{% if not control_plane_nodes_are_not_tainted %}
|
|
||||||
- key: node-role.kubernetes.io/control-plane
|
- key: node-role.kubernetes.io/control-plane
|
||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
{% endif %}
|
{% if metrics_server_extra_tolerations %}
|
||||||
{% if metrics_server_extra_tolerations is defined %}
|
|
||||||
{{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
|
{{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endif %}
|
|
||||||
affinity:
|
affinity:
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
preferredDuringSchedulingIgnoredDuringExecution:
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
@ -109,10 +105,10 @@ spec:
|
||||||
topologyKey: kubernetes.io/hostname
|
topologyKey: kubernetes.io/hostname
|
||||||
namespaces:
|
namespaces:
|
||||||
- kube-system
|
- kube-system
|
||||||
{% if metrics_server_extra_affinity is defined %}
|
{% if metrics_server_extra_affinity %}
|
||||||
{{ metrics_server_extra_affinity | to_nice_yaml | indent(width=8) }}
|
{{ metrics_server_extra_affinity | to_nice_yaml(indent=2) | indent(8) }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if metrics_server_nodeselector is defined %}
|
{% if metrics_server_nodeselector %}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ metrics_server_nodeselector | to_nice_yaml | indent(width=8) }}
|
{{ metrics_server_nodeselector | to_nice_yaml(indent=2) | indent(8) }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -16,7 +16,7 @@ nodeRegistration:
|
||||||
{% if kube_override_hostname | default('') %}
|
{% if kube_override_hostname | default('') %}
|
||||||
name: "{{ kube_override_hostname }}"
|
name: "{{ kube_override_hostname }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if inventory_hostname in groups['kube_control_plane'] and inventory_hostname not in groups['kube_node'] %}
|
{% if 'kube_control_plane' in group_names and 'kube_node' not in group_names %}
|
||||||
taints:
|
taints:
|
||||||
- effect: NoSchedule
|
- effect: NoSchedule
|
||||||
key: node-role.kubernetes.io/control-plane
|
key: node-role.kubernetes.io/control-plane
|
||||||
|
|
|
@ -24,7 +24,7 @@ controlPlane:
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
name: {{ kube_override_hostname | default(inventory_hostname) }}
|
name: {{ kube_override_hostname | default(inventory_hostname) }}
|
||||||
criSocket: {{ cri_socket }}
|
criSocket: {{ cri_socket }}
|
||||||
{% if inventory_hostname in groups['kube_control_plane'] and inventory_hostname not in groups['kube_node'] %}
|
{% if 'kube_control_plane' in group_names and 'kube_node' not in group_names %}
|
||||||
taints:
|
taints:
|
||||||
- effect: NoSchedule
|
- effect: NoSchedule
|
||||||
key: node-role.kubernetes.io/control-plane
|
key: node-role.kubernetes.io/control-plane
|
||||||
|
|
|
@ -28,7 +28,7 @@ kubelet_systemd_wants_dependencies: []
|
||||||
|
|
||||||
# List of secure IPs for kubelet
|
# List of secure IPs for kubelet
|
||||||
kube_node_addresses: >-
|
kube_node_addresses: >-
|
||||||
{%- for host in (groups['kube_control_plane'] + groups['kube_node'] + groups['etcd']) | unique -%}
|
{%- for host in (groups['k8s_cluster'] | union(groups['etcd'])) -%}
|
||||||
{{ hostvars[host]['ip'] | default(fallback_ips[host]) }}{{ ' ' if not loop.last else '' }}
|
{{ hostvars[host]['ip'] | default(fallback_ips[host]) }}{{ ' ' if not loop.last else '' }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
kubelet_secure_addresses: "localhost link-local {{ kube_pods_subnet }} {{ kube_node_addresses }}"
|
kubelet_secure_addresses: "localhost link-local {{ kube_pods_subnet }} {{ kube_node_addresses }}"
|
||||||
|
|
Loading…
Reference in New Issue