Browse Source

Add kube-router annotations (#3533)

pull/3565/head
Egor 6 years ago
committed by k8s-ci-robot
parent
commit
ccc3f89060
5 changed files with 63 additions and 1 deletions
  1. 17
      docs/kube-router.md
  2. 9
      inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml
  3. 12
      roles/network_plugin/kube-router/defaults/main.yml
  4. 21
      roles/network_plugin/kube-router/tasks/annotate.yml
  5. 5
      roles/network_plugin/kube-router/tasks/main.yml

17
docs/kube-router.md

@ -89,3 +89,20 @@ kubeadm_enabled: true
kube_router_run_service_proxy: true
kube_proxy_mode: ipvs
```
## Advanced BGP Capabilities
https://github.com/cloudnativelabs/kube-router#advanced-bgp-capabilities
If you have other networking devices or SDN systems that talk BGP, kube-router will fit in perfectly.
From a simple full node-to-node mesh to per-node peering configurations, most routing needs can be attained.
The configuration is Kubernetes native (annotations) just like the rest of kube-router.
For more details please refer to the https://github.com/cloudnativelabs/kube-router/blob/master/docs/bgp.md.
Next options will set up annotations for kube-router, using `kubectl annotate` command.
```
kube_router_annotations_master: []
kube_router_annotations_node: []
kube_router_annotations_all: []
```

9
inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml

@ -35,3 +35,12 @@
# Setups node CNI to allow hairpin mode, requires node reboots, see
# https://github.com/cloudnativelabs/kube-router/blob/master/docs/user-guide.md#hairpin-mode
# kube_router_support_hairpin_mode: false
# Array of annotations for master
# kube_router_annotations_master: []
# Array of annotations for every node
# kube_router_annotations_node: []
# Array of common annotations for every node
# kube_router_annotations_all: []

12
roles/network_plugin/kube-router/defaults/main.yml

@ -34,3 +34,15 @@ kube_router_peer_router_ports: ~
# Setups node CNI to allow hairpin mode, requires node reboots, see
# https://github.com/cloudnativelabs/kube-router/blob/master/docs/user-guide.md#hairpin-mode
kube_router_support_hairpin_mode: false
# Adds annotations to kubernetes nodes for advanced configuration of BGP Peers.
# https://github.com/cloudnativelabs/kube-router/blob/master/docs/bgp.md
# Array of annotations for master
kube_router_annotations_master: []
# Array of annotations for every node
kube_router_annotations_node: []
# Array of common annotations for every node
kube_router_annotations_all: []

21
roles/network_plugin/kube-router/tasks/annotate.yml

@ -0,0 +1,21 @@
---
- name: kube-router | Add annotations on kube-master
command: "{{bin_dir}}/kubectl annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_master }}"
delegate_to: "{{groups['kube-master'][0]}}"
when: kube_router_annotations_master is defined
- name: kube-router | Add annotations on kube-node
command: "{{bin_dir}}/kubectl annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_node }}"
delegate_to: "{{groups['kube-master'][0]}}"
when: kube_router_annotations_node is defined
- name: kube-router | Add common annotations on all servers
command: "{{bin_dir}}/kubectl annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_all }}"
delegate_to: "{{groups['kube-master'][0]}}"
when: kube_router_annotations_all is defined

5
roles/network_plugin/kube-router/tasks/main.yml

@ -1,4 +1,7 @@
---
- name: kube-router | Create annotations
include: annotate.yml
tags: annotate
- name: kube-router | Copy cni plugins from hyperkube
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -prf /opt/cni/bin/. /cnibindir/"
@ -14,4 +17,4 @@
- name: kube-router | Create manifest
template:
src: kube-router.yml.j2
dest: "{{ kube_config_dir }}/kube-router.yml"
dest: "{{ kube_config_dir }}/kube-router.yml"
Loading…
Cancel
Save