diff --git a/.github/workflows/helm-template-check.yml b/.github/workflows/helm-template-check.yml index f1e6b86..bc5b0b1 100644 --- a/.github/workflows/helm-template-check.yml +++ b/.github/workflows/helm-template-check.yml @@ -23,6 +23,34 @@ jobs: - name: Validate Collab Chart run: | helm template collab ./charts/collab --values ./charts/collab/values.yaml + # Gateway API: HTTPRoute on an existing Gateway listener + helm template collab ./charts/collab --values ./charts/collab/values.yaml \ + --set ingress.enabled=false \ + --set gateway.enabled=true \ + --set 'gateway.parentRefs[0].name=shared-gateway' \ + --set 'gateway.parentRefs[0].namespace=gateway-system' \ + --api-versions gateway.networking.k8s.io/v1/HTTPRoute + # ListenerSet on a shared Gateway; the HTTPRoute attaches to it + helm template collab ./charts/collab --values ./charts/collab/values.yaml \ + --set ingress.enabled=false \ + --set gateway.enabled=true \ + --set gateway.listenerSet.enabled=true \ + --set gateway.listenerSet.parentRef.name=shared-gateway \ + --set gateway.listenerSet.parentRef.namespace=gateway-system \ + --api-versions gateway.networking.k8s.io/v1/HTTPRoute \ + --api-versions gateway.networking.k8s.io/v1/ListenerSet \ + > /tmp/collab-listenerset.yaml + grep -q '^kind: ListenerSet$' /tmp/collab-listenerset.yaml + grep -q 'kind: ListenerSet$' <(sed -n '/^kind: HTTPRoute$/,/^---/p' /tmp/collab-listenerset.yaml) + # listenerSet without gateway.enabled must fail instead of rendering nothing + if helm template collab ./charts/collab --values ./charts/collab/values.yaml \ + --set gateway.listenerSet.enabled=true \ + --set gateway.listenerSet.parentRef.name=shared-gateway > /tmp/collab-ls-no-gw.out 2>&1; then + echo "listenerSet without gateway.enabled rendered" >&2; exit 1 + fi + grep -q 'requires gateway.enabled=true' /tmp/collab-ls-no-gw.out + # helm upgrade --reuse-values from a chart without `gateway` drops the key + helm template collab ./charts/collab --values ./charts/collab/values.yaml --set gateway=null - name: Validate HQ Chart run: | @@ -85,6 +113,27 @@ jobs: --set imageCredentials.username=test \ --set imageCredentials.password=test \ --set gateway=null + # Rollout strategy: the default, what --reuse-values from a chart + # before 0.2.4 leaves (no deploymentStrategy), and a Recreate override. + ai_strategy() { + helm template test ./charts/ai \ + --set-file ctaiPropertiesFile=./charts/ai/ctai-configuration.properties.template \ + --set service.fqdn=https://example.codetogether.io \ + --set imageCredentials.username=test \ + --set imageCredentials.password=test \ + --show-only templates/deployment.yaml "$@" \ + | sed -n '/^ strategy:$/,/^ selector:$/p' + } + default_strategy="$(ai_strategy)" + grep -q 'type: RollingUpdate' <<<"$default_strategy" + grep -q 'maxSurge: 0' <<<"$default_strategy" + grep -q 'maxUnavailable: 1' <<<"$default_strategy" + [ "$(ai_strategy --set deploymentStrategy=null)" = "$default_strategy" ] + recreate_strategy="$(ai_strategy --set deploymentStrategy.type=Recreate --set deploymentStrategy.rollingUpdate=null)" + grep -q 'type: Recreate' <<<"$recreate_strategy" + if grep -q 'rollingUpdate' <<<"$recreate_strategy"; then + echo "Recreate rendered rollingUpdate" >&2; exit 1 + fi - name: Validate Live Chart run: | diff --git a/charts/ai/Chart.yaml b/charts/ai/Chart.yaml index aa3b426..12db068 100644 --- a/charts/ai/Chart.yaml +++ b/charts/ai/Chart.yaml @@ -3,7 +3,7 @@ name: codetogether-ai description: CodeTogether AI on-premises Kubernetes deployment type: application -version: 0.2.3 +version: 0.2.4 appVersion: "1.2.8616" icon: https://www.codetogether.com/wp-content/uploads/2020/02/codetogether-circle-128.png diff --git a/charts/ai/README.md b/charts/ai/README.md index 92685be..1e1ebed 100644 --- a/charts/ai/README.md +++ b/charts/ai/README.md @@ -374,6 +374,58 @@ If login fails after returning from Google or another identity provider with and that the registered OAuth redirect URI exactly matches `{service_fqdn}/api/v1/auth/sso/provider/callback`. +### What the container image contains + +The image is built on [Wolfi](https://github.com/wolfi-dev), a minimal Linux +distribution, and runs as the non-root user `ctai` (uid and gid `2200`). + +- Shell and tools: `bash`, BusyBox `sh` (`/bin/sh`), `curl`, `ps`, `top`, + `ping`, `netstat`, `vi`, `less`, and the GNU core utilities. `ss`, `ip`, + `openssl` and `dig` are not included. +- Java: OpenJDK 25 with its tools (`jcmd`, `jstack`, `jmap`, `jfr`, + `keytool`). `JAVA_HOME` is `/usr/lib/jvm/default-jvm`, and the JDK's trust + store is `/etc/ssl/certs/java/cacerts`. +- Packages: the package manager is `apk`. It needs root, so it cannot install + anything in the running container. An image built `FROM` this one installs + packages with `apk add` as root before switching back to `USER 2200`. + +### Inspect a running pod + +`kubectl exec` is enough for the tools above: + +```bash +kubectl exec -it -n codetogether-ai deploy/codetogether-ai -c codetogether-ai -- bash +``` + +For a tool the image does not have, attach an ephemeral debug container. It +shares the application's process namespace and network, so it sees the Java +process, its files under `/proc//root` and `localhost`, and nothing +restarts. Use kubectl 1.32 or later, and any image your cluster can pull: + +```bash +POD=$(kubectl get pod -n codetogether-ai -l app.kubernetes.io/name=codetogether-ai -o name | head -1) +kubectl debug -it -n codetogether-ai "$POD" \ + --image= \ + --target=codetogether-ai --profile=general -c debug -- sh +``` + +If the namespace enforces the Pod Security `restricted` profile, which does not +allow a root debug container, use the CodeTogether AI image itself as the debug +image and run it as the application's user. The image names its user (`ctai`), +so the numeric uid has to be given: + +```bash +echo '{"securityContext":{"runAsUser":2200,"runAsGroup":2200}}' > uid2200.json +IMAGE=$(kubectl get "$POD" -n codetogether-ai -o jsonpath='{.spec.containers[0].image}') +kubectl debug -it -n codetogether-ai "$POD" --image="$IMAGE" \ + --target=codetogether-ai --profile=restricted --custom=uid2200.json \ + -c debug-app -- bash +``` + +An ephemeral container stays in the pod's spec until the pod is replaced, and +each one needs a new name (`-c`). The process environment and the mounted +properties file contain secrets: do not paste them into tickets or chat. + ## Upgrade ```bash @@ -399,6 +451,51 @@ helm upgrade codetogether-ai codetogether/codetogether-ai \ The Deployment rolls when the chart-managed properties Secret changes. +### Rollout strategy + +From chart 0.2.4 the Deployment stops the old pod before it starts the new one +(`deploymentStrategy`: `RollingUpdate` with `maxSurge: 0`, `maxUnavailable: 1`). +On a single replica an upgrade therefore has a short outage while the new pod +starts. Earlier charts used the Kubernetes default, which starts the new pod +first. + +The pods of one release share an embedded Hazelcast cluster, and a pod only +joins a cluster that runs its own Hazelcast minor version. When a release +changes that version (the release notes say so), any old pod still running +makes the new pod fail to join: its container exits and restarts in a loop, and +the rollout never completes while the old pods keep serving. `helm upgrade` +without `--wait` still prints `deployed`; `kubectl rollout status` shows the +stall. + +- **One replica:** the default strategy handles it, as long as the release was + upgraded to chart 0.2.4 or later. Upgrade the chart and the image in the same + `helm upgrade`, as above. +- **More than one replica:** upgrade across a Hazelcast version with + `Recreate`, which stops every old pod first (a short outage): + + ```bash + helm upgrade codetogether-ai codetogether/codetogether-ai \ + --namespace codetogether-ai \ + --reset-then-reuse-values \ + --set deploymentStrategy.type=Recreate \ + --set deploymentStrategy.rollingUpdate=null + ``` + + `rollingUpdate=null` is required: Helm merges overrides into the existing + values, and Kubernetes rejects `Recreate` while `rollingUpdate` is set. The + same command completes a rollout that has already stalled. + `--reset-then-reuse-values` keeps `Recreate` for later upgrades; to return to + the default on a later upgrade, add (Helm 3.10 or later) + `--set-json 'deploymentStrategy={"type":"RollingUpdate","rollingUpdate":{"maxSurge":0,"maxUnavailable":1}}'`. + +If a rollout has already stalled on a chart older than 0.2.4, switch the +Deployment to `Recreate` directly: + +```bash +kubectl -n codetogether-ai patch deployment codetogether-ai \ + -p '{"spec":{"strategy":{"type":"Recreate","rollingUpdate":null}}}' +``` + ## Uninstall ```bash diff --git a/charts/ai/templates/deployment.yaml b/charts/ai/templates/deployment.yaml index dd87f27..464e5a6 100644 --- a/charts/ai/templates/deployment.yaml +++ b/charts/ai/templates/deployment.yaml @@ -7,6 +7,10 @@ metadata: {{- include "ctai.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} + {{- /* Read through default: --reuse-values from a chart before 0.2.4 has no deploymentStrategy. */}} + {{- $strategy := .Values.deploymentStrategy | default (dict "type" "RollingUpdate" "rollingUpdate" (dict "maxSurge" 0 "maxUnavailable" 1)) }} + strategy: + {{- toYaml $strategy | nindent 4 }} selector: matchLabels: {{- include "ctai.selectorLabels" . | nindent 6 }} diff --git a/charts/ai/values.yaml b/charts/ai/values.yaml index 3500d75..dbca263 100644 --- a/charts/ai/values.yaml +++ b/charts/ai/values.yaml @@ -202,6 +202,21 @@ tolerations: [] affinity: {} replicaCount: 1 +# Rollout strategy. The default stops the old pod before it starts the new one +# (a short outage on a single replica), instead of the Kubernetes default +# (maxSurge 25%, which rounds up to one extra pod). Pods of one release share an +# embedded Hazelcast cluster, and a pod only joins a cluster of its own +# Hazelcast minor version: when a release changes that version, an old pod still +# running makes the new pod fail to join and restart in a loop, so a surge +# rollout never completes. With more than one replica, upgrade across a +# Hazelcast version with Recreate (see "Upgrade" in README.md): +# --set deploymentStrategy.type=Recreate --set deploymentStrategy.rollingUpdate=null +deploymentStrategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + extraEnvVars: [] extraVolumes: [] extraVolumeMounts: [] diff --git a/charts/collab/Chart.yaml b/charts/collab/Chart.yaml index a4e3bb8..a78ba9e 100644 --- a/charts/collab/Chart.yaml +++ b/charts/collab/Chart.yaml @@ -3,7 +3,7 @@ name: codetogether-collab description: CodeTogether Collab type: application -version: 1.2.9 +version: 1.3.0 appVersion: "2026.1.2" icon: https://www.codetogether.com/wp-content/uploads/2020/02/codetogether-circle-128.png diff --git a/charts/collab/README.md b/charts/collab/README.md index f235f45..a2d7f62 100644 --- a/charts/collab/README.md +++ b/charts/collab/README.md @@ -11,6 +11,10 @@ This chart has been created with Helm v3 and tested with: - Kubernetes v1.18+ - Helm v3.5+ +With `gateway.enabled=true` (see [Gateway API](#gateway-api-nginx-gateway-fabric)), +the cluster also needs the Gateway API CRDs (v1.5+ for the ListenerSet) and a +`Gateway`, for example from NGINX Gateway Fabric. + ## Configuration The following table lists configurable parameters of the CodeTogether Collab chart and their default values: @@ -47,6 +51,14 @@ The following table lists configurable parameters of the CodeTogether Collab cha | `locatorEdge.region` | Region for the edge server | `default` | | `ingress.enabled` | Enables ingress controller resource | `true` | | `ingress.tls.secretName` | TLS secret name for ingress | `codetogether-tls` | +| `gateway.enabled` | Creates a Gateway API `HTTPRoute` for the `codetogether.url` host | `false` | +| `gateway.parentRefs` | Gateway(s) the `HTTPRoute` attaches to; required when enabled unless `gateway.listenerSet.enabled` | `[]` | +| `gateway.annotations` / `gateway.labels` | Extra `HTTPRoute` metadata (`labels` also go on the `ListenerSet`) | `{}` | +| `gateway.listenerSet.enabled` | Creates a `ListenerSet` with this release's HTTPS listener; requires `gateway.enabled=true` | `false` | +| `gateway.listenerSet.parentRef` | The shared Gateway (`name`, `namespace`); required when enabled | `{}` | +| `gateway.listenerSet.listenerName` / `port` | Listener name (the route's `sectionName`) and port | `https` / `443` | +| `gateway.listenerSet.tlsSecretName` | TLS Secret for the listener | `-tls` | +| `gateway.listenerSet.annotations` | `ListenerSet` annotations (e.g. the cert-manager issuer) | `{}` | | `dashboard.enabled` | Enables the dashboard and allows configuration of credentials | `false` | | `dashboard.username` | Dashboard username | `my-dashboard-username` | | `dashboard.password` | Dashboard password | `my-dashboard-password` | @@ -78,6 +90,99 @@ To secure CodeTogether, you can add a `secret` that contains your TLS (Transport $ kubectl create secret tls codetogether-tls --key --cert ``` +## Gateway API (NGINX Gateway Fabric) + +Clusters that route with Gateway API instead of an Ingress controller (for +example NGINX Gateway Fabric, which replaces the retired ingress-nginx) can have +the chart attach an `HTTPRoute` to an existing `Gateway`: + +```yaml +ingress: + enabled: false +gateway: + enabled: true + parentRefs: + - name: shared-gateway # your Gateway + namespace: gateway-system # omit if it is in the release namespace + sectionName: https # the HTTPS listener with the certificate +``` + +The chart renders an `HTTPRoute` for the `codetogether.url` host that sends `/` +to the chart Service. WebSocket connections need no extra setting: NGINX Gateway +Fabric passes the upgrade through. Settings you added as Ingress annotations +(`ingress.annotations`, `ingress.config`) don't carry over; set the equivalent on +your Gateway. + +### ListenerSet: your own listener on a shared Gateway + +Instead of adding a listener to the shared `Gateway` for this host, the chart +can create a `ListenerSet` (`gateway.networking.k8s.io/v1`, Gateway API v1.5+) +that adds the HTTPS listener for the `codetogether.url` host, with its +certificate, from the release namespace. The `HTTPRoute` then attaches to that +ListenerSet, so leave `gateway.parentRefs` empty: + +```yaml +ingress: + enabled: false +gateway: + enabled: true + listenerSet: + enabled: true + parentRef: + name: gateway-ngf # the shared Gateway + namespace: kube-system + # The certificate Secret defaults to -tls. Set + # tlsSecretName: codetogether-tls to keep the certificate from the TLS step. + annotations: + cert-manager.io/cluster-issuer: cert-manager-clusterissuer +``` + +The shared Gateway has to accept ListenerSets from the release namespace +(`spec.allowedListeners.namespaces`). With a cert-manager version that supports +ListenerSets, the issuer annotation on the ListenerSet issues the certificate +into that Secret; otherwise create the Secret yourself. On cert-manager v1.21 +that support is off by default; enable it in the cert-manager chart values: + +```yaml +config: + apiVersion: controller.config.cert-manager.io/v1alpha1 + kind: ControllerConfiguration + enableGatewayAPI: true + enableGatewayAPIListenerSet: true +featureGates: ListenerSets=true +``` + +Chart versions before 1.3.0 don't render Gateway API objects, so a Gateway setup +on them was applied by hand. If a ListenerSet or an HTTPRoute with the release +fullname already exists, Helm refuses to take it over (`invalid ownership +metadata`) and the upgrade stops without changing anything. Let Helm adopt each +one that exists before the upgrade: + +```bash +for kind in listenerset httproute; do + kubectl -n label $kind app.kubernetes.io/managed-by=Helm + kubectl -n annotate $kind \ + meta.helm.sh/release-name= meta.helm.sh/release-namespace= +done +``` + +With the same host and TLS Secret name, the upgrade keeps serving traffic and +cert-manager keeps the existing certificate. + +A `helm rollback` to a chart version without `gateway`, or a `helm uninstall`, +deletes the ListenerSet and the HTTPRoute, and with them this host's listener +and route. + +The chart doesn't create the `Gateway`. On the Gateway side, check that: + +- the listener allows routes from the release namespace + (`allowedRoutes.namespaces`); +- the listener can read its certificate Secret. A Secret in another namespace + needs a `ReferenceGrant` there; +- the route is accepted: + `kubectl get httproute -o jsonpath='{.status.parents[*].conditions}'` + (the install notes print the exact command). + ## Installing the Chart To install the chart with the release name `codetogether-collab`: diff --git a/charts/collab/templates/NOTES.txt b/charts/collab/templates/NOTES.txt index 7944fec..df07709 100644 --- a/charts/collab/templates/NOTES.txt +++ b/charts/collab/templates/NOTES.txt @@ -1,7 +1,36 @@ Application URL: +{{- $gw := .Values.gateway | default dict }} {{- if .Values.ingress.enabled }} {{- $host := (urlParse .Values.codetogether.url).host }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ .path }} +{{- else if $gw.enabled }} + https://{{ (urlParse .Values.codetogether.url).host }}/ +{{- end }} + +{{- if $gw.enabled }} + +Gateway API: + {{- $parents := list }} + {{- range $gw.parentRefs }} + {{- $p := .name }} + {{- with .namespace }}{{ $p = printf "%s (namespace %s)" $p . }}{{ end }} + {{- with .sectionName }}{{ $p = printf "%s listener %s" $p . }}{{ end }} + {{- $parents = append $parents $p }} + {{- end }} + {{- if eq (include "codetogether.listenerSetEnabled" .) "true" }} + {{- $lsParent := $gw.listenerSet.parentRef }} + ListenerSet {{ include "codetogether.fullname" . }} adds an HTTPS listener to Gateway {{ $lsParent.name }}{{ with $lsParent.namespace }} (namespace {{ . }}){{ end }}. + Check it was accepted: kubectl get listenerset {{ include "codetogether.fullname" . }} -n {{ .Release.Namespace }} -o jsonpath='{.status.conditions}' + {{- if not $parents }} + {{- $parents = list (printf "ListenerSet %s listener %s" (include "codetogether.fullname" .) ($gw.listenerSet.listenerName | default "https")) }} + {{- end }} + {{- end }} + HTTPRoute {{ include "codetogether.fullname" . }} attaches to: {{ join ", " $parents }} + Check it was accepted: kubectl get httproute {{ include "codetogether.fullname" . }} -n {{ .Release.Namespace }} -o jsonpath='{.status.parents[*].conditions}' +{{- if .Values.ingress.enabled }} + WARNING: ingress.enabled is also true, so both an Ingress and an HTTPRoute + serve this host. Set ingress.enabled=false once the Gateway path works. +{{- end }} {{- end }} {{- if or .Values.av.enabled .Values.av.serverIP .Values.av.stunServers.enabled .Values.av.jitsiUrl }} diff --git a/charts/collab/templates/_helpers.tpl b/charts/collab/templates/_helpers.tpl index d257964..c6f017e 100644 --- a/charts/collab/templates/_helpers.tpl +++ b/charts/collab/templates/_helpers.tpl @@ -94,4 +94,42 @@ Get Proxy secret name {{- printf "%s-proxy-secret" $fullName }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} + +{{/* +Gateway API hostname: the codetogether.url host without a port (Gateway API +hostnames can't carry one). +*/}} +{{- define "codetogether.routeHostname" -}} +{{- $host := regexReplaceAll ":[0-9]+$" (urlParse (toString .Values.codetogether.url)).host "" -}} +{{- if not $host -}} +{{- fail "gateway.enabled=true requires codetogether.url to be a full URL with a host, for example https://codetogether.example.com." -}} +{{- end -}} +{{- $host -}} +{{- end }} + +{{/* +"true" when the chart renders a ListenerSet. Read `gateway` defensively: a +`helm upgrade --reuse-values` from a chart without it keeps the old values and +skips the new defaults. +*/}} +{{- define "codetogether.listenerSetEnabled" -}} +{{- $gw := .Values.gateway | default dict -}} +{{- if and $gw.enabled ($gw.listenerSet | default dict).enabled -}}true{{- end -}} +{{- end }} + +{{/* +HTTPRoute parentRefs: gateway.parentRefs when set; otherwise the chart's +ListenerSet and its listener. +*/}} +{{- define "codetogether.routeParentRefs" -}} +{{- $gw := .Values.gateway | default dict -}} +{{- if $gw.parentRefs -}} +{{- toYaml $gw.parentRefs -}} +{{- else if eq (include "codetogether.listenerSetEnabled" .) "true" -}} +- group: gateway.networking.k8s.io + kind: ListenerSet + name: {{ include "codetogether.fullname" . }} + sectionName: {{ ($gw.listenerSet | default dict).listenerName | default "https" }} +{{- end -}} +{{- end }} diff --git a/charts/collab/templates/httproute.yaml b/charts/collab/templates/httproute.yaml new file mode 100644 index 0000000..ccfdee0 --- /dev/null +++ b/charts/collab/templates/httproute.yaml @@ -0,0 +1,36 @@ +{{- $gw := .Values.gateway | default dict }} +{{- if $gw.enabled }} +{{- if not (include "codetogether.routeParentRefs" .) }} +{{- fail "gateway.enabled=true requires gateway.parentRefs (the Gateway, and namespace/sectionName if needed, the HTTPRoute attaches to) or gateway.listenerSet.enabled=true." }} +{{- end }} +{{- if not (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/HTTPRoute") }} +{{- fail "gateway.enabled=true but the cluster does not serve gateway.networking.k8s.io/v1 HTTPRoute. Install the Gateway API CRDs (or pass --api-versions gateway.networking.k8s.io/v1/HTTPRoute to helm template)." }} +{{- end }} +{{- $fullName := include "codetogether.fullname" . }} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ $fullName }} + labels: + {{- include "codetogether.labels" . | nindent 4 }} + {{- with $gw.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $gw.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + parentRefs: + {{- include "codetogether.routeParentRefs" . | nindent 4 }} + hostnames: + - {{ include "codetogether.routeHostname" . | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: {{ $fullName }} + port: {{ .Values.service.port }} +{{- end }} diff --git a/charts/collab/templates/listenerset.yaml b/charts/collab/templates/listenerset.yaml new file mode 100644 index 0000000..c944857 --- /dev/null +++ b/charts/collab/templates/listenerset.yaml @@ -0,0 +1,42 @@ +{{- $gwValues := .Values.gateway | default dict }} +{{- if and ($gwValues.listenerSet | default dict).enabled (not $gwValues.enabled) }} +{{- fail "gateway.listenerSet.enabled=true requires gateway.enabled=true: the ListenerSet carries the HTTPRoute's listener, and without the HTTPRoute nothing is rendered." }} +{{- end }} +{{- if eq (include "codetogether.listenerSetEnabled" .) "true" }} +{{- $ls := .Values.gateway.listenerSet }} +{{- $parent := $ls.parentRef | default dict }} +{{- if not $parent.name }} +{{- fail "gateway.listenerSet.enabled=true requires gateway.listenerSet.parentRef.name: the Gateway the ListenerSet adds a listener to." }} +{{- end }} +{{- if not (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/ListenerSet") }} +{{- fail "gateway.listenerSet.enabled=true but the cluster does not serve gateway.networking.k8s.io/v1 ListenerSet. Install Gateway API v1.5+ standard CRDs (or pass --api-versions gateway.networking.k8s.io/v1/ListenerSet to helm template)." }} +{{- end }} +# HTTPS listener for this release on the shared Gateway {{ $parent.name }}. With a +# cert-manager.io/(cluster-)issuer annotation, cert-manager issues the +# certificate into the Secret named below. +apiVersion: gateway.networking.k8s.io/v1 +kind: ListenerSet +metadata: + name: {{ include "codetogether.fullname" . }} + labels: + {{- include "codetogether.labels" . | nindent 4 }} + {{- with $gwValues.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $ls.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + parentRef: + {{- toYaml $parent | nindent 4 }} + listeners: + - name: {{ $ls.listenerName | default "https" }} + hostname: {{ include "codetogether.routeHostname" . | quote }} + port: {{ $ls.port | default 443 }} + protocol: HTTPS + tls: + mode: Terminate + certificateRefs: + - name: {{ $ls.tlsSecretName | default (printf "%s-tls" (include "codetogether.fullname" .)) }} +{{- end }} diff --git a/charts/collab/values.yaml b/charts/collab/values.yaml index 6b514a0..b0ee29a 100644 --- a/charts/collab/values.yaml +++ b/charts/collab/values.yaml @@ -163,6 +163,49 @@ ingress: tls: - secretName: codetogether-tls # +# Gateway API (gateway.networking.k8s.io/v1), for clusters that route with a +# Gateway instead of an Ingress controller (for example NGINX Gateway Fabric, +# replacing the retired ingress-nginx). Off by default. +# +# The chart attaches an HTTPRoute for the codetogether.url host to a Gateway you +# already run. It does not create the Gateway. Set ingress.enabled=false when you +# switch, unless you deliberately run both during a migration. +# +gateway: + enabled: false + # Gateway(s) the HTTPRoute attaches to. Required when enabled, unless + # listenerSet.enabled is true. Example: + # parentRefs: + # - name: shared-gateway + # namespace: gateway-system + # sectionName: https # the HTTPS listener that holds the certificate + parentRefs: [] + annotations: {} + labels: {} + # Optional ListenerSet (gateway.networking.k8s.io/v1, Gateway API v1.5+): adds + # this release's HTTPS listener (the codetogether.url host and its certificate) + # to a shared Gateway, so the shared Gateway doesn't need a listener edited for + # each application. The Gateway must allow it (spec.allowedListeners). When + # enabled and parentRefs is empty, the HTTPRoute attaches to this ListenerSet; + # if parentRefs is set, the HTTPRoute attaches only to those parents. + listenerSet: + enabled: false + # The Gateway this ListenerSet adds a listener to. Required when enabled. + # Example: + # parentRef: + # name: gateway-ngf + # namespace: kube-system + parentRef: {} + listenerName: https + port: 443 + # cert-manager reads these (cert-manager.io/cluster-issuer or + # cert-manager.io/issuer) and issues the certificate into tlsSecretName. + annotations: {} + # TLS Secret in the release namespace. Defaults to -tls. + # Set it to codetogether-tls to keep the certificate the Ingress used. + tlsSecretName: "" + +# # CodeTogether has a dashboard to view metrics, and for the locator, update # configuration on the fly. If a custom username and password is not enabled, # one will be dynamically generated and shared in the log when the server