Skip to content

Commit

Permalink
Update Kube-router version to v0.4.0 (kubernetes-sigs#5756)
Browse files Browse the repository at this point in the history
  • Loading branch information
bozzo authored Mar 17, 2020
1 parent 45626a0 commit 974902a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Note: Upstart/SysV init based OS types are not supported.
- [cilium](https://github.com/cilium/cilium) v1.5.5
- [contiv](https://github.com/contiv/install) v1.2.1
- [flanneld](https://github.com/coreos/flannel) v0.11.0
- [kube-router](https://github.com/cloudnativelabs/kube-router) v0.2.5
- [kube-router](https://github.com/cloudnativelabs/kube-router) v0.4.0
- [multus](https://github.com/intel/multus-cni) v3.4
- [weave](https://github.com/weaveworks/weave) v2.5.2
- Application
Expand Down
2 changes: 1 addition & 1 deletion roles/download/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pod_infra_version: 3.1
contiv_version: 1.2.1
cilium_version: "v1.7.1"
kube_ovn_version: "v0.6.0"
kube_router_version: "v0.2.5"
kube_router_version: "v0.4.0"
multus_version: "v3.4"

# Get kubernetes major version (i.e. 1.15.4 => 1.15)
Expand Down
28 changes: 11 additions & 17 deletions roles/network_plugin/kube-router/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

- name: kube-router | Slurp cni config
slurp:
src: /etc/cni/net.d/10-kuberouter.conf
src: /etc/cni/net.d/10-kuberouter.conflist
register: cni_config_slurp
ignore_errors: true

Expand All @@ -49,30 +49,24 @@

- name: kube-router | Set host_subnet variable
set_fact:
host_subnet: "{{ cni_config.ipam.subnet }}"
host_subnet: "{{ cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | first }}"
when:
- cni_config is defined
- cni_config.ipam is defined
- cni_config.ipam.subnet is defined

- name: kube-router | Set wanted cni config variable
set_fact:
wanted_cni_config: "{{ lookup('template', 'cni-conf.json.j2') }}"

- name: kube-router | Set wanted_cni_config variable
set_fact:
wanted_cni_config: "{{ wanted_cni_config | combine({ 'ipam': { 'subnet': host_subnet }}, recursive=True) }}"
when: host_subnet is defined
- cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | length > 0

- name: kube-router | Create cni config
copy:
content: "{{ wanted_cni_config | to_nice_json }}"
dest: /etc/cni/net.d/10-kuberouter.conf
template:
src: cni-conf.json.j2
dest: /etc/cni/net.d/10-kuberouter.conflist
owner: kube
changed_when: wanted_cni_config != cni_config
notify:
- reset_kube_router

- name: kube-router | Delete old configuration
file:
path: /etc/cni/net.d/10-kuberouter.conf
state: absent

- name: kube-router | Create manifest
template:
src: kube-router.yml.j2
Expand Down
26 changes: 17 additions & 9 deletions roles/network_plugin/kube-router/templates/cni-conf.json.j2
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"name":"kubernetes",
"cniVersion": "0.2.0",
"type":"bridge",
"bridge":"kube-bridge",
"isDefaultGateway":true,
"cniVersion":"0.3.0",
"name":"kubernetes",
"plugins":[
{
"name":"kubernetes",
"type":"bridge",
"bridge":"kube-bridge",
"isDefaultGateway":true,
{% if kube_router_support_hairpin_mode %}
"hairpinMode":true,
"hairpinMode":true,
{% endif %}
"ipam": {
"type":"host-local"
}
"ipam":{
{% if host_subnet is defined %}
"subnet": "{{ host_subnet }}",
{% endif %}
"type":"host-local"
}
}
]
}
2 changes: 2 additions & 0 deletions roles/network_plugin/kube-router/templates/kube-router.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: KUBE_ROUTER_CNI_CONF_FILE
value: /etc/cni/net.d/10-kuberouter.conflist
livenessProbe:
httpGet:
path: /healthz
Expand Down

0 comments on commit 974902a

Please sign in to comment.