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

pull/11432/head
Ho Kim 2024-08-08 17:57:26 +09:00
parent 1968db9a52
commit 155fb83586
No known key found for this signature in database
GPG Key ID: 92D99E8FE190A578
4 changed files with 33 additions and 0 deletions

View File

@ -49,3 +49,15 @@
# custom_cni_chart_values: # custom_cni_chart_values:
# cluster: # cluster:
# name: "cilium-demo" # 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]

View File

@ -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

View File

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

View File

@ -1,5 +1,13 @@
--- ---
dependencies: 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 - role: helm-apps
when: when:
- inventory_hostname == groups['kube_control_plane'][0] - inventory_hostname == groups['kube_control_plane'][0]