From cf4dd645a77bf69e63f72d19ba1e269af3c6f3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=97=AD?= Date: Tue, 16 Oct 2018 22:25:03 +0800 Subject: [PATCH] fix --etcd-servers-overrides invalid (#3470) --- .../master/templates/manifests/kube-apiserver.manifest.j2 | 2 +- roles/kubespray-defaults/defaults/main.yaml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 index 250ca1257..47f0de3e8 100644 --- a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 @@ -41,7 +41,7 @@ spec: - --advertise-address={{ ip | default(ansible_default_ipv4.address) }} - --etcd-servers={{ etcd_access_addresses }} {% if etcd_events_cluster_enabled %} - - --etcd-servers-overrides=/events#{{ etcd_events_access_addresses }} + - --etcd-servers-overrides=/events#{{ etcd_events_access_addresses_semicolon }} {% endif %} {% if kube_version | version_compare('v1.9', '<') %} - --etcd-quorum-read=true diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 27b000f71..6215a16ff 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -425,10 +425,14 @@ etcd_access_addresses: |- {% for item in groups['etcd'] -%} https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %} {%- endfor %} -etcd_events_access_addresses: |- +etcd_events_access_addresses_list: |- + [ {% for item in groups['etcd'] -%} - https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2381{% if not loop.last %},{% endif %} + 'https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2381'{% if not loop.last %},{% endif %} {%- endfor %} + ] +etcd_events_access_addresses: "{{etcd_events_access_addresses_list | join(',')}}" +etcd_events_access_addresses_semicolon: "{{etcd_events_access_addresses_list | join(';')}}" # user should set etcd_member_name in inventory/mycluster/hosts.ini etcd_member_name: |- {% for host in groups['etcd'] %}