feat: Keep kube-vip-rbac and delete stale addon resources

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2023-07-01 17:56:29 -04:00
1 parent 6442ac02cf
commit 1be064692d
2 files changed
+14 -1

No files matched your search

@@ -15,7 +15,7 @@ k3s_registration_address: "{{ kubevip_address }}"
k3s_server_manifests_urls:
# Kube-vip RBAC
- url: https://raw.githubusercontent.com/kube-vip/kube-vip/main/docs/manifests/rbac.yaml
filename: custom-kube-vip-rbac.yaml
filename: kube-vip-rbac.yaml
# Essential Prometheus Operator CRDs (the rest are installed with the kube-prometheus-stack helm release)
- url: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml
filename: custom-prometheus-podmonitors.yaml
@@ -145,6 +145,19 @@
path: "{{ item.path }}"
state: absent
loop: "{{ custom_manifest.files }}"
- name: Custom manifests (2) | Get list of custom addons
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
kind: Addon
register: addons_list
- name: Custom manifests (2) | Delete addons
kubernetes.core.k8s:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: "{{ item.metadata.name }}"
kind: Addon
namespace: kube-system
state: absent
loop: "{{ addons_list.resources | selectattr('metadata.name', 'match', '^custom-.*') | list }}"
# https://github.com/k3s-io/k3s/issues/1900
- name: Stale containers