#!/usr/bin/env bash
set -euo pipefail

kubectl -n kube-system delete addon traefik --ignore-not-found --wait=false
kubectl -n kube-system delete helmchart traefik traefik-crd --ignore-not-found --wait=false
kubectl -n kube-system delete job helm-install-traefik helm-install-traefik-crd --ignore-not-found --wait=false
kubectl -n kube-system delete deployment traefik --ignore-not-found --wait=false
kubectl -n kube-system delete service traefik --ignore-not-found --wait=false
kubectl -n kube-system delete serviceaccount traefik helm-traefik helm-traefik-crd --ignore-not-found --wait=false

kubectl delete clusterrole traefik-ingress-controller traefik-kube-system --ignore-not-found --wait=false
kubectl delete clusterrolebinding helm-kube-system-traefik helm-kube-system-traefik-crd traefik-ingress-controller traefik-kube-system --ignore-not-found --wait=false
