Skip to content
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
28 changes: 28 additions & 0 deletions .github/workflows/helm-template-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion charts/collab/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
96 changes: 96 additions & 0 deletions charts/collab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 | `<release fullname>-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` |
Expand Down Expand Up @@ -78,6 +90,90 @@ To secure CodeTogether, you can add a `secret` that contains your TLS (Transport
$ kubectl create secret tls codetogether-tls --key <your-private-key-filename> --cert <your-certificate-filename>
```

## 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 <release fullname>-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
```

If you already applied a ListenerSet with the same name by hand, Helm refuses to
take it over. Let Helm adopt it before the upgrade:

```bash
kubectl -n <namespace> label listenerset <release-fullname> app.kubernetes.io/managed-by=Helm
kubectl -n <namespace> annotate listenerset <release-fullname> \
meta.helm.sh/release-name=<release> meta.helm.sh/release-namespace=<namespace>
```

A `helm rollback` to a chart version without `gateway`, or a `helm uninstall`,
deletes the ListenerSet and with it this host's listener.

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 <release-fullname> -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`:
Expand Down
29 changes: 29 additions & 0 deletions charts/collab/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
40 changes: 39 additions & 1 deletion charts/collab/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,42 @@ Get Proxy secret name
{{- printf "%s-proxy-secret" $fullName }}
{{- end }}
{{- end }}
{{- end }}
{{- 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 }}
36 changes: 36 additions & 0 deletions charts/collab/templates/httproute.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
42 changes: 42 additions & 0 deletions charts/collab/templates/listenerset.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
43 changes: 43 additions & 0 deletions charts/collab/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <release fullname>-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
Expand Down
Loading