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
7 changes: 7 additions & 0 deletions .github/workflows/helm-template-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ jobs:
--set 'gateway.parentRefs[0].namespace=gateway-system' \
--api-versions gateway.networking.k8s.io/v1/HTTPRoute \
--api-versions gateway.nginx.org/v1alpha1/ClientSettingsPolicy
# helm upgrade --reuse-values from a chart without `gateway` drops the key
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 \
--set gateway=null

- name: Validate Live Chart
run: |
Expand Down
2 changes: 1 addition & 1 deletion charts/ai/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: codetogether-ai
description: CodeTogether AI on-premises Kubernetes deployment

type: application
version: 0.2.1
version: 0.2.2
appVersion: "1.2.8165"

icon: https://www.codetogether.com/wp-content/uploads/2020/02/codetogether-circle-128.png
Expand Down
9 changes: 5 additions & 4 deletions charts/ai/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Application URL:
{{- if or .Values.ingress.enabled .Values.gateway.enabled }}
{{- $gw := .Values.gateway | default dict }}
{{- if or .Values.ingress.enabled $gw.enabled }}
https://{{ include "ctai.publicHost" . }}/
{{- else }}
Use: kubectl port-forward svc/{{ include "ctai.fullname" . }} 1080:{{ .Values.service.port }}
Expand Down Expand Up @@ -34,11 +35,11 @@ Protected storage master key:
{{- end }}
{{- end }}

{{- if .Values.gateway.enabled }}
{{- if $gw.enabled }}

Gateway API:
{{- $parents := list }}
{{- range .Values.gateway.parentRefs }}
{{- range $gw.parentRefs }}
{{- $p := .name }}
{{- with .namespace }}{{ $p = printf "%s (namespace %s)" $p . }}{{ end }}
{{- with .sectionName }}{{ $p = printf "%s listener %s" $p . }}{{ end }}
Expand All @@ -47,7 +48,7 @@ Gateway API:
HTTPRoute {{ include "ctai.fullname" . }} attaches to: {{ join ", " $parents }}
Check it was accepted: kubectl get httproute {{ include "ctai.fullname" . }} -n {{ .Release.Namespace }} -o jsonpath='{.status.parents[*].conditions}'
{{- if eq (include "ctai.renderClientSettingsPolicy" .) "true" }}
Request body limit: ClientSettingsPolicy {{ include "ctai.fullname" . }} ({{ .Values.gateway.nginxGatewayFabric.clientSettingsPolicy.bodyMaxSize }}).
Request body limit: ClientSettingsPolicy {{ include "ctai.fullname" . }} ({{ include "ctai.clientSettingsBodyMaxSize" . }}).
{{- else }}
WARNING: no request body limit was rendered for the Gateway. OTLP uploads over
the gateway's default (1MB on NGINX Gateway Fabric) will fail with 413. Set the
Expand Down
12 changes: 10 additions & 2 deletions charts/ai/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,20 @@ the chart doesn't render a duplicate.
Whether to render the NGINX Gateway Fabric ClientSettingsPolicy: "true" or "".
*/}}
{{- define "ctai.renderClientSettingsPolicy" -}}
{{- if .Values.gateway.enabled -}}
{{- $mode := toString ((.Values.gateway.nginxGatewayFabric | default dict).clientSettingsPolicy | default dict).enabled -}}
{{- if (.Values.gateway | default dict).enabled -}}
{{- $mode := toString (((.Values.gateway | default dict).nginxGatewayFabric | default dict).clientSettingsPolicy | default dict).enabled -}}
{{- if eq $mode "true" -}}
true
{{- else if and (eq $mode "auto") (.Capabilities.APIVersions.Has "gateway.nginx.org/v1alpha1/ClientSettingsPolicy") -}}
true
{{- end -}}
{{- end -}}
{{- end }}

{{/*
ClientSettingsPolicy body limit. Read defensively: a `helm upgrade --reuse-values`
from a chart without `gateway` keeps the old values and skips these defaults.
*/}}
{{- define "ctai.clientSettingsBodyMaxSize" -}}
{{- (((.Values.gateway | default dict).nginxGatewayFabric | default dict).clientSettingsPolicy | default dict).bodyMaxSize | default "16m" -}}
{{- end }}
2 changes: 1 addition & 1 deletion charts/ai/templates/clientsettingspolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ spec:
kind: HTTPRoute
name: {{ $fullName }}
body:
maxSize: {{ .Values.gateway.nginxGatewayFabric.clientSettingsPolicy.bodyMaxSize | quote }}
maxSize: {{ include "ctai.clientSettingsBodyMaxSize" . | quote }}
{{- end }}
11 changes: 6 additions & 5 deletions charts/ai/templates/httproute.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.gateway.enabled }}
{{- if not .Values.gateway.parentRefs }}
{{- $gw := .Values.gateway | default dict }}
{{- if $gw.enabled }}
{{- if not $gw.parentRefs }}
{{- fail "gateway.enabled=true requires gateway.parentRefs: the Gateway (name, and namespace/sectionName if needed) the HTTPRoute attaches to." }}
{{- end }}
{{- if not (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/HTTPRoute") }}
Expand All @@ -12,16 +13,16 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "ctai.labels" . | nindent 4 }}
{{- with .Values.gateway.labels }}
{{- with $gw.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.gateway.annotations }}
{{- with $gw.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
parentRefs:
{{- toYaml .Values.gateway.parentRefs | nindent 4 }}
{{- toYaml $gw.parentRefs | nindent 4 }}
hostnames:
- {{ include "ctai.routeHostname" . | quote }}
rules:
Expand Down
Loading