c12s-kubespray/roles/network_plugin/kube-router/tasks/main.yml
Kenichi Omichi 486b223e01
Replace kube-master with kube_control_plane (#7256)
This replaces kube-master with kube_control_plane because of [1]:

  The Kubernetes project is moving away from wording that is
  considered offensive. A new working group WG Naming was created
  to track this work, and the word "master" was declared as offensive.
  A proposal was formalized for replacing the word "master" with
  "control plane". This means it should be removed from source code,
  documentation, and user-facing configuration from Kubernetes and
  its sub-projects.

NOTE: The reason why this changes it to kube_control_plane not
      kube-control-plane is for valid group names on ansible.

[1]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/kubeadm/2067-rename-master-label-taint/README.md#motivation
2021-03-23 17:26:05 -07:00

59 lines
1.5 KiB
YAML

---
- name: kube-router | Create annotations
include: annotate.yml
tags: annotate
- name: kube-router | Create config directory
file:
path: /var/lib/kube-router
state: directory
owner: kube
recurse: true
mode: 0755
- name: kube-router | Create kubeconfig
template:
src: kubeconfig.yml.j2
dest: /var/lib/kube-router/kubeconfig
owner: kube
notify:
- reset_kube_router
- name: kube-router | Slurp cni config
slurp:
src: /etc/cni/net.d/10-kuberouter.conflist
register: cni_config_slurp
ignore_errors: true
- name: kube-router | Set cni_config variable
set_fact:
cni_config: "{{ cni_config_slurp.content | b64decode | from_json }}"
when:
- not cni_config_slurp.failed
- name: kube-router | Set host_subnet variable
set_fact:
host_subnet: "{{ cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | first }}"
when:
- cni_config is defined
- cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | length > 0
- name: kube-router | Create cni config
template:
src: cni-conf.json.j2
dest: /etc/cni/net.d/10-kuberouter.conflist
owner: kube
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
dest: "{{ kube_config_dir }}/kube-router.yml"
delegate_to: "{{ groups['kube_control_plane'] | first }}"
run_once: true