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 17f1a57e9..e3428961a 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml @@ -99,45 +99,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the - service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be + sent to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for + the health check endpoint. type: string port: + description: Port defines the server URL port for + the health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme + for the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -961,44 +981,65 @@ spec: More info: https://doc.traefik.io/traefik/v3.0/middlewares/http/errorpages/#service properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in + the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2377,44 +2418,65 @@ spec: description: Mirroring defines the Mirroring service configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent to + the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in the + Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the health + check endpoint. type: string port: + description: Port defines the server URL port for the health + check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for the + health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2436,44 +2498,65 @@ spec: description: MirrorService holds the mirror configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2710,44 +2793,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml index 984503f04..7b23dba43 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml @@ -99,45 +99,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the - service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be + sent to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for + the health check endpoint. type: string port: + description: Port defines the server URL port for + the health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme + for the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml index 7d695362c..cecabf43b 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml @@ -257,44 +257,65 @@ spec: More info: https://doc.traefik.io/traefik/v3.0/middlewares/http/errorpages/#service properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in + the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. diff --git a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml index 8a6454858..7a0f7daf3 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml @@ -48,44 +48,65 @@ spec: description: Mirroring defines the Mirroring service configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent to + the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in the + Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the health + check endpoint. type: string port: + description: Port defines the server URL port for the health + check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for the + health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -107,44 +128,65 @@ spec: description: MirrorService holds the mirror configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -381,44 +423,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. diff --git a/integration/fixtures/k8s/01-traefik-crd.yml b/integration/fixtures/k8s/01-traefik-crd.yml index 17f1a57e9..e3428961a 100644 --- a/integration/fixtures/k8s/01-traefik-crd.yml +++ b/integration/fixtures/k8s/01-traefik-crd.yml @@ -99,45 +99,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the - service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be + sent to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for + the health check endpoint. type: string port: + description: Port defines the server URL port for + the health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme + for the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -961,44 +981,65 @@ spec: More info: https://doc.traefik.io/traefik/v3.0/middlewares/http/errorpages/#service properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in + the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2377,44 +2418,65 @@ spec: description: Mirroring defines the Mirroring service configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent to + the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname in the + Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the health + check endpoint. type: string port: + description: Port defines the server URL port for the health + check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for the + health check endpoint. type: string status: + description: Status defines the expected HTTP status code + of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2436,44 +2498,65 @@ spec: description: MirrorService holds the mirror configuration. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. @@ -2710,44 +2793,65 @@ spec: traffic to. properties: healthCheck: - description: Healthcheck defines health checks for the service. + description: Healthcheck defines health checks for ExternalName + services. properties: followRedirects: + description: |- + FollowRedirects defines whether redirects should be followed during the health check calls. + Default: true type: boolean headers: additionalProperties: type: string + description: Headers defines custom headers to be sent + to the health check endpoint. type: object hostname: + description: Hostname defines the value of hostname + in the Host header of the health check request. type: string interval: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer + Interval defines the frequency of the health check calls. + Default: 30s + x-kubernetes-int-or-string: true method: + description: Method defines the healthcheck method. type: string mode: + description: |- + Mode defines the health check mode. + If defined to grpc, will use the gRPC health check protocol to probe the server. + Default: http type: string path: + description: Path defines the server URL path for the + health check endpoint. type: string port: + description: Port defines the server URL port for the + health check endpoint. type: integer scheme: + description: Scheme replaces the server URL scheme for + the health check endpoint. type: string status: + description: Status defines the expected HTTP status + code of the response to the health check request. type: integer timeout: + anyOf: + - type: integer + - type: string description: |- - Duration is a custom type suitable for parsing duration values. - It supports `time.ParseDuration`-compatible values and suffix-less digits; in - the latter case, seconds are assumed. - format: int64 - type: integer - required: - - followRedirects + Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + Default: 5s + x-kubernetes-int-or-string: true type: object kind: description: Kind defines the kind of the Service. diff --git a/pkg/config/dynamic/http_config.go b/pkg/config/dynamic/http_config.go index ecfd68c7e..b91de8413 100644 --- a/pkg/config/dynamic/http_config.go +++ b/pkg/config/dynamic/http_config.go @@ -254,7 +254,7 @@ type ServerHealthCheck struct { Interval ptypes.Duration `json:"interval,omitempty" toml:"interval,omitempty" yaml:"interval,omitempty" export:"true"` Timeout ptypes.Duration `json:"timeout,omitempty" toml:"timeout,omitempty" yaml:"timeout,omitempty" export:"true"` Hostname string `json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"` - FollowRedirects *bool `json:"followRedirects" toml:"followRedirects" yaml:"followRedirects" export:"true"` + FollowRedirects *bool `json:"followRedirects,omitempty" toml:"followRedirects,omitempty" yaml:"followRedirects,omitempty" export:"true"` Headers map[string]string `json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty" export:"true"` } diff --git a/pkg/provider/kubernetes/crd/kubernetes_http.go b/pkg/provider/kubernetes/crd/kubernetes_http.go index 45018f948..1d5eab777 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_http.go +++ b/pkg/provider/kubernetes/crd/kubernetes_http.go @@ -305,7 +305,36 @@ func (c configBuilder) buildServersLB(namespace string, svc traefikv1alpha1.Load lb := &dynamic.ServersLoadBalancer{} lb.SetDefaults() lb.Servers = servers - lb.HealthCheck = svc.HealthCheck + + if svc.HealthCheck != nil { + lb.HealthCheck = &dynamic.ServerHealthCheck{ + Scheme: svc.HealthCheck.Scheme, + Path: svc.HealthCheck.Path, + Method: svc.HealthCheck.Method, + Status: svc.HealthCheck.Status, + Port: svc.HealthCheck.Port, + Hostname: svc.HealthCheck.Hostname, + Headers: svc.HealthCheck.Headers, + } + lb.HealthCheck.SetDefaults() + + if svc.HealthCheck.FollowRedirects != nil { + lb.HealthCheck.FollowRedirects = svc.HealthCheck.FollowRedirects + } + if svc.HealthCheck.Mode != "http" { + lb.HealthCheck.Mode = svc.HealthCheck.Mode + } + if svc.HealthCheck.Interval != nil { + if err := lb.HealthCheck.Interval.Set(svc.HealthCheck.Interval.String()); err != nil { + return nil, err + } + } + if svc.HealthCheck.Timeout != nil { + if err := lb.HealthCheck.Timeout.Set(svc.HealthCheck.Timeout.String()); err != nil { + return nil, err + } + } + } conf := svc lb.PassHostHeader = conf.PassHostHeader diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index c224b0c3e..4b886b7e8 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -2469,8 +2469,10 @@ func TestLoadIngressRoutes(t *testing.T) { FlushInterval: ptypes.Duration(100 * time.Millisecond), }, HealthCheck: &dynamic.ServerHealthCheck{ - Path: "/health", - Interval: 15000000000, + Path: "/health", + Timeout: 5000000000, + Interval: 15000000000, + FollowRedirects: Bool(true), }, }, }, @@ -2531,8 +2533,10 @@ func TestLoadIngressRoutes(t *testing.T) { FlushInterval: ptypes.Duration(100 * time.Millisecond), }, HealthCheck: &dynamic.ServerHealthCheck{ - Path: "/health1", - Interval: 15000000000, + Path: "/health1", + Timeout: 5000000000, + Interval: 15000000000, + FollowRedirects: Bool(true), }, }, }, @@ -2548,8 +2552,10 @@ func TestLoadIngressRoutes(t *testing.T) { FlushInterval: ptypes.Duration(100 * time.Millisecond), }, HealthCheck: &dynamic.ServerHealthCheck{ - Path: "/health2", - Interval: 20000000000, + Path: "/health2", + Timeout: 5000000000, + Interval: 20000000000, + FollowRedirects: Bool(true), }, }, }, @@ -2589,8 +2595,10 @@ func TestLoadIngressRoutes(t *testing.T) { FlushInterval: ptypes.Duration(100 * time.Millisecond), }, HealthCheck: &dynamic.ServerHealthCheck{ - Path: "/health1", - Interval: 15000000000, + Path: "/health1", + Timeout: 5000000000, + Interval: 15000000000, + FollowRedirects: Bool(true), }, }, }, diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go index 89189e611..ecc777dfa 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go @@ -131,8 +131,8 @@ type LoadBalancerSpec struct { // It allows services to be reachable when Traefik runs externally from the Kubernetes cluster but within the same network of the nodes. // By default, NodePortLB is false. NodePortLB bool `json:"nodePortLB,omitempty"` - // Healthcheck defines health checks for the service. - HealthCheck *dynamic.ServerHealthCheck `json:"healthCheck,omitempty"` + // Healthcheck defines health checks for ExternalName services. + HealthCheck *ServerHealthCheck `json:"healthCheck,omitempty"` } type ResponseForwarding struct { @@ -144,6 +144,36 @@ type ResponseForwarding struct { FlushInterval string `json:"flushInterval,omitempty"` } +type ServerHealthCheck struct { + // Scheme replaces the server URL scheme for the health check endpoint. + Scheme string `json:"scheme,omitempty"` + // Mode defines the health check mode. + // If defined to grpc, will use the gRPC health check protocol to probe the server. + // Default: http + Mode string `json:"mode,omitempty"` + // Path defines the server URL path for the health check endpoint. + Path string `json:"path,omitempty"` + // Method defines the healthcheck method. + Method string `json:"method,omitempty"` + // Status defines the expected HTTP status code of the response to the health check request. + Status int `json:"status,omitempty"` + // Port defines the server URL port for the health check endpoint. + Port int `json:"port,omitempty"` + // Interval defines the frequency of the health check calls. + // Default: 30s + Interval *intstr.IntOrString `json:"interval,omitempty"` + // Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy. + // Default: 5s + Timeout *intstr.IntOrString `json:"timeout,omitempty"` + // Hostname defines the value of hostname in the Host header of the health check request. + Hostname string `json:"hostname,omitempty"` + // FollowRedirects defines whether redirects should be followed during the health check calls. + // Default: true + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Headers defines custom headers to be sent to the health check endpoint. + Headers map[string]string `json:"headers,omitempty"` +} + // Service defines an upstream HTTP service to proxy traffic to. type Service struct { LoadBalancerSpec `json:",inline"` diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/zz_generated.deepcopy.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/zz_generated.deepcopy.go index a4d9c9074..8ff42f478 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/zz_generated.deepcopy.go @@ -584,7 +584,7 @@ func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { } if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck - *out = new(dynamic.ServerHealthCheck) + *out = new(ServerHealthCheck) (*in).DeepCopyInto(*out) } return @@ -1115,6 +1115,44 @@ func (in *RouteUDP) DeepCopy() *RouteUDP { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerHealthCheck) DeepCopyInto(out *ServerHealthCheck) { + *out = *in + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(intstr.IntOrString) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(intstr.IntOrString) + **out = **in + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerHealthCheck. +func (in *ServerHealthCheck) DeepCopy() *ServerHealthCheck { + if in == nil { + return nil + } + out := new(ServerHealthCheck) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServersTransport) DeepCopyInto(out *ServersTransport) { *out = *in