Improve first_kube_control_plane variable management to avoid installation failures due to variable overlapping (#8388)
This commit is contained in:
parent
aa4a3d7afd
commit
57a1d18db3
4 changed files with 6 additions and 6 deletions
|
@ -3,7 +3,7 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
kubeadm_discovery_address: >-
|
kubeadm_discovery_address: >-
|
||||||
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
||||||
{{ first_kube_control_plane }}:{{ kube_apiserver_port }}
|
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ kube_apiserver_endpoint | regex_replace('https://', '') }}
|
{{ kube_apiserver_endpoint | regex_replace('https://', '') }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
kubeadm_discovery_address: >-
|
kubeadm_discovery_address: >-
|
||||||
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
||||||
{{ first_kube_control_plane }}:{{ kube_apiserver_port }}
|
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ kube_apiserver_endpoint | replace("https://", "") }}
|
{{ kube_apiserver_endpoint | replace("https://", "") }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -500,7 +500,7 @@ is_kube_master: "{{ inventory_hostname in groups['kube_control_plane'] }}"
|
||||||
kube_apiserver_count: "{{ groups['kube_control_plane'] | length }}"
|
kube_apiserver_count: "{{ groups['kube_control_plane'] | length }}"
|
||||||
kube_apiserver_address: "{{ ip | default(fallback_ips[inventory_hostname]) }}"
|
kube_apiserver_address: "{{ ip | default(fallback_ips[inventory_hostname]) }}"
|
||||||
kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
|
kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
|
||||||
first_kube_control_plane: "{{ hostvars[groups['kube_control_plane'][0]]['access_ip'] | default(hostvars[groups['kube_control_plane'][0]]['ip'] | default(fallback_ips[groups['kube_control_plane'][0]])) }}"
|
first_kube_control_plane_address: "{{ hostvars[groups['kube_control_plane'][0]]['access_ip'] | default(hostvars[groups['kube_control_plane'][0]]['ip'] | default(fallback_ips[groups['kube_control_plane'][0]])) }}"
|
||||||
loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
|
loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
|
||||||
loadbalancer_apiserver_type: "nginx"
|
loadbalancer_apiserver_type: "nginx"
|
||||||
# applied if only external loadbalancer_apiserver is defined, otherwise ignored
|
# applied if only external loadbalancer_apiserver is defined, otherwise ignored
|
||||||
|
@ -511,7 +511,7 @@ kube_apiserver_global_endpoint: |-
|
||||||
{%- elif use_localhost_as_kubeapi_loadbalancer|default(False)|bool -%}
|
{%- elif use_localhost_as_kubeapi_loadbalancer|default(False)|bool -%}
|
||||||
https://127.0.0.1:{{ kube_apiserver_port }}
|
https://127.0.0.1:{{ kube_apiserver_port }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
https://{{ first_kube_control_plane }}:{{ kube_apiserver_port }}
|
https://{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
kube_apiserver_endpoint: |-
|
kube_apiserver_endpoint: |-
|
||||||
{% if loadbalancer_apiserver is defined -%}
|
{% if loadbalancer_apiserver is defined -%}
|
||||||
|
@ -521,7 +521,7 @@ kube_apiserver_endpoint: |-
|
||||||
{%- elif is_kube_master -%}
|
{%- elif is_kube_master -%}
|
||||||
https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
|
https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
https://{{ first_kube_control_plane }}:{{ kube_apiserver_port }}
|
https://{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
kube_apiserver_insecure_endpoint: >-
|
kube_apiserver_insecure_endpoint: >-
|
||||||
http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
|
http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
|
||||||
|
|
|
@ -13,7 +13,7 @@ data:
|
||||||
KUBERNETES_SERVICE_HOST: "127.0.0.1"
|
KUBERNETES_SERVICE_HOST: "127.0.0.1"
|
||||||
KUBERNETES_SERVICE_PORT: "{{ kube_apiserver_port }}"
|
KUBERNETES_SERVICE_PORT: "{{ kube_apiserver_port }}"
|
||||||
{%- else %}
|
{%- else %}
|
||||||
KUBERNETES_SERVICE_HOST: "{{ first_kube_control_plane }}"
|
KUBERNETES_SERVICE_HOST: "{{ first_kube_control_plane_address }}"
|
||||||
KUBERNETES_SERVICE_PORT: "{{ kube_apiserver_port }}"
|
KUBERNETES_SERVICE_PORT: "{{ kube_apiserver_port }}"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue