mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 13:54:37 +03:00
Cleanup: kubeadm-config v1beta4 extra args defined conditions (#12307)
* Cleanup: kubeadm-config v1beta4 extra args defined conditions Some variables have already been defined, so there is no need to useconditional statements to check whether they have been defined. Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com> * Cleanup: cloud-provider extra args Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com> --------- Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
@@ -106,18 +106,10 @@ certificatesDir: {{ kube_cert_dir }}
|
|||||||
imageRepository: {{ kube_image_repo }}
|
imageRepository: {{ kube_image_repo }}
|
||||||
apiServer:
|
apiServer:
|
||||||
extraArgs:
|
extraArgs:
|
||||||
{% if kube_apiserver_etcd_compaction_interval is defined %}
|
|
||||||
etcd-compaction-interval: "{{ kube_apiserver_etcd_compaction_interval }}"
|
etcd-compaction-interval: "{{ kube_apiserver_etcd_compaction_interval }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_pod_eviction_not_ready_timeout_seconds is defined %}
|
|
||||||
default-not-ready-toleration-seconds: "{{ kube_apiserver_pod_eviction_not_ready_timeout_seconds }}"
|
default-not-ready-toleration-seconds: "{{ kube_apiserver_pod_eviction_not_ready_timeout_seconds }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_pod_eviction_unreachable_timeout_seconds is defined %}
|
|
||||||
default-unreachable-toleration-seconds: "{{ kube_apiserver_pod_eviction_unreachable_timeout_seconds }}"
|
default-unreachable-toleration-seconds: "{{ kube_apiserver_pod_eviction_unreachable_timeout_seconds }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_api_anonymous_auth is defined %}
|
|
||||||
anonymous-auth: "{{ kube_api_anonymous_auth }}"
|
anonymous-auth: "{{ kube_api_anonymous_auth }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_use_authorization_config_file %}
|
{% if kube_apiserver_use_authorization_config_file %}
|
||||||
authorization-config: "{{ kube_config_dir }}/apiserver-authorization-config-{{ kube_apiserver_authorization_config_api_version }}.yaml"
|
authorization-config: "{{ kube_config_dir }}/apiserver-authorization-config-{{ kube_apiserver_authorization_config_api_version }}.yaml"
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -150,7 +142,7 @@ apiServer:
|
|||||||
{% if kube_apiserver_service_account_lookup %}
|
{% if kube_apiserver_service_account_lookup %}
|
||||||
service-account-lookup: "{{ kube_apiserver_service_account_lookup }}"
|
service-account-lookup: "{{ kube_apiserver_service_account_lookup }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_oidc_auth | default(false) and kube_oidc_url is defined and kube_oidc_client_id is defined %}
|
{% if kube_oidc_auth and kube_oidc_url is defined and kube_oidc_client_id is defined %}
|
||||||
oidc-issuer-url: "{{ kube_oidc_url }}"
|
oidc-issuer-url: "{{ kube_oidc_url }}"
|
||||||
oidc-client-id: "{{ kube_oidc_client_id }}"
|
oidc-client-id: "{{ kube_oidc_client_id }}"
|
||||||
{% if kube_oidc_ca_file is defined %}
|
{% if kube_oidc_ca_file is defined %}
|
||||||
@@ -169,7 +161,7 @@ apiServer:
|
|||||||
oidc-groups-prefix: "{{ kube_oidc_groups_prefix }}"
|
oidc-groups-prefix: "{{ kube_oidc_groups_prefix }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_token_auth | default(false) %}
|
{% if kube_webhook_token_auth %}
|
||||||
authentication-token-webhook-config-file: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
authentication-token-webhook-config-file: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_authorization and not kube_apiserver_use_authorization_config_file %}
|
{% if kube_webhook_authorization and not kube_apiserver_use_authorization_config_file %}
|
||||||
@@ -213,9 +205,7 @@ apiServer:
|
|||||||
tls-cipher-suites: {% for tls in tls_cipher_suites %}{{ tls }}{{ "," if not loop.last else "" }}{% endfor %}
|
tls-cipher-suites: {% for tls in tls_cipher_suites %}{{ tls }}{{ "," if not loop.last else "" }}{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if event_ttl_duration is defined %}
|
|
||||||
event-ttl: {{ event_ttl_duration }}
|
event-ttl: {{ event_ttl_duration }}
|
||||||
{% endif %}
|
|
||||||
{% if kubelet_rotate_server_certificates %}
|
{% if kubelet_rotate_server_certificates %}
|
||||||
kubelet-certificate-authority: {{ kube_cert_dir }}/ca.crt
|
kubelet-certificate-authority: {{ kube_cert_dir }}/ca.crt
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -229,12 +219,12 @@ apiServer:
|
|||||||
hostPath: {{ kube_token_dir }}
|
hostPath: {{ kube_token_dir }}
|
||||||
mountPath: {{ kube_token_dir }}
|
mountPath: {{ kube_token_dir }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_token_auth | default(false) %}
|
{% if kube_webhook_token_auth %}
|
||||||
- name: webhook-token-auth-config
|
- name: webhook-token-auth-config
|
||||||
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_authorization | default(false) %}
|
{% if kube_webhook_authorization %}
|
||||||
- name: webhook-authorization-config
|
- name: webhook-authorization-config
|
||||||
hostPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
hostPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
||||||
mountPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
mountPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
||||||
|
|||||||
@@ -125,22 +125,14 @@ certificatesDir: {{ kube_cert_dir }}
|
|||||||
imageRepository: {{ kube_image_repo }}
|
imageRepository: {{ kube_image_repo }}
|
||||||
apiServer:
|
apiServer:
|
||||||
extraArgs:
|
extraArgs:
|
||||||
{% if kube_apiserver_etcd_compaction_interval is defined %}
|
|
||||||
- name: etcd-compaction-interval
|
- name: etcd-compaction-interval
|
||||||
value: "{{ kube_apiserver_etcd_compaction_interval }}"
|
value: "{{ kube_apiserver_etcd_compaction_interval }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_pod_eviction_not_ready_timeout_seconds is defined %}
|
|
||||||
- name: default-not-ready-toleration-seconds
|
- name: default-not-ready-toleration-seconds
|
||||||
value: "{{ kube_apiserver_pod_eviction_not_ready_timeout_seconds }}"
|
value: "{{ kube_apiserver_pod_eviction_not_ready_timeout_seconds }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_pod_eviction_unreachable_timeout_seconds is defined %}
|
|
||||||
- name: default-unreachable-toleration-seconds
|
- name: default-unreachable-toleration-seconds
|
||||||
value: "{{ kube_apiserver_pod_eviction_unreachable_timeout_seconds }}"
|
value: "{{ kube_apiserver_pod_eviction_unreachable_timeout_seconds }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_api_anonymous_auth is defined %}
|
|
||||||
- name: anonymous-auth
|
- name: anonymous-auth
|
||||||
value: "{{ kube_api_anonymous_auth }}"
|
value: "{{ kube_api_anonymous_auth }}"
|
||||||
{% endif %}
|
|
||||||
{% if kube_apiserver_use_authorization_config_file %}
|
{% if kube_apiserver_use_authorization_config_file %}
|
||||||
- name: authorization-config
|
- name: authorization-config
|
||||||
value: "{{ kube_config_dir }}/apiserver-authorization-config-{{ kube_apiserver_authorization_config_api_version }}.yaml"
|
value: "{{ kube_config_dir }}/apiserver-authorization-config-{{ kube_apiserver_authorization_config_api_version }}.yaml"
|
||||||
@@ -186,7 +178,7 @@ apiServer:
|
|||||||
- name: service-account-lookup
|
- name: service-account-lookup
|
||||||
value: "{{ kube_apiserver_service_account_lookup }}"
|
value: "{{ kube_apiserver_service_account_lookup }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_oidc_auth | default(false) and kube_oidc_url is defined and kube_oidc_client_id is defined %}
|
{% if kube_oidc_auth and kube_oidc_url is defined and kube_oidc_client_id is defined %}
|
||||||
- name: oidc-issuer-url
|
- name: oidc-issuer-url
|
||||||
value: "{{ kube_oidc_url }}"
|
value: "{{ kube_oidc_url }}"
|
||||||
- name: oidc-client-id
|
- name: oidc-client-id
|
||||||
@@ -212,7 +204,7 @@ apiServer:
|
|||||||
value: "{{ kube_oidc_groups_prefix }}"
|
value: "{{ kube_oidc_groups_prefix }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_token_auth | default(false) %}
|
{% if kube_webhook_token_auth %}
|
||||||
- name: authentication-token-webhook-config-file
|
- name: authentication-token-webhook-config-file
|
||||||
value: "{{ kube_config_dir }}/webhook-token-auth-config.yaml"
|
value: "{{ kube_config_dir }}/webhook-token-auth-config.yaml"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -274,10 +266,8 @@ apiServer:
|
|||||||
- name: tls-cipher-suites
|
- name: tls-cipher-suites
|
||||||
value: "{% for tls in tls_cipher_suites %}{{ tls }}{{ ',' if not loop.last else '' }}{% endfor %}"
|
value: "{% for tls in tls_cipher_suites %}{{ tls }}{{ ',' if not loop.last else '' }}{% endfor %}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if event_ttl_duration is defined %}
|
|
||||||
- name: event-ttl
|
- name: event-ttl
|
||||||
value: "{{ event_ttl_duration }}"
|
value: "{{ event_ttl_duration }}"
|
||||||
{% endif %}
|
|
||||||
{% if kubelet_rotate_server_certificates %}
|
{% if kubelet_rotate_server_certificates %}
|
||||||
- name: kubelet-certificate-authority
|
- name: kubelet-certificate-authority
|
||||||
value: "{{ kube_cert_dir }}/ca.crt"
|
value: "{{ kube_cert_dir }}/ca.crt"
|
||||||
@@ -293,12 +283,12 @@ apiServer:
|
|||||||
hostPath: {{ kube_token_dir }}
|
hostPath: {{ kube_token_dir }}
|
||||||
mountPath: {{ kube_token_dir }}
|
mountPath: {{ kube_token_dir }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_token_auth | default(false) %}
|
{% if kube_webhook_token_auth %}
|
||||||
- name: webhook-token-auth-config
|
- name: webhook-token-auth-config
|
||||||
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kube_webhook_authorization | default(false) %}
|
{% if kube_webhook_authorization %}
|
||||||
- name: webhook-authorization-config
|
- name: webhook-authorization-config
|
||||||
hostPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
hostPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
||||||
mountPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
mountPath: {{ kube_config_dir }}/webhook-authorization-config.yaml
|
||||||
@@ -395,12 +385,6 @@ controllerManager:
|
|||||||
- name: "{{ key }}"
|
- name: "{{ key }}"
|
||||||
value: "{{ kube_kubeadm_controller_extra_args[key] }}"
|
value: "{{ kube_kubeadm_controller_extra_args[key] }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "gce"] %}
|
|
||||||
- name: cloud-provider
|
|
||||||
value: "{{ cloud_provider }}"
|
|
||||||
- name: cloud-config
|
|
||||||
value: "{{ kube_config_dir }}/cloud_config"
|
|
||||||
{% endif %}
|
|
||||||
{% if kube_network_plugin is defined and kube_network_plugin not in ["cloud"] %}
|
{% if kube_network_plugin is defined and kube_network_plugin not in ["cloud"] %}
|
||||||
- name: configure-cloud-routes
|
- name: configure-cloud-routes
|
||||||
value: "false"
|
value: "false"
|
||||||
@@ -417,18 +401,8 @@ controllerManager:
|
|||||||
- name: tls-cipher-suites
|
- name: tls-cipher-suites
|
||||||
value: "{% for tls in tls_cipher_suites %}{{ tls }}{{ ',' if not loop.last else '' }}{% endfor %}"
|
value: "{% for tls in tls_cipher_suites %}{{ tls }}{{ ',' if not loop.last else '' }}{% endfor %}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "gce"] or controller_manager_extra_volumes %}
|
{% if controller_manager_extra_volumes %}
|
||||||
extraVolumes:
|
extraVolumes:
|
||||||
{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %}
|
|
||||||
- name: openstackcacert
|
|
||||||
hostPath: "{{ kube_config_dir }}/openstack-cacert.pem"
|
|
||||||
mountPath: "{{ kube_config_dir }}/openstack-cacert.pem"
|
|
||||||
{% endif %}
|
|
||||||
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "gce"] %}
|
|
||||||
- name: cloud-config
|
|
||||||
hostPath: {{ kube_config_dir }}/cloud_config
|
|
||||||
mountPath: {{ kube_config_dir }}/cloud_config
|
|
||||||
{% endif %}
|
|
||||||
{% for volume in controller_manager_extra_volumes %}
|
{% for volume in controller_manager_extra_volumes %}
|
||||||
- name: {{ volume.name }}
|
- name: {{ volume.name }}
|
||||||
hostPath: {{ volume.hostPath }}
|
hostPath: {{ volume.hostPath }}
|
||||||
|
|||||||
Reference in New Issue
Block a user