Refactor: simpify cloud_provider is defined condition
For this change, `cloud_provider` change the default value to empty string. Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>pull/11633/head
parent
c27cc33bd7
commit
38cd05c503
|
@ -2,7 +2,6 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: kubernetes-apps/external_cloud_controller/openstack
|
- role: kubernetes-apps/external_cloud_controller/openstack
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
|
||||||
- cloud_provider == "external"
|
- cloud_provider == "external"
|
||||||
- external_cloud_provider is defined
|
- external_cloud_provider is defined
|
||||||
- external_cloud_provider == "openstack"
|
- external_cloud_provider == "openstack"
|
||||||
|
@ -12,7 +11,6 @@ dependencies:
|
||||||
- external-openstack
|
- external-openstack
|
||||||
- role: kubernetes-apps/external_cloud_controller/vsphere
|
- role: kubernetes-apps/external_cloud_controller/vsphere
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
|
||||||
- cloud_provider == "external"
|
- cloud_provider == "external"
|
||||||
- external_cloud_provider is defined
|
- external_cloud_provider is defined
|
||||||
- external_cloud_provider == "vsphere"
|
- external_cloud_provider == "vsphere"
|
||||||
|
@ -22,7 +20,6 @@ dependencies:
|
||||||
- external-vsphere
|
- external-vsphere
|
||||||
- role: kubernetes-apps/external_cloud_controller/hcloud
|
- role: kubernetes-apps/external_cloud_controller/hcloud
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
|
||||||
- cloud_provider == "external"
|
- cloud_provider == "external"
|
||||||
- external_cloud_provider is defined
|
- external_cloud_provider is defined
|
||||||
- external_cloud_provider == "hcloud"
|
- external_cloud_provider == "hcloud"
|
||||||
|
@ -32,7 +29,6 @@ dependencies:
|
||||||
- external-hcloud
|
- external-hcloud
|
||||||
- role: kubernetes-apps/external_cloud_controller/huaweicloud
|
- role: kubernetes-apps/external_cloud_controller/huaweicloud
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
|
||||||
- cloud_provider == "external"
|
- cloud_provider == "external"
|
||||||
- external_cloud_provider is defined
|
- external_cloud_provider is defined
|
||||||
- external_cloud_provider == "huaweicloud"
|
- external_cloud_provider == "huaweicloud"
|
||||||
|
@ -42,7 +38,6 @@ dependencies:
|
||||||
- external-huaweicloud
|
- external-huaweicloud
|
||||||
- role: kubernetes-apps/external_cloud_controller/oci
|
- role: kubernetes-apps/external_cloud_controller/oci
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
|
||||||
- cloud_provider == "external"
|
- cloud_provider == "external"
|
||||||
- external_cloud_provider is defined
|
- external_cloud_provider is defined
|
||||||
- external_cloud_provider == "oci"
|
- external_cloud_provider == "oci"
|
||||||
|
|
|
@ -24,7 +24,7 @@ nodeRegistration:
|
||||||
taints: []
|
taints: []
|
||||||
{% endif %}
|
{% endif %}
|
||||||
criSocket: {{ cri_socket }}
|
criSocket: {{ cri_socket }}
|
||||||
{% if cloud_provider is defined and cloud_provider in ["external"] %}
|
{% if cloud_provider == "external" %}
|
||||||
kubeletExtraArgs:
|
kubeletExtraArgs:
|
||||||
cloud-provider: external
|
cloud-provider: external
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -21,7 +21,7 @@ KUBELET_VOLUME_PLUGIN="--volume-plugin-dir={{ kubelet_flexvolumes_plugins_dir }}
|
||||||
{% if kube_network_plugin is defined and kube_network_plugin == "cloud" %}
|
{% if kube_network_plugin is defined and kube_network_plugin == "cloud" %}
|
||||||
KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
|
KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if cloud_provider is defined and cloud_provider in ["external"] %}
|
{% if cloud_provider == "external" %}
|
||||||
KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }}"
|
KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }}"
|
||||||
{% else %}
|
{% else %}
|
||||||
KUBELET_CLOUDPROVIDER=""
|
KUBELET_CLOUDPROVIDER=""
|
||||||
|
|
|
@ -166,10 +166,9 @@
|
||||||
|
|
||||||
- name: Check cloud_provider value
|
- name: Check cloud_provider value
|
||||||
assert:
|
assert:
|
||||||
that: cloud_provider in ['external']
|
that: cloud_provider == 'external'
|
||||||
msg: "If set the 'cloud_provider' var must be set either to 'external'"
|
|
||||||
when:
|
when:
|
||||||
- cloud_provider is defined
|
- cloud_provider
|
||||||
- not ignore_assert_errors
|
- not ignore_assert_errors
|
||||||
tags:
|
tags:
|
||||||
- cloud-provider
|
- cloud-provider
|
||||||
|
|
|
@ -271,6 +271,9 @@ kubelet_shutdown_grace_period: 60s
|
||||||
# to give normal pods time to be gracefully evacuated
|
# to give normal pods time to be gracefully evacuated
|
||||||
kubelet_shutdown_grace_period_critical_pods: 20s
|
kubelet_shutdown_grace_period_critical_pods: 20s
|
||||||
|
|
||||||
|
# Cloud Provider
|
||||||
|
# This variable can only be set to "external" or empty string, otherwise the check will fail.
|
||||||
|
cloud_provider: ""
|
||||||
# Whether to deploy the container engine
|
# Whether to deploy the container engine
|
||||||
deploy_container_engine: "{{ 'k8s_cluster' in group_names or etcd_deployment_type == 'docker' }}"
|
deploy_container_engine: "{{ 'k8s_cluster' in group_names or etcd_deployment_type == 'docker' }}"
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
register: calico_kubelet_name
|
register: calico_kubelet_name
|
||||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||||
when:
|
when:
|
||||||
- "cloud_provider is defined"
|
- cloud_provider
|
||||||
|
|
||||||
- name: Calico | Gather os specific variables
|
- name: Calico | Gather os specific variables
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
when:
|
when:
|
||||||
- (calico_ipip_mode is defined and calico_ipip_mode != 'Never' or cloud_provider is defined)
|
- (calico_ipip_mode is defined and calico_ipip_mode != 'Never')
|
||||||
- kube_network_plugin | default('calico') == 'calico'
|
- kube_network_plugin | default('calico') == 'calico'
|
||||||
|
|
||||||
- name: Advanced testcases for network
|
- name: Advanced testcases for network
|
||||||
|
|
Loading…
Reference in New Issue