From 933c535572f128aa7ca629d941275b0dd3d48a25 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Wed, 15 Nov 2023 16:57:32 +0100 Subject: [PATCH] Made ingressClassName configurable --- helm/argocd/Chart.yaml | 6 ++-- helm/argocd/templates/argocd-gateway.yaml | 39 +++++++++++++++++++++++ helm/argocd/templates/argocd-ingress.yaml | 4 ++- helm/argocd/values.yaml | 7 ++++ k8s/nginx.yaml | 19 +++++++++++ 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 helm/argocd/templates/argocd-gateway.yaml create mode 100644 k8s/nginx.yaml diff --git a/helm/argocd/Chart.yaml b/helm/argocd/Chart.yaml index 268e5cd..a578308 100644 --- a/helm/argocd/Chart.yaml +++ b/helm/argocd/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: argocd-configuration -version: 0.1.3 +version: 0.1.4 type: application description: "ArgoCD configuration which requires Argo CD to be installed separately." maintainers: @@ -8,8 +8,8 @@ maintainers: url: https://2martens.de annotations: artifacthub.io/changes: | - - kind: changed - description: Made ingressClassName configurable + - kind: added + description: Added gateway support artifacthub.io/signKey: | fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc diff --git a/helm/argocd/templates/argocd-gateway.yaml b/helm/argocd/templates/argocd-gateway.yaml new file mode 100644 index 0000000..00d498e --- /dev/null +++ b/helm/argocd/templates/argocd-gateway.yaml @@ -0,0 +1,39 @@ +{{- if .Values.gateway.enabled }} +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: argocd-server-gateway + namespace: {{ .Release.Namespace }} + annotations: + cert-manager.io/cluster-issuer: {{ .Values.gateway.certIssuer }} +spec: + gatewayClassName: cilium + listeners: + - name: {{ tpl (quote .Values.gateway.host) . }} + protocol: HTTPS + port: 443 + hostname: {{ tpl (quote .Values.gateway.host) . }} + tls: + certificateRefs: + - kind: Secret + name: argocd-server-tls +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: argocd-server-route + namespace: {{ .Release.Namespace }} +spec: + hostnames: + - {{ tpl (quote .Values.gateway.host) . }} + parentRefs: + - name: cilium-gateway + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: argo-cd-argocd-server + port: https +{{- end }} diff --git a/helm/argocd/templates/argocd-ingress.yaml b/helm/argocd/templates/argocd-ingress.yaml index 0a8cda6..bcfa76e 100644 --- a/helm/argocd/templates/argocd-ingress.yaml +++ b/helm/argocd/templates/argocd-ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -27,4 +28,5 @@ spec: tls: - hosts: - {{ tpl (quote .Values.ingress.host) . }} - secretName: argocd-server-tls # as expected by argocd-server \ No newline at end of file + secretName: argocd-server-tls # as expected by argocd-server +{{- end }} \ No newline at end of file diff --git a/helm/argocd/values.yaml b/helm/argocd/values.yaml index 36e6f24..ec78bff 100644 --- a/helm/argocd/values.yaml +++ b/helm/argocd/values.yaml @@ -4,10 +4,17 @@ appOfApps: path: argocd/app-of-apps/{{ .Values.environment }} ingress: + enabled: false # variable is templated host: argocd.k8s.{{ .Values.environment }}.2martens.de certIssuer: lets-encrypt className: default +gateway: + enabled: false + # variable is templated + host: argocd.k8s.{{ .Values.environment }}.2martens.de + certIssuer: lets-encrypt + # should be overriden for the specific installation environment: "" \ No newline at end of file diff --git a/k8s/nginx.yaml b/k8s/nginx.yaml new file mode 100644 index 0000000..27f39f8 --- /dev/null +++ b/k8s/nginx.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-nginx +spec: + selector: + matchLabels: + run: my-nginx + replicas: 2 + template: + metadata: + labels: + run: my-nginx + spec: + containers: + - name: my-nginx + image: nginx + ports: + - containerPort: 80 \ No newline at end of file