Refactor: simpify external_cloud_provider is defined

For this change, `external_cloud_provider` set default value to empty
string.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
pull/11633/head
ChengHao Yang 2024-11-05 00:45:00 +08:00
parent 38cd05c503
commit a070c72214
No known key found for this signature in database
3 changed files with 16 additions and 5 deletions

View File

@ -3,7 +3,6 @@ dependencies:
- role: kubernetes-apps/external_cloud_controller/openstack - role: kubernetes-apps/external_cloud_controller/openstack
when: when:
- cloud_provider == "external" - cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "openstack" - external_cloud_provider == "openstack"
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]
tags: tags:
@ -12,7 +11,6 @@ dependencies:
- role: kubernetes-apps/external_cloud_controller/vsphere - role: kubernetes-apps/external_cloud_controller/vsphere
when: when:
- cloud_provider == "external" - cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "vsphere" - external_cloud_provider == "vsphere"
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]
tags: tags:
@ -21,7 +19,6 @@ dependencies:
- role: kubernetes-apps/external_cloud_controller/hcloud - role: kubernetes-apps/external_cloud_controller/hcloud
when: when:
- cloud_provider == "external" - cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "hcloud" - external_cloud_provider == "hcloud"
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]
tags: tags:
@ -30,7 +27,6 @@ dependencies:
- role: kubernetes-apps/external_cloud_controller/huaweicloud - role: kubernetes-apps/external_cloud_controller/huaweicloud
when: when:
- cloud_provider == "external" - cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "huaweicloud" - external_cloud_provider == "huaweicloud"
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]
tags: tags:
@ -39,7 +35,6 @@ dependencies:
- role: kubernetes-apps/external_cloud_controller/oci - role: kubernetes-apps/external_cloud_controller/oci
when: when:
- cloud_provider == "external" - cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "oci" - external_cloud_provider == "oci"
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]
tags: tags:

View File

@ -174,6 +174,16 @@
- cloud-provider - cloud-provider
- facts - facts
- name: Check external_cloud_provider value
assert:
that: external_cloud_provider in ['hcloud', 'huaweicloud', 'oci', 'openstack', 'vsphere']
when:
- cloud_provider == 'external'
- not ignore_assert_errors
tags:
- cloud-provider
- facts
- name: "Check that kube_service_addresses is a network range" - name: "Check that kube_service_addresses is a network range"
assert: assert:
that: that:

View File

@ -274,6 +274,12 @@ kubelet_shutdown_grace_period_critical_pods: 20s
# Cloud Provider # Cloud Provider
# This variable can only be set to "external" or empty string, otherwise the check will fail. # This variable can only be set to "external" or empty string, otherwise the check will fail.
cloud_provider: "" cloud_provider: ""
# External Cloud Controller Manager (Formerly known as cloud provider)
# cloud_provider must be "external", otherwise this setting is invalid.
# Supported external cloud controllers are: 'openstack', 'vsphere', 'oci', 'huaweicloud' and 'hcloud'
# If you fill in a value other than the above, the check will fail.
external_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' }}"