diff --git a/charts/generic-service/README.md b/charts/generic-service/README.md index 9d79d0b..a714b34 100644 --- a/charts/generic-service/README.md +++ b/charts/generic-service/README.md @@ -98,7 +98,7 @@ app: | `ingress.enabled` | `false` | Enables ingress into the service (either cluster-internal or public) | | `ingress.port` | `80` | The container port ingress traffic is routed to | | `ingress.protocol` | `http` | The internal protocol used for ingress (e.g., `http`, `https`, `h2c`, `grpc`, `http2`/`h2` or `grpcs`) | -| `ingress.timeoutSeconds` | | Number of seconds after which to timeout waiting for response from service | +| `ingress.timeoutSeconds` | | Number of seconds after which to timeout waiting for response from service; -1 for infinite | | `ingress.domains` | `[]` | The public domain names under which the service is exposed (leave empty for cluster-internal only) | | `ingress.paths` | `[]` | HTTP path prefixes to accept ingress traffic for (leave empty to accept traffic for any path) | | `ingress.tls.enabled` | `false` | Enables TLS termination at the ingress (not applicable if `ingress.istio.enabled`) | @@ -122,7 +122,7 @@ app: | `ingress.extra.*.class` | same as `ingress.class` | Additional ingress controller to use (not applicable if `ingress.istio.enabled`) | | `ingress.extra.*.port` | same as `ingress.port` | Additional container port ingress traffic is routed to (not applicable if `ingress.istio.enabled`) | | `ingress.extra.*.protocol` | `http` | The protocol used for the port (e.g., `http`, `https`, `h2c`, `grpc`, `http2`/`h2` or `grpcs`) | -| `ingress.extra.*.timeoutSeconds` | | Number of seconds after which to timeout waiting for response from service | +| `ingress.extra.*.timeoutSeconds` | | Number of seconds after which to timeout waiting for response from service; -1 for infinite | | `ingress.extra.*.domains` | `[]` | The public domain names under which the port is exposed (leave empty for cluster-internal only) | | `ingress.extra.*.paths` | `[]` | HTTP path prefixes to accept ingress traffic for (leave empty to accept traffic for any path) | | `ingress.extra.*.tls.enabled` | `false` | Enables TLS termination at the ingress | diff --git a/charts/generic-service/ci/ingress-contour-values.yaml b/charts/generic-service/ci/ingress-contour-values.yaml new file mode 100644 index 0000000..b3357ef --- /dev/null +++ b/charts/generic-service/ci/ingress-contour-values.yaml @@ -0,0 +1,14 @@ +# Contour ingress test + +image: + repository: jwilder/whoami + tag: latest + +ingress: + enabled: true + port: 8000 + class: contour + extra: + timeout: + domains: ['timeout.example.com'] + timeoutSeconds: -1 # infinte diff --git a/charts/generic-service/templates/ingress-extra.yaml b/charts/generic-service/templates/ingress-extra.yaml index 3883246..d586fb3 100644 --- a/charts/generic-service/templates/ingress-extra.yaml +++ b/charts/generic-service/templates/ingress-extra.yaml @@ -2,6 +2,7 @@ {{- range $name, $extra := .Values.ingress.extra }} {{- if $extra.domains }} {{ $class := $extra.class | default $.Values.ingress.class }} +{{ $timeout := $extra.timeoutSeconds | default $.Values.ingress.timeoutSeconds }} apiVersion: networking.k8s.io/v1 kind: Ingress @@ -20,12 +21,17 @@ metadata: {{- if $extra.port }}{{ $protocol = $extra.protocol }}{{ end }} nginx.ingress.kubernetes.io/backend-protocol: {{ include "generic-service.normalize-protocol" $protocol | upper }} {{- if or $extra.timeoutSeconds $.Values.ingress.timeoutSeconds }} - nginx.ingress.kubernetes.io/proxy-read-timeout: '{{ $extra.timeoutSeconds | default $.Values.ingress.timeoutSeconds }}' + nginx.ingress.kubernetes.io/proxy-read-timeout: '{{ $timeout }}' {{- if or (eq $protocol "grpc") (eq $protocol "grpcs") }} - nginx.ingress.kubernetes.io/server-snippet: "grpc_read_timeout {{ $extra.timeoutSeconds | default $.Values.ingress.timeoutSeconds }}s; {{ get $merged "nginx.ingress.kubernetes.io/server-snippet" }}" + nginx.ingress.kubernetes.io/server-snippet: "grpc_read_timeout {{ $timeout }}s; {{ get $merged "nginx.ingress.kubernetes.io/server-snippet" }}" {{- end }} {{- end }} {{- end }} + {{- if eq $class "contour" }} + {{- if $timeout }} + projectcontour.io/response-timeout: '{{ if eq (int $timeout) -1 }}infinity{{ else }}{{ $timeout }}s{{ end }}' + {{- end }} + {{- end }} spec: {{- if $class }} diff --git a/charts/generic-service/templates/ingress.yaml b/charts/generic-service/templates/ingress.yaml index f6931fb..3312a39 100644 --- a/charts/generic-service/templates/ingress.yaml +++ b/charts/generic-service/templates/ingress.yaml @@ -26,6 +26,11 @@ metadata: {{ if .Values.ingress.cors.exposeHeaders }}nginx.ingress.kubernetes.io/cors-expose-headers: {{ join "," .Values.ingress.cors.exposeHeaders | quote }}{{ end }} {{- end }} {{- end }} + {{- if eq .Values.ingress.class "contour" }} + {{- if .Values.ingress.timeoutSeconds }} + projectcontour.io/response-timeout: '{{ if eq (int .Values.ingress.timeoutSeconds) -1 }}infinity{{ else }}{{ .Values.ingress.timeoutSeconds }}s{{ end }}' + {{- end }} + {{- end }} spec: {{- if .Values.ingress.class }} diff --git a/charts/generic-service/values.schema.json b/charts/generic-service/values.schema.json index b28c60e..e7957de 100644 --- a/charts/generic-service/values.schema.json +++ b/charts/generic-service/values.schema.json @@ -511,7 +511,7 @@ }, "timeoutSeconds": { "type": ["integer", "null"], - "description": "Number of seconds after which to timeout waiting for response from service" + "description": "Number of seconds after which to timeout waiting for response from service; -1 for infinite" }, "domains": { "type": "array", @@ -652,7 +652,7 @@ }, "timeoutSeconds": { "type": ["integer", "null"], - "description": "Number of seconds after which to timeout waiting for response from service" + "description": "Number of seconds after which to timeout waiting for response from service; -1 for infinite" }, "domains": { "type": "array",