Improve variable handling for disabling etcd events cluster

This commit is contained in:
Matthew Mosesohn 2018-06-18 16:19:12 +03:00
parent 6aaaf4a272
commit 61e97251a5
5 changed files with 7 additions and 4 deletions

View file

@ -51,7 +51,7 @@
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
roles: roles:
- { role: kubespray-defaults} - { role: kubespray-defaults}
- { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: true } - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
- hosts: k8s-cluster:calico-rr - hosts: k8s-cluster:calico-rr
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ any_errors_fatal | default(true) }}"

View file

@ -3,6 +3,9 @@
etcd_cluster_setup: true etcd_cluster_setup: true
etcd_events_cluster_setup: false etcd_events_cluster_setup: false
# Set to true to separate k8s events to a different etcd cluster
etcd_events_cluster_enabled: false
etcd_backup_prefix: "/var/backups" etcd_backup_prefix: "/var/backups"
etcd_data_dir: "/var/lib/etcd" etcd_data_dir: "/var/lib/etcd"
etcd_events_data_dir: "/var/lib/etcd-events" etcd_events_data_dir: "/var/lib/etcd-events"

View file

@ -39,7 +39,7 @@ apiServerExtraArgs:
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version | version_compare('v1.9', '>=') %}
endpoint-reconciler-type: lease endpoint-reconciler-type: lease
{% endif %} {% endif %}
{% if etcd_events_cluster_setup %} {% if etcd_events_cluster_enabled %}
etcd-servers-overrides: "/events#{{ etcd_events_access_addresses }}" etcd-servers-overrides: "/events#{{ etcd_events_access_addresses }}"
{% endif %} {% endif %}
service-node-port-range: {{ kube_apiserver_node_port_range }} service-node-port-range: {{ kube_apiserver_node_port_range }}

View file

@ -30,7 +30,7 @@ spec:
- apiserver - apiserver
- --advertise-address={{ ip | default(ansible_default_ipv4.address) }} - --advertise-address={{ ip | default(ansible_default_ipv4.address) }}
- --etcd-servers={{ etcd_access_addresses }} - --etcd-servers={{ etcd_access_addresses }}
{% if etcd_events_cluster_setup %} {% if etcd_events_cluster_enabled %}
- --etcd-servers-overrides=/events#{{ etcd_events_access_addresses }} - --etcd-servers-overrides=/events#{{ etcd_events_access_addresses }}
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.9', '<') %} {% if kube_version | version_compare('v1.9', '<') %}

View file

@ -314,7 +314,7 @@ kube_apiserver_client_key: |-
{%- endif %} {%- endif %}
# Set to true to deploy etcd-events cluster # Set to true to deploy etcd-events cluster
etcd_events_cluster_setup: false etcd_events_cluster_enabled: false
# Vars for pointing to etcd endpoints # Vars for pointing to etcd endpoints
is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}" is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"