-
Notifications
You must be signed in to change notification settings - Fork 52
feat(chart): Add Gateway API support and merge HTTP + GRPC traffic #2643
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| {{- if .Values.dex.httpRoute.enabled }} | ||
| {{- /* | ||
| Copyright Chainloop, Inc. All Rights Reserved. | ||
| SPDX-License-Identifier: APACHE-2.0 | ||
| */}} | ||
| {{- $fullName := include "chainloop.dex.fullname" . -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ $fullName }} | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| labels: {{- include "chainloop.dex.labels" . | nindent 4 }} | ||
| {{- if .Values.dex.httpRoute.labels }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.labels "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.dex.httpRoute.annotations }} | ||
| annotations: | ||
| {{- include "common.tplvalues.render" ( dict "value" .Values.dex.httpRoute.annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| {{- if .Values.dex.httpRoute.parentRefs }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.parentRefs "context" .) | nindent 4 }} | ||
| {{- else }} | ||
| - name: gateway | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| {{- end }} | ||
| hostnames: {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.hostnames "context" .) | nindent 4 }} | ||
| rules: | ||
| {{- $port := coalesce .Values.dex.service.port .Values.dex.service.ports.http }} | ||
| - backendRefs: | ||
| - name: {{ include "chainloop.dex.fullname" . }} | ||
| port: {{ $port }} | ||
| {{- if .Values.dex.httpRoute.matches }} | ||
| matches: {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.matches "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.dex.httpRoute.filters }} | ||
| filters: {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.filters "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.dex.httpRoute.extraRules }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.dex.httpRoute.extraRules "context" .) | nindent 4 }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,19 +4,6 @@ APP VERSION: {{ .Chart.AppVersion }} | |||||||||||||||
|
|
||||||||||||||||
| ** Please be patient while the chart is being deployed ** | ||||||||||||||||
|
|
||||||||||||||||
| ########################################################################### | ||||||||||||||||
| CONFIGURE CLI | ||||||||||||||||
| ########################################################################### | ||||||||||||||||
|
|
||||||||||||||||
| Configure the CLI to point to this instance, for example | ||||||||||||||||
|
|
||||||||||||||||
| chainloop --insecure config save \ | ||||||||||||||||
| --control-plane my-controlplane.acme.com:80 \ | ||||||||||||||||
| --artifact-cas cas.acme.com:80 | ||||||||||||||||
|
|
||||||||||||||||
| Refer to this link for more information | ||||||||||||||||
| https://docs.chainloop.dev/get-started/setup | ||||||||||||||||
|
|
||||||||||||||||
| ########################################################################### | ||||||||||||||||
| USEFUL LINKS | ||||||||||||||||
| ########################################################################### | ||||||||||||||||
|
|
@@ -30,3 +17,19 @@ https://docs.chainloop.dev/get-started/setup | |||||||||||||||
| {{- include "common.warnings.rollingTag" .Values.controlplane.migration.image }} | ||||||||||||||||
| {{- include "chainloop.validateValues" . }} | ||||||||||||||||
| {{- include "common.warnings.modifiedImages" (dict "images" (list .Values.controlplane.image .Values.cas.image .Values.controlplane.migration.image) "context" $) }} | ||||||||||||||||
|
|
||||||||||||||||
| ########################################################################### | ||||||||||||||||
| CONFIGURE CLI | ||||||||||||||||
| ########################################################################### | ||||||||||||||||
|
|
||||||||||||||||
| Configure the CLI to point to this instance, for example: | ||||||||||||||||
|
|
||||||||||||||||
| chainloop{{ ternary "" " --insecure" ( or .Values.controlplane.ingressAPI.tls .Values.controlplane.httpRoute.tls ) }} config save \ | ||||||||||||||||
| --control-plane {{ include "chainloop.controlplane.external_hostname" . }}:{{ ternary "443" "80" ( or .Values.controlplane.ingressAPI.tls .Values.controlplane.httpRoute.tls ) }} \ | ||||||||||||||||
| --artifact-cas {{ include "chainloop.cas.external_hostname" . }}:{{ ternary "443" "80" ( or .Values.cas.ingressAPI.tls .Values.cas.httpRoute.tls ) }} \ | ||||||||||||||||
|
|
||||||||||||||||
| Refer to this link for more information | ||||||||||||||||
| https://docs.chainloop.dev/getting-started/installation#configure-cli-optional | ||||||||||||||||
|
|
||||||||||||||||
| Refer to this link for more information | ||||||||||||||||
| https://docs.chainloop.dev/get-started/setup | ||||||||||||||||
|
Comment on lines
+31
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Duplicate "Refer to this link for more information" blocks in NOTES.txt Lines 31-35 of
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -316,18 +316,39 @@ NOTE: Load balancer service type is not supported | |
| {{- define "chainloop.controlplane.external_url" -}} | ||
| {{- $service := .Values.controlplane.service }} | ||
| {{- $ingress := .Values.controlplane.ingress }} | ||
| {{- $httpRoute := .Values.controlplane.httpRoute }} | ||
|
|
||
| {{- if .Values.controlplane.auth.oidc.externalURL }} | ||
| {{- .Values.controlplane.auth.oidc.externalURL }} | ||
| {{- else if (and $ingress $ingress.enabled $ingress.hostname) }} | ||
| {{- printf "%s://%s" (ternary "https" "http" $ingress.tls ) $ingress.hostname }} | ||
| {{- else if (and $httpRoute $httpRoute.enabled $httpRoute.hostnames ) }} | ||
| {{- printf "%s://%s" (ternary "https" "http" $httpRoute.tls ) ( index $httpRoute.hostnames 0) }} | ||
| {{- else if (and (eq $service.type "NodePort") $service.nodePorts (not (empty $service.nodePorts.http))) }} | ||
| {{- printf "http://localhost:%s" $service.nodePorts.http }} | ||
| {{- else -}} | ||
| null | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "chainloop.controlplane.external_hostname" -}} | ||
| {{- $service := .Values.controlplane.service }} | ||
| {{- $ingress := .Values.controlplane.ingress }} | ||
| {{- $httpRoute := .Values.controlplane.httpRoute }} | ||
|
|
||
| {{- if .Values.controlplane.auth.oidc.externalURL }} | ||
| {{- .Values.controlplane.auth.oidc.externalURL }} | ||
|
Comment on lines
+339
to
+340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 The Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| {{- else if (and $ingress $ingress.enabled $ingress.hostname) }} | ||
| {{- printf "%s" $ingress.hostname }} | ||
| {{- else if (and $httpRoute $httpRoute.enabled $httpRoute.hostnames ) }} | ||
| {{- printf "%s" ( index $httpRoute.hostnames 0) }} | ||
| {{- else if (and (eq $service.type "NodePort") $service.nodePorts (not (empty $service.nodePorts.http))) }} | ||
| {{- printf "localhost:%s" $service.nodePorts.http }} | ||
|
Comment on lines
+345
to
+346
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 NodePort case in In Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| {{- else -}} | ||
| null | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "chainloop.sentry" -}} | ||
| observability: | ||
| sentry: | ||
|
|
@@ -407,16 +428,35 @@ NOTE: Load balancer service type is not supported | |
| {{- define "chainloop.cas.external_url" -}} | ||
| {{- $service := .Values.cas.service }} | ||
| {{- $ingress := .Values.cas.ingress }} | ||
| {{- $httpRoute := .Values.cas.httpRoute }} | ||
|
|
||
| {{- if .Values.cas.externalURL }} | ||
| {{- .Values.cas.externalURL }} | ||
| {{- else if (and $ingress $ingress.enabled $ingress.hostname) }} | ||
| {{- printf "%s://%s" (ternary "https" "http" $ingress.tls ) $ingress.hostname }} | ||
| {{- else if (and $httpRoute $httpRoute.enabled $httpRoute.hostnames) }} | ||
| {{- printf "%s://%s" (ternary "https" "http" $httpRoute.tls ) (index $httpRoute.hostnames 0) }} | ||
| {{- else if (and (eq $service.type "NodePort") $service.nodePorts (not (empty $service.nodePorts.http))) }} | ||
| {{- printf "http://localhost:%s" $service.nodePorts.http }} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "chainloop.cas.external_hostname" -}} | ||
| {{- $service := .Values.cas.service }} | ||
| {{- $ingress := .Values.cas.ingress }} | ||
| {{- $httpRoute := .Values.cas.httpRoute }} | ||
|
|
||
| {{- if .Values.cas.externalURL }} | ||
| {{- .Values.cas.externalURL }} | ||
|
Comment on lines
+449
to
+450
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Same issue as with the controlplane: Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| {{- else if (and $ingress $ingress.enabled $ingress.hostname) }} | ||
| {{- printf "%s" $ingress.hostname }} | ||
| {{- else if (and $httpRoute $httpRoute.enabled $httpRoute.hostnames) }} | ||
| {{- printf "%s" (index $httpRoute.hostnames 0) }} | ||
| {{- else if (and (eq $service.type "NodePort") $service.nodePorts (not (empty $service.nodePorts.http))) }} | ||
| {{- printf "localhost:%s" $service.nodePorts.http }} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{/* | ||
| Check for Development mode | ||
| */}} | ||
|
|
@@ -435,6 +475,23 @@ Compile all warning messages into a single one | |
| {{- $messages := without $messages "" -}} | ||
| {{- $message := join "\n" $messages -}} | ||
|
|
||
| {{- if and (or (.Values.controlplane.ingress.enabled | default false) (.Values.controlplane.ingressAPI.enabled | default false)) (.Values.controlplane.httpRoute.enabled | default false) -}} | ||
| {{- fail "Invalid values: controlplane.ingress.enabled or controlplane.ingressAPI.enabled and controlplane.httpRoute.enabled cannot both be true." -}} | ||
| {{- end -}} | ||
|
|
||
| {{- if and (or (.Values.cas.ingress.enabled | default false) (.Values.cas.ingressAPI.enabled | default false)) (.Values.cas.httpRoute.enabled | default false) -}} | ||
| {{- fail "Invalid values: cas.ingress.enabled or cas.ingressAPI.enabled and cas.httpRoute.enabled cannot both be true." -}} | ||
| {{- end -}} | ||
|
|
||
|
|
||
| {{- if and (.Values.cas.httpRoute.enabled | default false) ( gt (len .Values.cas.httpRoute.hostnames) 1 ) -}} | ||
| {{- fail "Invalid values: .Values.cas.httpRoute.hostnames can only have one hostname" -}} | ||
| {{- end -}} | ||
|
|
||
| {{- if and (.Values.controlplane.httpRoute.enabled | default false) ( gt (len .Values.controlplane.httpRoute.hostnames) 1 ) -}} | ||
| {{- fail "Invalid values: .Values.controlplane.httpRoute.hostnames can only have one hostname" -}} | ||
| {{- end -}} | ||
|
|
||
| {{- if $message -}} | ||
| {{- printf "\n\nVALUES VALIDATION:\n%s" $message -}} | ||
| {{- end -}} | ||
|
|
@@ -448,5 +505,4 @@ Return the Nats connection string | |
| {{- $host := required "nats server hostname not set" .Values.controlplane.nats.host }} | ||
| {{- $port := required "nats server port not set" .Values.controlplane.nats.port }} | ||
| {{- printf "nats://%s:%d" $host ($port | int) }} | ||
| {{- end -}} | ||
|
|
||
| {{- end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| {{- if .Values.cas.httpRoute.enabled }} | ||
| {{- /* | ||
| Copyright Chainloop, Inc. All Rights Reserved. | ||
| SPDX-License-Identifier: APACHE-2.0 | ||
| */}} | ||
| {{- $fullName := include "chainloop.cas.fullname" . -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ $fullName }} | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| labels: {{- include "chainloop.cas.labels" . | nindent 4 }} | ||
| {{- if .Values.cas.httpRoute.labels }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.labels "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.cas.httpRoute.annotations }} | ||
| annotations: | ||
| {{- include "common.tplvalues.render" ( dict "value" .Values.cas.httpRoute.annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| {{- if .Values.cas.httpRoute.parentRefs }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.parentRefs "context" .) | nindent 4 }} | ||
| {{- else }} | ||
| - name: gateway | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| {{- end }} | ||
| hostnames: {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.hostnames "context" .) | nindent 4 }} | ||
| rules: | ||
| {{- $port := coalesce .Values.cas.service.port .Values.cas.service.ports.http }} | ||
| - backendRefs: | ||
| - name: {{ include "chainloop.cas.fullname" . }} | ||
| port: {{ $port }} | ||
| {{- if .Values.cas.httpRoute.matches }} | ||
| matches: {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.matches "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.cas.httpRoute.filters }} | ||
| filters: {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.filters "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| - matches: | ||
| - headers: | ||
| - name: content-type | ||
| value: "^application/grpc" | ||
| type: RegularExpression | ||
| {{- $portAPI := coalesce .Values.cas.serviceAPI.port .Values.cas.serviceAPI.ports.http }} | ||
| backendRefs: | ||
| - name: {{ include "chainloop.cas.fullname" . }}-api | ||
| kind: Service | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| port: {{ $portAPI }} | ||
| {{- if .Values.cas.httpRoute.extraRules }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.cas.httpRoute.extraRules "context" .) | nindent 4 }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| {{- if .Values.controlplane.httpRoute.enabled }} | ||
| {{- /* | ||
| Copyright Chainloop, Inc. All Rights Reserved. | ||
| SPDX-License-Identifier: APACHE-2.0 | ||
| */}} | ||
| {{- $fullName := include "chainloop.controlplane.fullname" . -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ $fullName }} | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| labels: {{- include "chainloop.controlplane.labels" . | nindent 4 }} | ||
| {{- if .Values.controlplane.httpRoute.labels }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.labels "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.controlplane.httpRoute.annotations }} | ||
| annotations: | ||
| {{- include "common.tplvalues.render" ( dict "value" .Values.controlplane.httpRoute.annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| {{- if .Values.controlplane.httpRoute.parentRefs }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.parentRefs "context" .) | nindent 4 }} | ||
| {{- else }} | ||
| - name: gateway | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| {{- end }} | ||
| hostnames: {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.hostnames "context" .) | nindent 4 }} | ||
| rules: | ||
| {{- $port := coalesce .Values.controlplane.service.port .Values.controlplane.service.ports.http }} | ||
| - backendRefs: | ||
| - name: {{ include "chainloop.controlplane.fullname" . }} | ||
| port: {{ $port }} | ||
| {{- if .Values.controlplane.httpRoute.matches }} | ||
| matches: {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.matches "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.controlplane.httpRoute.filters }} | ||
| filters: {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.filters "context" .) | nindent 8 }} | ||
| {{- end }} | ||
| - matches: | ||
| - headers: | ||
| - name: content-type | ||
| value: "^application/grpc" | ||
| type: RegularExpression | ||
| {{- $portAPI := coalesce .Values.controlplane.serviceAPI.port .Values.controlplane.serviceAPI.ports.http }} | ||
| backendRefs: | ||
| - name: {{ include "chainloop.controlplane.fullname" . }}-api | ||
| kind: Service | ||
| namespace: {{ include "common.names.namespace" . | quote }} | ||
| port: {{ $portAPI }} | ||
| {{- if .Values.controlplane.httpRoute.extraRules }} | ||
| {{- include "common.tplvalues.render" (dict "value" .Values.controlplane.httpRoute.extraRules "context" .) | nindent 4 }} | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 NOTES.txt TLS detection misses
controlplane.ingress.tls— only checksingressAPI.tlsIn
deployment/chainloop/templates/NOTES.txt:27-29, TLS is determined byor .Values.controlplane.ingressAPI.tls .Values.controlplane.httpRoute.tls. However,chainloop.controlplane.external_hostname(deployment/chainloop/templates/_helpers.tpl:341-342) can return a hostname fromcontrolplane.ingress(non-API), which has its owntlssetting at.Values.controlplane.ingress.tls. When a user enablescontrolplane.ingresswith TLS (but notingressAPI), the NOTES will show--insecureand port80, which is incorrect. The same issue applies to CAS: NOTES.txt line 29 doesn't checkcas.ingress.tls.Was this helpful? React with 👍 or 👎 to provide feedback.