diff --git a/charts/gitops-runtime/templates/_helpers.tpl b/charts/gitops-runtime/templates/_helpers.tpl index c487355d..1ac04563 100644 --- a/charts/gitops-runtime/templates/_helpers.tpl +++ b/charts/gitops-runtime/templates/_helpers.tpl @@ -341,6 +341,12 @@ Get ingress url for both tunnel based and ingress based runtimes {{- else }} {{ fail (printf "ERROR: Unsupported protocol %s for ingress. Only http and https supported" .Values.global.runtime.ingress.protocol)}} {{- end }} + {{- else if .Values.global.runtime.httpRoute.enabled }} + {{- if has .Values.global.runtime.httpRoute.protocol $supportedProtocols }} + {{- printf "%s://%s" .Values.global.runtime.httpRoute.protocol (index .Values.global.runtime.httpRoute.hostnames 0)}} + {{- else }} + {{ fail (printf "ERROR: Unsupported protocol %s for httpRoute. Only http and https supported" .Values.global.runtime.httpRoute.protocol)}} + {{- end }} {{/* If tunnel client is enabled - ingress url is -. */}} {{- else if index .Values "tunnel-client" "enabled" }} {{- $accoundId := required "global.codefresh.accountId is required for tunnel based runtime" .Values.global.codefresh.accountId }} diff --git a/charts/gitops-runtime/templates/httproute.yaml b/charts/gitops-runtime/templates/httproute.yaml new file mode 100644 index 00000000..00d247da --- /dev/null +++ b/charts/gitops-runtime/templates/httproute.yaml @@ -0,0 +1,46 @@ +{{- if .Values.global.runtime.httpRoute.enabled -}} +{{- $svcName := include "internal-router.fullname" (dict "Values" (get .Values "internal-router")) -}} +{{- $svcPort := index .Values "internal-router" "service" "port" -}} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: codefresh-gitops-runtime + labels: + {{- include "codefresh-gitops-runtime.labels" . | nindent 4 }} + {{- with .Values.global.runtime.httpRoute.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.global.runtime.httpRoute.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + parentRefs: + {{- if .Values.global.runtime.httpRoute.parentRefs }} + {{- toYaml .Values.global.runtime.httpRoute.parentRefs | nindent 4 }} + {{- else }} + {{- fail "ERROR: global.runtime.httpRoute.parentRefs is required when httpRoute is enabled" }} + {{- end }} + hostnames: + {{- if .Values.global.runtime.httpRoute.hostnames }} + {{- toYaml .Values.global.runtime.httpRoute.hostnames | nindent 4 }} + {{- else }} + {{- fail "ERROR: global.runtime.httpRoute.hostnames is required when httpRoute is enabled" }} + {{- end }} + rules: + - matches: + - path: + type: PathPrefix + value: /webhooks + - path: + type: PathPrefix + value : /app-proxy + {{- if (index (get $.Values "argo-workflows") "enabled") }} + - path: + type: PathPrefix + value : /workflows + {{- end }} + backendRefs: + - name: {{ $svcName }} + port: {{ $svcPort }} +{{- end }} diff --git a/charts/gitops-runtime/templates/tunnel-client.yaml b/charts/gitops-runtime/templates/tunnel-client.yaml index 8d5b0c70..ecc3d90e 100644 --- a/charts/gitops-runtime/templates/tunnel-client.yaml +++ b/charts/gitops-runtime/templates/tunnel-client.yaml @@ -4,7 +4,7 @@ to intruduce the subdomainPrefix to the tunnel. Since the prefix is comprised of -, we can tempalate it and thus reduce complexity of installation and number or mandatory values to provide for the installation to work. */}} -{{- if and ( not .Values.global.runtime.ingress.enabled) (index .Values "tunnel-client" "enabled") }} +{{- if and ( not .Values.global.runtime.ingress.enabled) ( not .Values.global.runtime.httpRoute.enabled) (index .Values "tunnel-client" "enabled") }} {{ $tunnelClientContext := (index .Subcharts "tunnel-client")}} {{ $accoundId := required "codefresh.accountId is required" .Values.global.codefresh.accountId }} {{ $runtimeName := required "runtime.name is required" .Values.global.runtime.name }} diff --git a/charts/gitops-runtime/values.yaml b/charts/gitops-runtime/values.yaml index 82f84f03..fe963cc7 100644 --- a/charts/gitops-runtime/values.yaml +++ b/charts/gitops-runtime/values.yaml @@ -65,6 +65,29 @@ global: labels: {} # -- Hosts for runtime ingress. Note that Codefresh platform will always use the first host in the list to access the runtime. hosts: [] + # -- HTTPRoute settings + httpRoute: + # -- Enable HTTPRoute + enabled: false + # -- The protocol that Codefresh platform will use to access the runtime. Can be http or https. + protocol: https + # -- Required! List of parent Gateway references this HTTPRoute should attach to + # ref: https://gateway-api.sigs.k8s.io/reference/api-spec/main/spec/#parentreference + # E.g. + # parentRefs: + # - name: traefik-gateway + # namespace: traefik + parentRefs: [] + # -- List of hostnames to be covered by this HTTPRoute + # ref: https://gateway-api.sigs.k8s.io/reference/api-spec/main/spec/#hostname + # E.g. + # hostnames: + # - runtime.example.com + hostnames: [] + # -- Set annotations on the HTTPRoute resource + annotations: {} + # -- Set labels on the HTTPRoute resource + labels: {} # -- Explicit url for runtime ingress. Provide this value only if you don't want the chart to create and ingress (global.runtime.ingress.enabled=false) and tunnel-client is not used (tunnel-client.enabled=false) ingressUrl: "" # -- is the runtime set as a "configuration runtime".