Support --ipip option for calico pool

Adds new boolean configuration variable for calico network plugin
`ipip`. When it's enabled calico pool is created with '--ipip'
option (IP-over-IP encapsulation across hosts).

Also refactor pool creation tasks to simplify logic and make tasks
more readable.
This commit is contained in:
Aleksandr Didenko 2016-07-21 13:05:40 +02:00
parent 277c5d74cc
commit f94eb0b997
2 changed files with 19 additions and 12 deletions

View file

@ -2,6 +2,9 @@
# Enables Internet connectivity from containers # Enables Internet connectivity from containers
nat_outgoing: true nat_outgoing: true
# Use IP-over-IP encapsulation across hosts
ipip: false
# cloud_provider can only be set to 'gce' or 'aws' # cloud_provider can only be set to 'gce' or 'aws'
# cloud_provider: # cloud_provider:
calicoctl_image_repo: calico/ctl calicoctl_image_repo: calico/ctl

View file

@ -50,23 +50,27 @@
register: calico_conf register: calico_conf
run_once: true run_once: true
- name: Calico | Configure calico network pool - name: Calico | Define ipip pool argument
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }}"
run_once: true run_once: true
when: calico_conf.status == 404 and cloud_provider is not defined set_fact:
and not nat_outgoing|default(false) or ipip_arg: "--ipip"
(nat_outgoing|default(false) and peer_with_router|default(false)) when: cloud_provider is defined or ipip|default(false)
- name: Calico | Configure calico network pool for cloud - name: Calico | Define nat-outgoing pool argument
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }} --ipip --nat-outgoing"
run_once: true run_once: true
when: calico_conf.status == 404 and cloud_provider is defined set_fact:
nat_arg: "--nat-outgoing"
when: nat_outgoing|default(false) and not peer_with_router|default(false)
- name: Calico | Configure calico network pool with nat outgoing - name: Calico | Define calico pool task name
command: "{{ bin_dir}}/calicoctl pool add {{ kube_pods_subnet }} --nat-outgoing" set_fact:
pool_task_name: "with options {{ ipip_arg|default('') }} {{ nat_arg|default('') }}"
when: ipip_arg|default(false) or nat_arg|default(false)
- name: Calico | Configure calico network pool {{ pool_task_name|default('') }}
command: "{{ bin_dir}}/calicoctl pool add {{ kube_pods_subnet }} {{ ipip_arg|default('') }} {{ nat_arg|default('') }}"
run_once: true run_once: true
when: calico_conf.status == 404 and cloud_provider is not defined when: calico_conf.status == 404
and nat_outgoing|default(false) and not peer_with_router|default(false)
- name: Calico | Get calico configuration from etcd - name: Calico | Get calico configuration from etcd
uri: uri: