1
0

add calico bgp configuration

This commit is contained in:
michael 2022-12-07 00:12:15 +13:00
parent 9fd4c6f001
commit ce9f7891fa

View File

@ -108,6 +108,18 @@
peerIP: "{{ k8s_network_bgp_v6_peer_address }}"
asNumber: "{{ k8s_network_bgp_peer_as }}"
- name: add bgp configuration
ansible.builtin.set_fact:
calico_bgp_configuration:
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
name: default
spec:
serviceClusterIPs:
- cidr: "{{ k8s_v4_service_cidr }}"
- cidr: "{{ k8s_v6_service_cidr }}"
- name: write out calico namespace crd
ansible.builtin.copy:
content: "{{ calico_namespace | to_yaml }}" # Ansible registers the original fact name (with new vaule) inside the updated fact, hence the sub element
@ -142,6 +154,11 @@
content: "{{ calico_bgp_v6_peer | to_nice_yaml }}"
dest: "{{ ansible_search_path[0] }}/files/calico/calico_bgp_v6_peer.yaml"
- name: write out calico bgp configuration definition
ansible.builtin.copy:
content: "{{ calico_bgp_configuration | to_nice_yaml }}"
dest: "{{ ansible_search_path[0] }}/files/calico/calico_bgp_configuration.yaml"
- name: install calico definitions to cluster # The order here matters. namespace > config map > operator > installation
kubernetes.core.k8s:
state: present
@ -154,3 +171,4 @@
- "{{ ansible_search_path[0] }}/files/calico/calico_apiserver.yaml"
- "{{ ansible_search_path[0] }}/files/calico/calico_bgp_v4_peer.yaml"
- "{{ ansible_search_path[0] }}/files/calico/calico_bgp_v6_peer.yaml"
- "{{ ansible_search_path[0] }}/files/calico/calico_bgp_configuration.yaml"