Browse Source

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 2 weeks ago
parent
commit
a070c72214
Failed to extract signature
3 changed files with 16 additions and 5 deletions
  1. 5
      roles/kubernetes-apps/external_cloud_controller/meta/main.yml
  2. 10
      roles/kubernetes/preinstall/tasks/0040-verify-settings.yml
  3. 6
      roles/kubespray-defaults/defaults/main/main.yml

5
roles/kubernetes-apps/external_cloud_controller/meta/main.yml

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

10
roles/kubernetes/preinstall/tasks/0040-verify-settings.yml

@ -174,6 +174,16 @@
- cloud-provider
- 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"
assert:
that:

6
roles/kubespray-defaults/defaults/main/main.yml

@ -274,6 +274,12 @@ 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: ""
# 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
deploy_container_engine: "{{ 'k8s_cluster' in group_names or etcd_deployment_type == 'docker' }}"

Loading…
Cancel
Save