diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml index 753b0198a..11c182d6d 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml @@ -14,7 +14,17 @@ spec: singular: ingressroute scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + - jsonPath: .spec.routes[*].match + name: Rule + type: string + - jsonPath: .spec.routes[*].middlewares[*].name + name: Middlewares + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRoute is the CRD implementation of a Traefik HTTP Router. @@ -238,9 +248,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -344,6 +351,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -360,7 +368,11 @@ spec: singular: ingressroutetcp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteTCP is the CRD implementation of a Traefik TCP Router. @@ -604,6 +616,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -620,7 +633,11 @@ spec: singular: ingressrouteudp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteUDP is a CRD implementation of a Traefik UDP Router. @@ -718,6 +735,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -1141,9 +1159,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2077,7 +2092,11 @@ spec: singular: serverstransport scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.serverName + name: ServerName + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -2210,6 +2229,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -2226,7 +2246,14 @@ spec: singular: tlsoption scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.minVersion + name: MinVersion + type: string + - jsonPath: .spec.maxVersion + name: MaxVersion + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -2344,6 +2371,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -2648,9 +2676,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2771,9 +2796,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2912,9 +2934,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml index c76b7cdb2..542622151 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml @@ -14,7 +14,17 @@ spec: singular: ingressroute scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + - jsonPath: .spec.routes[*].match + name: Rule + type: string + - jsonPath: .spec.routes[*].middlewares[*].name + name: Middlewares + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRoute is the CRD implementation of a Traefik HTTP Router. @@ -238,9 +248,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -344,3 +351,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml index 49ed4c74c..20ecdeaf0 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml @@ -14,7 +14,11 @@ spec: singular: ingressroutetcp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteTCP is the CRD implementation of a Traefik TCP Router. @@ -258,3 +262,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml index 2fccf7167..94b71ef64 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml @@ -14,7 +14,11 @@ spec: singular: ingressrouteudp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteUDP is a CRD implementation of a Traefik UDP Router. @@ -112,3 +116,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml index d41fff1a4..dd5120adf 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml @@ -421,9 +421,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml index 6f3da4fa3..31dbe50eb 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml @@ -14,7 +14,11 @@ spec: singular: serverstransport scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.serverName + name: ServerName + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -147,3 +151,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml index 0a050a23e..3b3a8618a 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml @@ -14,7 +14,14 @@ spec: singular: tlsoption scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.minVersion + name: MinVersion + type: string + - jsonPath: .spec.maxVersion + name: MaxVersion + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -132,3 +139,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml index f0b25f139..dc255ac6a 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml @@ -197,9 +197,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -320,9 +317,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -461,9 +455,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object diff --git a/integration/fixtures/k8s/01-traefik-crd.yml b/integration/fixtures/k8s/01-traefik-crd.yml index 753b0198a..11c182d6d 100644 --- a/integration/fixtures/k8s/01-traefik-crd.yml +++ b/integration/fixtures/k8s/01-traefik-crd.yml @@ -14,7 +14,17 @@ spec: singular: ingressroute scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + - jsonPath: .spec.routes[*].match + name: Rule + type: string + - jsonPath: .spec.routes[*].middlewares[*].name + name: Middlewares + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRoute is the CRD implementation of a Traefik HTTP Router. @@ -238,9 +248,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -344,6 +351,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -360,7 +368,11 @@ spec: singular: ingressroutetcp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteTCP is the CRD implementation of a Traefik TCP Router. @@ -604,6 +616,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -620,7 +633,11 @@ spec: singular: ingressrouteudp scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.entryPoints + name: EntryPoints + type: string + name: v1alpha1 schema: openAPIV3Schema: description: IngressRouteUDP is a CRD implementation of a Traefik UDP Router. @@ -718,6 +735,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -1141,9 +1159,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2077,7 +2092,11 @@ spec: singular: serverstransport scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.serverName + name: ServerName + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -2210,6 +2229,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -2226,7 +2246,14 @@ spec: singular: tlsoption scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.minVersion + name: MinVersion + type: string + - jsonPath: .spec.maxVersion + name: MaxVersion + type: string + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -2344,6 +2371,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -2648,9 +2676,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2771,9 +2796,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object @@ -2912,9 +2934,6 @@ spec: example: 10 minimum: 0 type: integer - x-kubernetes-validations: - - message: weight can only be used on TraefikService - rule: self.kind == 'TraefikService' required: - name type: object diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go index d7a026fa4..f421f2f94 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go @@ -142,7 +142,6 @@ type LoadBalancerSpec struct { ServersTransport string `json:"serversTransport,omitempty"` // Weight defines the weight and should only be specified when Name references a TraefikService object // (and to be precise, one that embeds a Weighted Round Robin). - // +kubebuilder:validation:XValidation:message="weight can only be used on TraefikService",rule="self.kind == 'TraefikService'" // +kubebuilder:validation:Minimum=0 // +kubebuilder:example=10 Weight *int `json:"weight,omitempty"` @@ -171,9 +170,14 @@ type MiddlewareRef struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="EntryPoints",type=string,JSONPath=`.spec.entryPoints` +// +kubebuilder:printcolumn:name="Rule",type=string,JSONPath=`.spec.routes[*].match` +// +kubebuilder:printcolumn:name="Middlewares",type=string,JSONPath=`.spec.routes[*].middlewares[*].name` // IngressRoute is the CRD implementation of a Traefik HTTP Router. type IngressRoute struct { + // +kubebuilder:printcolumn:name="EntryPoints",type=string,JSONPath=`.` + metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go index d4094a080..1a1dadacc 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go @@ -111,6 +111,7 @@ type ServiceTCP struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="EntryPoints",type=string,JSONPath=`.spec.entryPoints` // IngressRouteTCP is the CRD implementation of a Traefik TCP Router. type IngressRouteTCP struct { diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressrouteudp.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressrouteudp.go index 32b379feb..cf8c84ca8 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressrouteudp.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressrouteudp.go @@ -53,6 +53,7 @@ type ServiceUDP struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="EntryPoints",type=string,JSONPath=`.spec.entryPoints` // IngressRouteUDP is a CRD implementation of a Traefik UDP Router. type IngressRouteUDP struct { diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go index 2bbf24f9f..80d360aa4 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go @@ -8,6 +8,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="ServerName",type=string,JSONPath=`.spec.serverName` // ServersTransport is the CRD implementation of a ServersTransport. // If no serversTransport is specified, the default@internal will be used. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go index f4bee6f17..40364877b 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go @@ -7,6 +7,8 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="MinVersion",type=string,JSONPath=`.spec.minVersion` +// +kubebuilder:printcolumn:name="MaxVersion",type=string,JSONPath=`.spec.maxVersion` // TLSOption is the CRD implementation of a Traefik TLS Option, allowing to configure some parameters of the TLS connection. // More info: https://doc.traefik.io/traefik/v2.11/https/tls/#tls-options