Browse Source

feat(cni): add preflight network resource support for custom_cni

pull/11432/head
Ho Kim 3 months ago
parent
commit
155fb83586
No known key found for this signature in database GPG Key ID: 92D99E8FE190A578
4 changed files with 33 additions and 0 deletions
  1. 12
      inventory/sample/group_vars/k8s_cluster/k8s-net-custom-cni.yml
  2. 11
      roles/kubernetes-apps/network_plugin/custom_cni/tasks/main.yml
  3. 2
      roles/network_plugin/custom_cni/defaults/main.yml
  4. 8
      roles/network_plugin/custom_cni/meta/main.yml

12
inventory/sample/group_vars/k8s_cluster/k8s-net-custom-cni.yml

@ -49,3 +49,15 @@
# custom_cni_chart_values:
# cluster:
# name: "cilium-demo"
## Preflight - Deploy network files prior to CNI
## It can be used when preparatory work such as deploying CRDs is required
## prior to CNI distribution, as if the `kubectl create -f` method (present)
## or `kubectl apply -f` (latest) was used with it.
#
## List of Kubernetes network resource files
## Example:
# custom_cni_preflight_templates:
# - path: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
# namespace: "kube-system" # default: "kube-system"
# state: present # options: [latest, present, absent]

11
roles/kubernetes-apps/network_plugin/custom_cni/tasks/main.yml

@ -0,0 +1,11 @@
---
- name: Custom CNI | Preflight | Start Resources
kube:
namespace: "{{ item.namespace | default('kube-system') }}"
kubectl: "{{ bin_dir }}/kubectl"
filename: "{{ item.path }}"
state: "{{ item.state }}"
wait: true
loop: "{{ custom_cni_preflight_templates }}"
delegate_to: "{{ groups['kube_control_plane'] | first }}"
run_once: true

2
roles/network_plugin/custom_cni/defaults/main.yml

@ -1,5 +1,7 @@
---
custom_cni_preflight_templates: []
custom_cni_manifests: []
custom_cni_chart_namespace: kube-system

8
roles/network_plugin/custom_cni/meta/main.yml

@ -1,5 +1,13 @@
---
dependencies:
- role: kubernetes-apps/network_plugin/custom_cni
when:
- inventory_hostname == groups['kube_control_plane'][0]
- custom_cni_chart_release_name | length > 0
environment:
http_proxy: "{{ http_proxy | default('') }}"
https_proxy: "{{ https_proxy | default('') }}"
- role: helm-apps
when:
- inventory_hostname == groups['kube_control_plane'][0]

Loading…
Cancel
Save