Skip to content

Commit 872787e

Browse files
author
KARTHIK S
committed
[Issue-12117]-Certificates for the new hosts are not generated during scale.yml
1 parent d42525b commit 872787e

File tree

2 files changed

+2
-42
lines changed

2 files changed

+2
-42
lines changed

playbooks/scale.yml

+2-16
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,8 @@
55
- name: Gather facts
66
import_playbook: facts.yml
77

8-
- name: Generate the etcd certificates beforehand
9-
hosts: etcd:kube_control_plane
10-
gather_facts: false
11-
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
12-
environment: "{{ proxy_disable_env }}"
13-
roles:
14-
- { role: kubespray-defaults }
15-
- role: etcd
16-
tags: etcd
17-
vars:
18-
etcd_cluster_setup: false
19-
etcd_events_cluster_setup: false
20-
when:
21-
- etcd_deployment_type != "kubeadm"
22-
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
23-
- kube_network_plugin != "calico" or calico_datastore == "etcd"
8+
- name: Install etcd
9+
import_playbook: install_etcd.yml
2410

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

roles/etcd/tasks/check_certs.yml

-26
Original file line numberDiff line numberDiff line change
@@ -95,32 +95,6 @@
9595
key: "gen_{{ item.node_type }}_certs_{{ force_etcd_cert_refresh or item.certs is not subset(existing_certs) }}"
9696
loop: "{{ cert_files | dict2items(key_name='node_type', value_name='certs') }}"
9797

98-
- name: "Check_certs | Set 'gen_node_certs' object to track which nodes needs to have certs generated on first etcd node"
99-
set_fact:
100-
gen_node_certs: |-
101-
{
102-
{% set k8s_nodes = groups['k8s_cluster'] -%}
103-
{% set existing_certs = etcdcert_master.files | map(attribute='path') | list | sort %}
104-
{% for host in k8s_nodes -%}
105-
{% set host_cert = "%s/node-%s.pem" | format(etcd_cert_dir, host) %}
106-
{% set host_key = "%s/node-%s-key.pem" | format(etcd_cert_dir, host) %}
107-
{% if force_etcd_cert_refresh -%}
108-
"{{ host }}"{% if not loop.last %},{% endif %}
109-
{% elif host_cert not in existing_certs and host_key not in existing_certs -%}
110-
"{{ host }}"{% if not loop.last %},{% endif %}
111-
{% endif -%}
112-
{% endfor %}
113-
}
114-
run_once: true
115-
116-
- name: "Check_certs | Add gen_node_certs object into 'gen_node_certs_True' group on first etcd node"
117-
ansible.builtin.add_host:
118-
name: "{{ item }}"
119-
groups: gen_node_certs_True
120-
with_items: "{{ gen_node_certs }}"
121-
run_once: true
122-
when: gen_node_certs | length > 0
123-
12498
- name: "Check_certs | Set 'etcd_member_requires_sync' to true if ca or member/admin cert and key don't exist on etcd member or checksum doesn't match"
12599
set_fact:
126100
etcd_member_requires_sync: true

0 commit comments

Comments
 (0)