From 6f9f80acee94b5a11d89e7f89a3be72726c6629a Mon Sep 17 00:00:00 2001 From: Kevin Schuck Date: Wed, 19 Sep 2018 09:22:52 -0500 Subject: [PATCH 1/2] Uses etcdv3 for calico 3 rr_v4 resources --- roles/network_plugin/calico/rr/tasks/main.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/network_plugin/calico/rr/tasks/main.yml b/roles/network_plugin/calico/rr/tasks/main.yml index 02cfce152..2447718a2 100644 --- a/roles/network_plugin/calico/rr/tasks/main.yml +++ b/roles/network_plugin/calico/rr/tasks/main.yml @@ -47,6 +47,25 @@ notify: restart calico-rr - name: Calico-rr | Configure route reflector + command: |- + {{ bin_dir }}/etcdctl \ + --endpoints={{ etcd_access_addresses }} \ + --cert={{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}.pem \ + --key={{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}-key.pem \ + put /calico/bgp/v1/rr_v4/{{ rr_ip }} \ + '{ + "ip": "{{ rr_ip }}", + "cluster_id": "{{ cluster_id }}" + }' + environment: + ETCDCTL_API: 3 + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" + delegate_to: "{{groups['etcd'][0]}}" + when: + - calico_version | version_compare("v3.0.0", ">=") + +- name: Calico-rr | Configure route reflector (legacy) command: |- {{ bin_dir }}/etcdctl \ --peers={{ etcd_access_addresses }} \ @@ -60,6 +79,8 @@ retries: 4 delay: "{{ retry_stagger | random + 3 }}" delegate_to: "{{groups['etcd'][0]}}" + when: + - calico_version | version_compare("v3.0.0", "<") - meta: flush_handlers From 639010b3df50178d31f3b22aa06a4e0e014fdd81 Mon Sep 17 00:00:00 2001 From: Kevin Schuck Date: Wed, 19 Sep 2018 12:32:16 -0500 Subject: [PATCH 2/2] Uses environment vars for etcd cert paths --- roles/network_plugin/calico/rr/tasks/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/network_plugin/calico/rr/tasks/main.yml b/roles/network_plugin/calico/rr/tasks/main.yml index 2447718a2..521da1e4a 100644 --- a/roles/network_plugin/calico/rr/tasks/main.yml +++ b/roles/network_plugin/calico/rr/tasks/main.yml @@ -50,8 +50,6 @@ command: |- {{ bin_dir }}/etcdctl \ --endpoints={{ etcd_access_addresses }} \ - --cert={{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}.pem \ - --key={{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}-key.pem \ put /calico/bgp/v1/rr_v4/{{ rr_ip }} \ '{ "ip": "{{ rr_ip }}", @@ -59,6 +57,8 @@ }' environment: ETCDCTL_API: 3 + ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}.pem" + ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}-key.pem" retries: 4 delay: "{{ retry_stagger | random + 3 }}" delegate_to: "{{groups['etcd'][0]}}" @@ -69,13 +69,14 @@ command: |- {{ bin_dir }}/etcdctl \ --peers={{ etcd_access_addresses }} \ - --cert-file {{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}.pem \ - --key-file {{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}-key.pem \ set /calico/bgp/v1/rr_v4/{{ rr_ip }} \ '{ "ip": "{{ rr_ip }}", "cluster_id": "{{ cluster_id }}" }' + environment: + ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}.pem" + ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ groups['etcd'][0] }}-key.pem" retries: 4 delay: "{{ retry_stagger | random + 3 }}" delegate_to: "{{groups['etcd'][0]}}"