Skip to content

Commit

Permalink
like calico(kdd) cni, no need run etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
liupeng0518 committed Aug 19, 2022
1 parent 63cf42c commit 8dc1dd7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions roles/etcd/tasks/check_certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'{{ etcd_cert_dir }}/member-{{ host }}.pem',
'{{ etcd_cert_dir }}/member-{{ host }}-key.pem',
{% endfor %}
{% set k8s_nodes = groups['kube_control_plane']|unique|sort %}
{% set k8s_nodes = groups['kube_control_plane'] %}
{% for host in k8s_nodes %}
'{{ etcd_cert_dir }}/node-{{ host }}.pem',
'{{ etcd_cert_dir }}/node-{{ host }}-key.pem'
Expand Down Expand Up @@ -114,7 +114,7 @@
set_fact:
gen_node_certs: |-
{
{% set k8s_nodes = groups['k8s_cluster']|unique|sort -%}
{% set k8s_nodes = groups['k8s_cluster'] -%}
{% set existing_certs = etcdcert_master.files|map(attribute='path')|list|sort %}
{% for host in k8s_nodes -%}
{% set host_cert = "%s/node-%s.pem"|format(etcd_cert_dir, host) %}
Expand Down
2 changes: 1 addition & 1 deletion roles/etcd/tasks/gen_certs_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
src: "{{ item }}"
register: etcd_master_node_certs
with_items:
- "[{% for node in (groups['k8s_cluster'])|unique %}
- "[{% for node in groups['k8s_cluster'] %}
'{{ etcd_cert_dir }}/node-{{ node }}.pem',
'{{ etcd_cert_dir }}/node-{{ node }}-key.pem',
{% endfor %}]"
Expand Down
6 changes: 3 additions & 3 deletions roles/etcd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
when:
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
- kube_network_plugin != "calico" or calico_datastore == "etcd"
- inventory_hostname in groups['k8s_cluster']|unique|sort
- inventory_hostname in groups['k8s_cluster']
tags:
- etcd-secrets

Expand All @@ -33,7 +33,7 @@
when:
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
- kube_network_plugin != "calico" or calico_datastore == "etcd"
- inventory_hostname in groups['k8s_cluster']|unique|sort
- inventory_hostname in groups['k8s_cluster']
tags:
- master
- network
Expand All @@ -44,7 +44,7 @@
when:
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
- kube_network_plugin != "calico" or calico_datastore == "etcd"
- inventory_hostname in groups['k8s_cluster']|unique|sort
- inventory_hostname in groups['k8s_cluster']
tags:
- master
- network
Expand Down
9 changes: 8 additions & 1 deletion scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: etcd, tags: etcd, etcd_cluster_setup: false }
- role: etcd
tags: etcd
vars:
etcd_cluster_setup: false
when:
- etcd_deployment_type != "kubeadm"
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
- kube_network_plugin != "calico" or calico_datastore == "etcd"

- name: Download images to ansible host cache via first kube_control_plane node
hosts: kube_control_plane[0]
Expand Down

0 comments on commit 8dc1dd7

Please sign in to comment.