This gist contains examples of yaml configurations for the service load balancing in the k8s crd provider.
The goal is to expose:
- a "user friendly" configuration (with potentialy complex usecases)
- avoid confusion between K8s native objects and Traefik one
- avoid to break the current configuration
The mirror and weighted services can use any combination of any kind of services as child (serverLB, wrr, mirror). We have to manage different types of objects that could be internal (traefik crd) or external (native k8s objects). The basic usage should stay easy to use.
All names could be change such as:
serviceName
attribute that refers to aNodeService
nameNodeService
name of the CRD that defines a traefik servicenodeServices
name of the list of traefik services
The samples have the following naming convention: <solution>_<usecase>.yaml
Switch between two exclusives attributes:
name
-> k8s servicesserviceName
-> traefiknodeService
It is the actual solution available in the PR
To avoid confusion between Traefik and K8s services, we can separe those 2 types of services in 2 distinct lists. The list could be under the actual service list but it would be breaking. Otherwise we can add a list at the same level of the existing one. We have to apply it both for mirroring and wrr. As we just use a name, we need to specify a specific object for the main service in the mirroring.
As Traefik use provider namespace to manage cross provider configuration, we may force the annotation to define if the service used is a Traefik (with namespace) or a K8s one (without namespace or with a specific one ?).
This change would break the existing configuration schema. A service referenced by the "name" attribute is always a nodeService, so there's never any conflict with a reference to a k8s service. When we actually need to create a load-balancer of servers we wrap a k8s service within e.g. a traefik service wrr.