traefik / mesh

Traefik Mesh - Simpler Service Mesh
https://traefik.io/traefik-mesh
Apache License 2.0
2.03k stars 141 forks source link

Check SMI CRDs version before starting the controller #714

Closed jspdown closed 4 years ago

jspdown commented 4 years ago

What does this PR do?

In order to improve the user experience when incompatible SMI CRDs versions are installed (outdated or not yet supported), this PR introduce some changes on the prepare command.

In the past we use to start informers and start collecting the different SMI objects already present on the cluster. If SMI CRDs were not installed or an unsupported version was we would get the following errors many times:

E0824 17:40:01.430644   26974 reflector.go:178] pkg/mod/k8s.io/client-go@v0.18.6/tools/cache/reflector.go:125: Failed to list *v1alpha3.TrafficSplit: the server could not find the requested resource (get trafficsplits.split.smi-spec.io)
E0824 17:40:01.430644   26974 reflector.go:178] pkg/mod/k8s.io/client-go@v0.18.6/tools/cache/reflector.go:125: Failed to list *v1alpha3.TrafficSplit: the server could not find the requested resource (get trafficsplits.split.smi-spec.io)
E0824 17:40:01.430644   26974 reflector.go:178] pkg/mod/k8s.io/client-go@v0.18.6/tools/cache/reflector.go:125: Failed to list *v1alpha3.TrafficSplit: the server could not find the requested resource (get trafficsplits.split.smi-spec.io)
E0824 17:40:01.430644   26974 reflector.go:178] pkg/mod/k8s.io/client-go@v0.18.6/tools/cache/reflector.go:125: Failed to list *v1alpha3.TrafficSplit: the server could not find the requested resource (get trafficsplits.split.smi-spec.io)
E0824 17:40:01.430644   26974 reflector.go:178] pkg/mod/k8s.io/client-go@v0.18.6/tools/cache/reflector.go:125: Failed to list *v1alpha3.TrafficSplit: the server could not find the requested resource (get trafficsplits.split.smi-spec.io)

This PR introduce a simpler solution based on the Discovery API of the kubernetes sdk to discover which resource groups are installed and what are there versions.

Fixes #711

How to test it