feat(argo-cd): add gateway creation and gke objects

Signed-off-by: Tristan Duverger <tristan.duverger@gmail.com>
This commit is contained in:
Tristan Duverger 2024-10-04 10:55:11 +02:00 committed by Tristan Duverger
parent 5d0a8a2361
commit 59c226c2ca
6 changed files with 217 additions and 46 deletions

View file

@ -1,4 +1,4 @@
{{- if .Values.server.gatewayAPI.enabled }} {{- if eq (tpl (toString .Values.server.gateway.httpRoute.enabled) .) "true" }}
apiVersion: gateway.networking.k8s.io/v1 apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute kind: HTTPRoute
metadata: metadata:
@ -6,10 +6,10 @@ metadata:
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- with .Values.server.gatewayAPI.labels }} {{- with .Values.server.gateway.httpRoute.labels }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.server.gatewayAPI.annotations }} {{- with .Values.server.gateway.httpRoute.annotations }}
annotations: annotations:
{{- range $key, $value := . }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
@ -19,13 +19,13 @@ spec:
parentRefs: parentRefs:
- group: gateway.networking.k8s.io - group: gateway.networking.k8s.io
kind: Gateway kind: Gateway
name: {{ .Values.server.gatewayAPI.gateway }} name: {{ tpl .Values.server.gateway.name . }}
{{- with .Values.server.gatewayAPI.gatewaySection }} {{- with .Values.server.gateway.httpRoute.gatewaySection }}
sectionName: {{ . }} sectionName: {{ . }}
{{- end }} {{- end }}
hostnames: hostnames:
- {{ .Values.server.gatewayAPI.hostname | default .Values.global.domain }} - {{ .Values.server.gateway.httpRoute.hostname | default .Values.global.domain }}
{{- with .Values.server.gatewayAPI.extraHosts }} {{- with .Values.server.gateway.httpRoute.extraHosts }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
rules: rules:
@ -34,11 +34,11 @@ spec:
{{- end }} {{- end }}
- matches: - matches:
- path: - path:
type: {{ .Values.server.gatewayAPI.pathType }} type: {{ .Values.server.gateway.httpRoute.pathType }}
value: {{ .Values.server.gatewayAPI.path }} value: {{ .Values.server.gateway.httpRoute.path }}
{{- range .Values.server.gatewayAPI.extraPaths }} {{- range .Values.server.gateway.httpRoute.extraPaths }}
- path: - path:
type: {{ .type | default $.Values.gatewayAPI.pathType }} type: {{ .type | default $.Values.server.gateway.httpRoute.pathType }}
value: {{ .value }} value: {{ .value }}
{{- end }} {{- end }}
backendRefs: backendRefs:

View file

@ -0,0 +1,27 @@
{{- if and .Values.server.gateway.enabled (eq .Values.server.gateway.controller "gke") }}
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
name: {{ tpl .Values.server.gateway.name . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- with .Values.server.gateway.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.gateway.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.server.gateway.gatewayClassName }}
{{- fail ".Values.server.gateway.gatewayClassName must be defined" }}
{{- end }}
gatewayClassName: {{ .Values.server.gateway.gatewayClassName }}
listeners:
{{- with .Values.server.gateway.listeners }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,27 @@
{{- if and (eq .Values.server.gateway.controller "gke") (eq (tpl (toString .Values.server.gateway.httpRoute.enabled) .) "true") }}
apiVersion: networking.gke.io/v1
kind: GCPBackendPolicy
metadata:
name: {{ include "argo-cd.server.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- with .Values.server.gateway.gke.GCPBackendPolicy.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.gateway.gke.GCPBackendPolicy.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
default:
{{- with .Values.server.gateway.gke.GCPBackendPolicy.spec.default }}
{{- toYaml . | nindent 6 }}
{{- end }}
targetRef:
group: ""
kind: Service
name: {{ template "argo-cd.server.fullname" . }}
{{- end }}

View file

@ -0,0 +1,27 @@
{{- if and .Values.server.gateway.enabled (eq .Values.server.gateway.controller "gke") }}
apiVersion: networking.gke.io/v1
kind: GCPGatewayPolicy
metadata:
name: {{ include "argo-cd.server.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- with .Values.server.gateway.gke.GCPGatewayPolicy.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.gateway.gke.GCPGatewayPolicy.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
default:
{{- with .Values.server.gateway.gke.GCPGatewayPolicy.spec.default }}
{{- toYaml . | nindent 6 }}
{{- end }}
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: {{ include "argo-cd.server.fullname" . }}
{{- end }}

View file

@ -0,0 +1,27 @@
{{- if and (eq .Values.server.gateway.controller "gke") (eq (tpl (toString .Values.server.gateway.httpRoute.enabled) .) "true") }}
apiVersion: networking.gke.io/v1
kind: HealthCheckPolicy
metadata:
name: {{ include "argo-cd.server.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- with .Values.server.gateway.gke.HealthCheckPolicy.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.gateway.gke.HealthCheckPolicy.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
default:
{{- with .Values.server.gateway.gke.HealthCheckPolicy.spec.default }}
{{- toYaml . | nindent 6 }}
{{- end }}
targetRef:
group: ""
kind: Service
name: {{ template "argo-cd.server.fullname" . }}
{{- end }}

View file

@ -2151,53 +2151,116 @@ server:
# -- Automount API credentials for the Service Account # -- Automount API credentials for the Service Account
automountServiceAccountToken: true automountServiceAccountToken: true
# Argo CD server Gateway API HTTPRoute configuration # Argo CD server Gateway API configuration
# NOTE: Alpha feature, gRPC & TLS pass-through will not work # NOTE: Alpha feature, gRPC & TLS pass-through will not work
gatewayAPI: gateway:
# -- Enable a Gateway API resources for the Argo CD server # -- enable a gateway resource for ArgoCD
## Note: you can already have an existing Gateway and just wanted to add a route and backend policy to that Gateway, let false in that case
enabled: false enabled: false
# -- Additional route labels name: '{{ include "argo-cd.server.fullname" . }}'
# -- Specific implementation for gateway controller. Only `None` and `gke` are supported.
## With `None`, the gateway is supposed to already exist and no specific object will be created
## Additional configuration might be required in related configuration sections for `gke`
controller: None
# Argo CD server Gateway API HTTPRoute configuration
# NOTE: Alpha feature, gRPC & TLS pass-through will not work
# -- Additional gateway labels
labels: {} labels: {}
# -- Additional route annotations # -- Additional gateway annotations
annotations: {} annotations: {}
# networking.gke.io/certmap: "CERTIFICATE_MAP"
gatewayClassName: ""
# @default -- `""` (See [values.yaml])
# gatewayClassName: gke-l7-global-external-managed
# gatewayClassName: gke-l7-rilb
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same
# - name: https
# protocol: HTTPS
# port: 443
# allowedRoutes:
# namespaces:
# from: Same
gke:
GCPGatewayPolicy:
# -- Additional gateway labels
labels: {}
# -- Additional gateway annotations
annotations: {}
spec:
default: {}
GCPBackendPolicy:
# -- Additional gateway labels
labels: {}
# -- Additional gateway annotations
annotations: {}
spec:
default: {}
HealthCheckPolicy:
# -- Additional gateway labels
labels: {}
# -- Additional gateway annotations
annotations: {}
spec:
default:
logConfig:
enabled: true
config:
type: HTTP
httpHealthCheck:
port: '{{ .Values.server.service.servicePortHttp }}'
requestPath: "/"
# -- Defines which Gateway will implement the resource httpRoute:
gateway: "" # -- Enable a Gateway HTTP route resources for the Argo CD server
enabled: "{{ .Values.server.gateway.enabled | default false }}"
# -- Additional route labels
labels: {}
# -- Additional route annotations
annotations: {}
# -- Defines which Gateway section will implement the resource # -- Defines which Gateway will implement the resource
gatewaySection: "" gateway: ""
# -- Argo CD server hostname # -- Defines which Gateway section will implement the resource
# @default -- `""` (defaults to global.domain) gatewaySection: ""
hostname: ""
# -- The path to Argo CD server # -- Argo CD server hostname
path: / # @default -- `""` (defaults to global.domain)
hostname: ""
# -- HTTP reoute path type. Either 'Exact' or `PathPrefix` # -- The path to Argo CD server
pathType: PathPrefix path: /
# -- The list of additional hostnames to be covered by API Gateway record # -- HTTP reoute path type. Either 'Exact' or `PathPrefix`
extraHosts: [] pathType: PathPrefix
# -- Additional API Gateway paths # -- The list of additional hostnames to be covered by API Gateway record
# @default -- `[]` (See [values.yaml]) extraHosts: []
## Note: Supports use of custom Helm templates
extraPaths: []
# - type: PathPrefix
# value: /*
# -- Additional routing rules # -- Additional API Gateway paths
# @default -- `[]` (See [values.yaml]) # @default -- `[]` (See [values.yaml])
## Note: Supports use of custom Helm templates ## Note: Supports use of custom Helm templates
extraRules: [] extraPaths: []
# - matches: # - type: PathPrefix
# - path: # value: /*
# type: PathPrefix
# value: / # -- Additional routing rules
# backendRefs: # @default -- `[]` (See [values.yaml])
# - name: '{{ include "argo-cd.server.fullname" . }}' ## Note: Supports use of custom Helm templates
# port: '{{ .Values.server.service.servicePortHttpName }}' extraRules: []
# - matches:
# - path:
# type: PathPrefix
# value: /
# backendRefs:
# - name: '{{ include "argo-cd.server.fullname" . }}'
# port: '{{ .Values.server.service.servicePortHttpName }}'
# Argo CD server ingress configuration # Argo CD server ingress configuration