Repository: traefik/traefik
File: pkg/provider/kubernetes/crd/traefik/v1alpha1/middleware.go (Go)

Code before:

// MiddlewareSpec defines the desired state of a Middleware.
type MiddlewareSpec struct {
	AddPrefix         *dynamic.AddPrefix             `json:"addPrefix,omitempty"`
	StripPrefix       *dynamic.StripPrefix           `json:"stripPrefix,omitempty"`
	StripPrefixRegex  *dynamic.StripPrefixRegex      `json:"stripPrefixRegex,omitempty"`
	ReplacePath       *dynamic.ReplacePath           `json:"replacePath,omitempty"`
	ReplacePathRegex  *dynamic.ReplacePathRegex      `json:"replacePathRegex,omitempty"`
	Chain             *Chain                         `json:"chain,omitempty"`
	IPWhiteList       *dynamic.IPWhiteList           `json:"ipWhiteList,omitempty"`
	Headers           *dynamic.Headers               `json:"headers,omitempty"`
	Errors            *ErrorPage                     `json:"errors,omitempty"`
	RateLimit         *RateLimit                     `json:"rateLimit,omitempty"`
	RedirectRegex     *dynamic.RedirectRegex         `json:"redirectRegex,omitempty"`
	RedirectScheme    *dynamic.RedirectScheme        `json:"redirectScheme,omitempty"`
	BasicAuth         *BasicAuth                     `json:"basicAuth,omitempty"`
	DigestAuth        *DigestAuth                    `json:"digestAuth,omitempty"`
	ForwardAuth       *ForwardAuth                   `json:"forwardAuth,omitempty"`
	InFlightReq       *dynamic.InFlightReq           `json:"inFlightReq,omitempty"`
	Buffering         *dynamic.Buffering             `json:"buffering,omitempty"`
	CircuitBreaker    *dynamic.CircuitBreaker        `json:"circuitBreaker,omitempty"`
	Compress          *dynamic.Compress              `json:"compress,omitempty"`
	PassTLSClientCert *dynamic.PassTLSClientCert     `json:"passTLSClientCert,omitempty"`
	Retry             *Retry                         `json:"retry,omitempty"`
	ContentType       *dynamic.ContentType           `json:"contentType,omitempty"`
	// Plugin is a powerful feature that allows developers to add new functionality to Traefik and define new behaviors. More info: https://doc.traefik.io/traefik/plugins/
	Plugin            map[string]apiextensionv1.JSON `json:"plugin,omitempty"`
}

// +k8s:deepcopy-gen=true

// ErrorPage holds the custom error middleware configuration.
// This middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes.
// More info: https://doc.traefik.io/traefik/v2.7/middlewares/http/errorpages/
type ErrorPage struct {
	// Status defines which status or range of statuses should result in an error page.
	// It can be either a status code as a number (500),
	// as multiple comma-separated numbers (500,502),
	// as ranges by separating two codes with a dash (500-599),
	// or a combination of the two (404,418,500-599).
	Status []string `json:"status,omitempty"`
	// Service defines the reference to a Kubernetes Service that will serve the error page.
	// More info: https://doc.traefik.io/traefik/v2.7/middlewares/http/errorpages/#service
	Service Service `json:"service,omitempty"`
	// Query defines the URL for the error page (hosted by service).
	// The {status} variable can be used in order to insert the status code in the URL.
	Query string `json:"query,omitempty"`
}

// +k8s:deepcopy-gen=true


Review comment (suggestion):
Do not forget to update the generated documentation with `make generate-crd`.

```suggestion
	// Plugin defines the middleware plugin configuration.
	// More info: https://doc.traefik.io/traefik/plugins/
```

Code after:

// MiddlewareSpec defines the desired state of a Middleware.
type MiddlewareSpec struct {
	AddPrefix         *dynamic.AddPrefix         `json:"addPrefix,omitempty"`
	StripPrefix       *dynamic.StripPrefix       `json:"stripPrefix,omitempty"`
	StripPrefixRegex  *dynamic.StripPrefixRegex  `json:"stripPrefixRegex,omitempty"`
	ReplacePath       *dynamic.ReplacePath       `json:"replacePath,omitempty"`
	ReplacePathRegex  *dynamic.ReplacePathRegex  `json:"replacePathRegex,omitempty"`
	Chain             *Chain                     `json:"chain,omitempty"`
	IPWhiteList       *dynamic.IPWhiteList       `json:"ipWhiteList,omitempty"`
	Headers           *dynamic.Headers           `json:"headers,omitempty"`
	Errors            *ErrorPage                 `json:"errors,omitempty"`
	RateLimit         *RateLimit                 `json:"rateLimit,omitempty"`
	RedirectRegex     *dynamic.RedirectRegex     `json:"redirectRegex,omitempty"`
	RedirectScheme    *dynamic.RedirectScheme    `json:"redirectScheme,omitempty"`
	BasicAuth         *BasicAuth                 `json:"basicAuth,omitempty"`
	DigestAuth        *DigestAuth                `json:"digestAuth,omitempty"`
	ForwardAuth       *ForwardAuth               `json:"forwardAuth,omitempty"`
	InFlightReq       *dynamic.InFlightReq       `json:"inFlightReq,omitempty"`
	Buffering         *dynamic.Buffering         `json:"buffering,omitempty"`
	CircuitBreaker    *dynamic.CircuitBreaker    `json:"circuitBreaker,omitempty"`
	Compress          *dynamic.Compress          `json:"compress,omitempty"`
	PassTLSClientCert *dynamic.PassTLSClientCert `json:"passTLSClientCert,omitempty"`
	Retry             *Retry                     `json:"retry,omitempty"`
	ContentType       *dynamic.ContentType       `json:"contentType,omitempty"`
	// Plugin defines the middleware plugin configuration.
	// More info: https://doc.traefik.io/traefik/plugins/
	Plugin map[string]apiextensionv1.JSON `json:"plugin,omitempty"`
}

// +k8s:deepcopy-gen=true

// ErrorPage holds the custom error middleware configuration.
// This middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes.
// More info: https://doc.traefik.io/traefik/v2.7/middlewares/http/errorpages/
type ErrorPage struct {
	// Status defines which status or range of statuses should result in an error page.
	// It can be either a status code as a number (500),
	// as multiple comma-separated numbers (500,502),
	// as ranges by separating two codes with a dash (500-599),
	// or a combination of the two (404,418,500-599).
	Status []string `json:"status,omitempty"`
	// Service defines the reference to a Kubernetes Service that will serve the error page.
	// More info: https://doc.traefik.io/traefik/v2.7/middlewares/http/errorpages/#service
	Service Service `json:"service,omitempty"`
	// Query defines the URL for the error page (hosted by service).
	// The {status} variable can be used in order to insert the status code in the URL.
	Query string `json:"query,omitempty"`
}

// +k8s:deepcopy-gen=true