traefik/pkg/provider/kubernetes/crd/traefik/v1alpha1/service.go
Jean-Baptiste Doumenjou 992d4c1b94
Upgrade the CRD version from apiextensions.k8s.io/v1beta1 to apiextensions.k8s.io/v1
Co-authored-by: kevinpollet <pollet.kevin@gmail.com>
2021-03-03 15:32:04 +01:00

68 lines
2 KiB
Go

package v1alpha1
import (
"github.com/traefik/traefik/v2/pkg/config/dynamic"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// TraefikService is the specification for a service (that an IngressRoute refers
// to) that is usually not a terminal service (i.e. not a pod of servers), as
// opposed to a Kubernetes Service. That is to say, it usually refers to other
// (children) services, which themselves can be TraefikServices or Services.
type TraefikService struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec ServiceSpec `json:"spec"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TraefikServiceList is a list of TraefikService resources.
type TraefikServiceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []TraefikService `json:"items"`
}
// +k8s:deepcopy-gen=true
// ServiceSpec defines whether a TraefikService is a load-balancer of services or a
// mirroring service.
type ServiceSpec struct {
Weighted *WeightedRoundRobin `json:"weighted,omitempty"`
Mirroring *Mirroring `json:"mirroring,omitempty"`
}
// +k8s:deepcopy-gen=true
// Mirroring defines a mirroring service, which is composed of a main
// load-balancer, and a list of mirrors.
type Mirroring struct {
LoadBalancerSpec `json:",inline"`
MaxBodySize *int64 `json:"maxBodySize,omitempty"`
Mirrors []MirrorService `json:"mirrors,omitempty"`
}
// +k8s:deepcopy-gen=true
// MirrorService defines one of the mirrors of a Mirroring service.
type MirrorService struct {
LoadBalancerSpec `json:",inline"`
Percent int `json:"percent,omitempty"`
}
// +k8s:deepcopy-gen=true
// WeightedRoundRobin defines a load-balancer of services.
type WeightedRoundRobin struct {
Services []Service `json:"services,omitempty"`
Sticky *dynamic.Sticky `json:"sticky,omitempty"`
}