Good afternoon. I'm trying to get our 2.9 instances ready for upgrade to the latest 2.x and eventually 3.x One of the requirements is to update the apiVersion of IngressRoute resources from traefik.containo.us/v1alpha1 to traefik.io/v/1alpha1. To accomplish that I came up with a bash script which I'm posting in case it's helpful to anyone else. If you can think of improvements, feel free to mention them. The script iterates over all IngressRoutes in the namespace passed at the CLI like
./swap-api.sh default
Updates the apiVersion, applies it back to the cluster, then deletes the original.
#!/bin/bash
for ingressroute in $(kubectl -n $1 get ingressroute -o name);
do
yaml="$(kubectl get ${ingressroute} -o yaml)"
newyaml="$(echo "${yaml}" | sed "s/apiVersion: traefik.containo.us\/v1alpha1/apiVersion: traefik.io\/v1alpha1/")"
echo "${newyaml}" | kubectl apply -f -
kubectl delete ${ingressroute}
done
I'm a little confused about these resources in v3 though - the docs here: Traefik Migration Documentation - Traefik say:
In addition, the Kubernetes CRDs API Version
traefik.io/v1alpha1
will not be supported in Traefik v3 itself.
Is this a mistake? The CRDs for v3 listed here Traefik Kubernetes CRD Documentation - Traefik appear to use that api version.
Thanks for any input.