Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14] Add ingress.useExisting value #44148

Merged
merged 5 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/pages/reference/helm-reference/teleport-cluster.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,26 @@ Boolean value that specifies whether to generate a Kubernetes `Ingress` for the
enabled: true
```

## `ingress.useExisting`

| Type | Default value | Required? |
|-----------|---------------|-----------|
| `boolean` | `false` | No |


`ingress.useExisting` indicates to the chart that you are managing your own ingress
(or HTTPRoute, or any other LoadBalancing method that terminates TLS).
The chart will configure Teleport like it's running behind an ingress, but will not
create the ingress resource. You are responsible for creating and managing the ingress.

`values.yaml` example:

```yaml
ingress:
enabled: true
useExisting: true
```

## `ingress.suppressAutomaticWildcards`

| Type | Default value | Required? |
Expand Down
30 changes: 16 additions & 14 deletions examples/chart/teleport-cluster/templates/proxy/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
{{- if (not (eq .Values.proxyListenerMode "multiplex")) -}}
{{- fail "Use of an ingress requires TLS multiplexing to be enabled, so you must also set proxyListenerMode=multiplex - see https://goteleport.com/docs/architecture/tls-routing/" -}}
{{- end -}}
{{- $publicAddr := coalesce .Values.publicAddr (list .Values.clusterName) -}}
{{- /* Trim ports from all public addresses if present */ -}}
{{- range $publicAddr -}}
{{- $address := . -}}
{{- if (contains ":" $address) -}}
{{- $split := split ":" $address -}}
{{- $address = $split._0 -}}
{{- $publicAddr = append (mustWithout $publicAddr .) $address -}}
{{- if not .Values.ingress.useExisting }}
{{- $publicAddr := coalesce .Values.publicAddr (list .Values.clusterName) -}}
{{- /* Trim ports from all public addresses if present */ -}}
{{- range $publicAddr -}}
{{- $address := . -}}
{{- if (contains ":" $address) -}}
{{- $split := split ":" $address -}}
{{- $address = $split._0 -}}
{{- $publicAddr = append (mustWithout $publicAddr .) $address -}}
{{- end -}}
{{- $wildcard := printf "*.%s" $address -}}
{{- /* Add wildcard versions of all public addresses to ingress, unless 1) suppressed or 2) wildcard version already exists */ -}}
{{- if and (not $.Values.ingress.suppressAutomaticWildcards) (not (hasPrefix "*." $address)) (not (has $wildcard $publicAddr)) -}}
{{- $publicAddr = append $publicAddr (printf "*.%s" $address) -}}
{{- end -}}
{{- end -}}
{{- $wildcard := printf "*.%s" $address -}}
{{- /* Add wildcard versions of all public addresses to ingress, unless 1) suppressed or 2) wildcard version already exists */ -}}
{{- if and (not $.Values.ingress.suppressAutomaticWildcards) (not (hasPrefix "*." $address)) (not (has $wildcard $publicAddr)) -}}
{{- $publicAddr = append $publicAddr (printf "*.%s" $address) -}}
{{- end -}}
{{- end -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down Expand Up @@ -58,4 +59,5 @@ spec:
port:
number: 443
{{- end }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions examples/chart/teleport-cluster/tests/ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ tests:
- isKind:
of: Ingress

- it: does not create an Ingress when ingress.enabled=true, proxyListenerMode=multiplex but ingress.useExisting is true
values:
- ../.lint/ingress.yaml
set:
ingress:
useExisting: true
asserts:
- hasDocuments:
count: 0

- it: fails to deploy an Ingress when ingress.enabled=true and proxyListenerMode is not set
values:
- ../.lint/ingress.yaml
Expand Down
5 changes: 5 additions & 0 deletions examples/chart/teleport-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ service:
# See https://goteleport.com/docs/architecture/tls-routing/#working-with-layer-7-load-balancers-or-reverse-proxies-preview for details.
ingress:
enabled: false
# useExisting indicates to the chart that you are managing your own ingress.
# (or HTTPRoute, or any other LoadBalancing method that terminates TLS).
# The chart will configure Teleport like it's running behind an ingress, but will not create the ingress resource.
# You are responsible for creating and managing the ingress.
useExisting: false
# Setting suppressAutomaticWildcards to true will not automatically add *.<clusterName> as a hostname served
# by the Ingress. This may be desirable if you don't use Teleport Application Access.
suppressAutomaticWildcards: false
Expand Down
Loading