feat(argo-cd): Support AWS ALB Ingress with gRPC (#806)

* Support AWS ALB Ingress with GRPC

Signed-off-by: Thomas O'Neill <toneill818@gmail.com>
Signed-off-by: Thomas O'Neill <toneill@new-innov.com>

* Bump chart version

Signed-off-by: Marco Kilchhofer <marco@kilchhofer.info>

* Apply suggestions from code review

Signed-off-by: Marco Kilchhofer <marco@kilchhofer.info>

* Use single if statement

Signed-off-by: Thomas O'Neill <toneill@new-innov.com>

* Append -grpc to the service labels for ALB GRPC service

Signed-off-by: Thomas O'Neill <toneill@new-innov.com>

Co-authored-by: Thomas O'Neill <toneill@new-innov.com>
Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
Co-authored-by: Marco Kilchhofer <marco@kilchhofer.info>
This commit is contained in:
Thomas O'Neill 2021-07-20 07:40:54 -04:00 committed by GitHub
parent 922799081d
commit 1e3a4afd05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 4 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 2.0.4 appVersion: 2.0.4
description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes. description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd name: argo-cd
version: 3.9.0 version: 3.10.0
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://argoproj.github.io/argo-cd/assets/logo.png icon: https://argoproj.github.io/argo-cd/assets/logo.png
keywords: keywords:
@ -21,5 +21,4 @@ dependencies:
condition: redis-ha.enabled condition: redis-ha.enabled
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- "[Added]: Ability to create network policies" - "[Added]: Support AWS ALB Ingress with gRPC"
- "[Changed]: Fix icon url"

View file

@ -305,6 +305,7 @@ NAME: my-release
| server.ingressGrpc.labels | Additional ingress labels for dedicated [gRPC-ingress] | `{}` | | server.ingressGrpc.labels | Additional ingress labels for dedicated [gRPC-ingress] | `{}` |
| server.ingressGrpc.ingressClassName | Defines which ingress controller will implement the resource [gRPC-ingress] | `""` | | server.ingressGrpc.ingressClassName | Defines which ingress controller will implement the resource [gRPC-ingress] | `""` |
| server.ingressGrpc.tls | Ingress TLS configuration for dedicated [gRPC-ingress] | `[]` | | server.ingressGrpc.tls | Ingress TLS configuration for dedicated [gRPC-ingress] | `[]` |
| server.ingressGrpc.isAWSALB | Setup up GRPC ingress to work with an AWS ALB | `false` |
| server.route.enabled | Enable a OpenShift route for the server | `false` | | server.route.enabled | Enable a OpenShift route for the server | `false` |
| server.route.hostname | Hostname of OpenShift route | `""` | | server.route.hostname | Hostname of OpenShift route | `""` |
| server.lifecycle | PostStart and PreStop hooks configuration | `{}` | | server.lifecycle | PostStart and PreStop hooks configuration | `{}` |
@ -429,3 +430,23 @@ through `xxx.extraArgs`
| redis-ha.image.tag | Redis tag | `"6.2.1-alpine"` | | redis-ha.image.tag | Redis tag | `"6.2.1-alpine"` |
[gRPC-ingress]: https://argoproj.github.io/argo-cd/operator-manual/ingress/ [gRPC-ingress]: https://argoproj.github.io/argo-cd/operator-manual/ingress/
### Using AWS ALB Ingress Controller With GRPC
If you are using an AWS ALB Ingress controller, you will need to set `server.ingressGrpc.isAWSALB` to `true`. This will create a second service with the annotation `alb.ingress.kubernetes.io/backend-protocol-version: HTTP2` and modify the server ingress to add a condition annotation to route GRPC traffic to the new service.
Example:
```yaml
server:
ingress:
enabled: true
annotations:
alb.ingress.kubernetes.io/backend-protocol: HTTPS
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/target-type: ip
ingressGrpc:
enabled: true
isAWSALB: true
```

View file

@ -0,0 +1,24 @@
{{- if and .Values.server.ingressGrpc.enabled .Values.server.ingressGrpc.isAWSALB -}}
apiVersion: v1
kind: Service
metadata:
annotations:
alb.ingress.kubernetes.io/backend-protocol-version: HTTP2 #This tells AWS to send traffic from the ALB using HTTP2. Can use GRPC as well if you want to leverage GRPC specific features
labels:
{{- include "argo-cd.labels" (dict "context" . "component" (print .Values.server.name "-gprc") "name" (print .Values.server.name "-grpc")) | nindent 4 }}
name: {{ template "argo-cd.server.fullname" . }}-grpc
spec:
ports:
- name: {{ .Values.server.service.servicePortHttpName }}
protocol: TCP
port: {{ .Values.server.service.servicePortHttp }}
targetPort: {{- if .Values.server.service.namedTargetPort }} {{ .Values.server.name }} {{- else }} {{ .Values.server.containerPort }} {{- end }}
- name: {{ .Values.server.service.servicePortHttpsName }}
protocol: TCP
port: {{ .Values.server.service.servicePortHttps }}
targetPort: {{- if .Values.server.service.namedTargetPort }} {{ .Values.server.name }} {{- else }} {{ .Values.server.containerPort }} {{- end }}
selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 4 }}
sessionAffinity: None
type: ClusterIP
{{- end -}}

View file

@ -1,4 +1,4 @@
{{- if .Values.server.ingressGrpc.enabled -}} {{- if and .Values.server.ingressGrpc.enabled (not .Values.server.ingressGrpc.isAWSALB) -}}
{{- $serviceName := include "argo-cd.server.fullname" . -}} {{- $serviceName := include "argo-cd.server.fullname" . -}}
{{- $servicePort := ternary .Values.server.service.servicePortHttps .Values.server.service.servicePortHttp .Values.server.ingressGrpc.https -}} {{- $servicePort := ternary .Values.server.service.servicePortHttps .Values.server.service.servicePortHttp .Values.server.ingressGrpc.https -}}
{{- $paths := .Values.server.ingressGrpc.paths -}} {{- $paths := .Values.server.ingressGrpc.paths -}}

View file

@ -12,6 +12,10 @@ metadata:
{{- range $key, $value := .Values.server.ingress.annotations }} {{- range $key, $value := .Values.server.ingress.annotations }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- if and .Values.server.ingressGrpc.isAWSALB .Values.server.ingressGrpc.enabled }}
alb.ingress.kubernetes.io/conditions.{{ template "argo-cd.server.fullname" . }}-grpc: |
[{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "Content-Type", "values":["application/grpc"]}}]
{{- end }}
{{- end }} {{- end }}
name: {{ template "argo-cd.server.fullname" . }} name: {{ template "argo-cd.server.fullname" . }}
labels: labels:
@ -35,6 +39,26 @@ spec:
{{- toYaml $extraPaths | nindent 10 }} {{- toYaml $extraPaths | nindent 10 }}
{{- end }} {{- end }}
{{- range $p := $paths }} {{- range $p := $paths }}
{{- if and $.Values.server.ingressGrpc.isAWSALB $.Values.server.ingressGrpc.enabled }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: Prefix
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
service:
name: {{ template "argo-cd.server.fullname" $ }}-grpc
port:
{{- if kindIs "float64" $servicePort }}
number: {{ $servicePort }}
{{- else }}
name: {{ $servicePort }}
{{- end }}
{{- else }}
serviceName: {{ template "argo-cd.server.fullname" $ }}-grpc
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
- path: {{ $p }} - path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }} {{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }} pathType: {{ $pathType }}

View file

@ -601,6 +601,7 @@ server:
# https://argoproj.github.io/argo-cd/operator-manual/ingress/ # https://argoproj.github.io/argo-cd/operator-manual/ingress/
ingressGrpc: ingressGrpc:
enabled: false enabled: false
isAWSALB: false
annotations: {} annotations: {}
labels: {} labels: {}
ingressClassName: "" ingressClassName: ""