mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-01 17:48:12 -03:30
Merge pull request #335 from mattymo/calicoctl
Change calicoctl deployment to use container
This commit is contained in:
@@ -4,3 +4,5 @@ nat_outgoing: true
|
||||
|
||||
# cloud_provider can only be set to 'gce' or 'aws'
|
||||
# cloud_provider:
|
||||
calicoctl_image_repo: calico/ctl
|
||||
calicoctl_image_tag: "{{ calico_version }}"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: download
|
||||
file: "{{ downloads.calico }}"
|
||||
- role: download
|
||||
file: "{{ downloads.calico_cni_plugin }}"
|
||||
- role: download
|
||||
|
||||
@@ -19,10 +19,15 @@
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Calico | Install calicoctl bin
|
||||
command: rsync -piu "{{ local_release_dir }}/calico/bin/calicoctl" "{{ bin_dir }}/calicoctl"
|
||||
register: calico_copy
|
||||
- name: Calico | Install calicoctl container script
|
||||
template:
|
||||
src: calicoctl-container.j2
|
||||
dest: "{{ bin_dir }}/calicoctl"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
changed_when: false
|
||||
notify: restart calico-node
|
||||
|
||||
- name: Calico | Install calico cni bin
|
||||
command: rsync -piu "{{ local_release_dir }}/calico/bin/calico" "/opt/cni/bin/calico"
|
||||
@@ -32,9 +37,6 @@
|
||||
command: rsync -piu "{{ local_release_dir }}/calico/bin/calico" "/opt/cni/bin/calico-ipam"
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | install calicoctl
|
||||
file: path={{ bin_dir }}/calicoctl mode=0755 state=file
|
||||
|
||||
- name: Calico | wait for etcd
|
||||
wait_for:
|
||||
port: 2379
|
||||
@@ -108,21 +110,12 @@
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: Calico | Restart calico if binary changed
|
||||
service:
|
||||
name: calico-node
|
||||
state: restarted
|
||||
when: calico_copy.stdout_lines
|
||||
|
||||
- name: Calico | Disable node mesh
|
||||
shell: "{{ bin_dir }}/calicoctl bgp node-mesh off"
|
||||
environment:
|
||||
ETCD_AUTHORITY: "127.0.0.1:2379"
|
||||
when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']
|
||||
|
||||
- name: Calico | Configure peering with router(s)
|
||||
shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ item.router_id }} as {{ item.as }}"
|
||||
environment:
|
||||
ETCD_AUTHORITY: "127.0.0.1:2379"
|
||||
with_items: peers
|
||||
when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/docker run --privileged --rm \
|
||||
--net=host -e ETCD_AUTHORITY=127.0.0.1:2379 \
|
||||
-v /usr/bin/docker:/usr/bin/docker \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /var/run/calico:/var/run/calico \
|
||||
{{ calicoctl_image_repo }}:{{ calicoctl_image_tag}} \
|
||||
$@
|
||||
Reference in New Issue
Block a user