Browse Source
Add calico/routereflector support
Add calico/routereflector support
Add BGP route reflectors support in order to optimize BGP topology for deployments with Calico network plugin. Also bump version of calico/ctl for some bug fixes.pull/721/head
14 changed files with 264 additions and 9 deletions
Unified View
Diff Options
-
5cluster.yml
-
79docs/calico.md
-
BINdocs/figures/kargo-calico-rr.png
-
11roles/download/defaults/main.yml
-
2roles/kubernetes/preinstall/tasks/set_facts.yml
-
6roles/kubernetes/secrets/tasks/gen_certs.yml
-
3roles/network_plugin/calico/defaults/main.yml
-
7roles/network_plugin/calico/rr/defaults/main.yml
-
15roles/network_plugin/calico/rr/handlers/main.yml
-
6roles/network_plugin/calico/rr/meta/main.yml
-
63roles/network_plugin/calico/rr/tasks/main.yml
-
6roles/network_plugin/calico/rr/templates/calico-rr.env.j2
-
27roles/network_plugin/calico/rr/templates/calico-rr.service.j2
-
43roles/network_plugin/calico/tasks/main.yml
@ -0,0 +1,7 @@ |
|||||
|
--- |
||||
|
# Global as_num (/calico/bgp/v1/global/as_num) |
||||
|
# should be the same as in calico role |
||||
|
global_as_num: "64512" |
||||
|
|
||||
|
calico_cert_dir: /etc/calico/certs |
||||
|
etcd_cert_dir: /etc/ssl/etcd/ssl |
@ -0,0 +1,15 @@ |
|||||
|
--- |
||||
|
- name: restart calico-rr |
||||
|
command: /bin/true |
||||
|
notify: |
||||
|
- Calico-rr | reload systemd |
||||
|
- Calico-rr | reload calico-rr |
||||
|
|
||||
|
- name : Calico-rr | reload systemd |
||||
|
shell: systemctl daemon-reload |
||||
|
when: ansible_service_mgr == "systemd" |
||||
|
|
||||
|
- name: Calico-rr | reload calico-rr |
||||
|
service: |
||||
|
name: calico-rr |
||||
|
state: restarted |
@ -0,0 +1,6 @@ |
|||||
|
dependencies: |
||||
|
- role: kubernetes/secrets |
||||
|
- role: docker |
||||
|
when: ansible_os_family != "CoreOS" |
||||
|
- role: download |
||||
|
file: "{{ downloads.calico_rr }}" |
@ -0,0 +1,63 @@ |
|||||
|
--- |
||||
|
# Required from inventory: |
||||
|
# calico_rr_ip - which specific IP to use for RR, defaults to |
||||
|
# "ip" from inventory or "ansible_default_ipv4.address" |
||||
|
|
||||
|
- name: Calico-rr | Set IP fact |
||||
|
set_fact: |
||||
|
rr_ip: "{{ calico_rr_ip | default(ip) | default(ansible_default_ipv4.address) }}" |
||||
|
|
||||
|
- name: Calico | Create calico certs directory |
||||
|
file: |
||||
|
dest: "{{ calico_cert_dir }}" |
||||
|
state: directory |
||||
|
mode: 0750 |
||||
|
owner: root |
||||
|
group: root |
||||
|
|
||||
|
- name: Calico | Link etcd certificates for calico-node |
||||
|
file: |
||||
|
src: "{{ kube_cert_dir }}/{{ item.s }}" |
||||
|
dest: "{{ calico_cert_dir }}/{{ item.d }}" |
||||
|
state: hard |
||||
|
force: yes |
||||
|
with_items: |
||||
|
- {s: "ca.pem", d: "ca_cert.crt"} |
||||
|
- {s: "node.pem", d: "cert.crt"} |
||||
|
- {s: "node-key.pem", d: "key.pem"} |
||||
|
|
||||
|
- name: Calico-rr | Create dir for logs |
||||
|
file: |
||||
|
path: /var/log/calico-rr |
||||
|
state: directory |
||||
|
mode: 0755 |
||||
|
owner: root |
||||
|
group: root |
||||
|
|
||||
|
- name: Calico-rr | Write calico-rr.env for systemd init file |
||||
|
template: src=calico-rr.env.j2 dest=/etc/calico/calico-rr.env |
||||
|
when: ansible_service_mgr == "systemd" |
||||
|
notify: restart calico-rr |
||||
|
|
||||
|
- name: Calico-rr | Write calico-rr systemd init file |
||||
|
template: src=calico-rr.service.j2 dest=/etc/systemd/system/calico-rr.service |
||||
|
when: ansible_service_mgr == "systemd" |
||||
|
notify: restart calico-rr |
||||
|
|
||||
|
- name: Calico-rr | Configure route reflector |
||||
|
command: |- |
||||
|
{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \ |
||||
|
set /calico/bgp/v1/rr_v4/{{ rr_ip }} \ |
||||
|
'{ |
||||
|
"ip": "{{ rr_ip }}", |
||||
|
"cluster_id": "{{ cluster_id }}" |
||||
|
}' |
||||
|
delegate_to: "{{groups['etcd'][0]}}" |
||||
|
|
||||
|
- meta: flush_handlers |
||||
|
|
||||
|
- name: Calico-rr | Enable calico-rr |
||||
|
service: |
||||
|
name: calico-rr |
||||
|
state: started |
||||
|
enabled: yes |
@ -0,0 +1,6 @@ |
|||||
|
ETCD_ENDPOINTS="{{ etcd_access_endpoint }}" |
||||
|
ETCD_CA_CERT_FILE="{{ calico_cert_dir }}/ca_cert.crt" |
||||
|
ETCD_CERT_FILE="{{ calico_cert_dir }}/cert.crt" |
||||
|
ETCD_KEY_FILE="{{ calico_cert_dir }}/key.pem" |
||||
|
IP="{{ rr_ip }}" |
||||
|
IP6="" |
@ -0,0 +1,27 @@ |
|||||
|
[Unit] |
||||
|
Description=calico-rr |
||||
|
After=docker.service |
||||
|
Requires=docker.service |
||||
|
|
||||
|
[Service] |
||||
|
EnvironmentFile=/etc/calico/calico-rr.env |
||||
|
ExecStartPre=-/usr/bin/docker rm -f calico-rr |
||||
|
ExecStart=/usr/bin/docker run --net=host --privileged \ |
||||
|
--name=calico-rr \ |
||||
|
-e IP=${IP} \ |
||||
|
-e IP6=${IP6} \ |
||||
|
-e ETCD_ENDPOINTS=${ETCD_ENDPOINTS} \ |
||||
|
-e ETCD_CA_CERT_FILE=${ETCD_CA_CERT_FILE} \ |
||||
|
-e ETCD_CERT_FILE=${ETCD_CERT_FILE} \ |
||||
|
-e ETCD_KEY_FILE=${ETCD_KEY_FILE} \ |
||||
|
-v /var/log/calico-rr:/var/log/calico \ |
||||
|
-v {{ calico_cert_dir }}:{{ calico_cert_dir }}:ro \ |
||||
|
{{ calico_rr_image_repo }}:{{ calico_rr_image_tag }} |
||||
|
|
||||
|
Restart=always |
||||
|
RestartSec=10s |
||||
|
|
||||
|
ExecStop=-/usr/bin/docker stop calico-rr |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=multi-user.target |
Write
Preview
Loading…
Cancel
Save