From 6ffe1d12a16adb7b4589316f1e52800c1f31730c Mon Sep 17 00:00:00 2001 From: Justinas <12399634+justinas-b@users.noreply.github.com> Date: Fri, 19 Jul 2024 21:27:55 +0300 Subject: [PATCH] feat(helm): adding property to define annotations on external service that would enable integration with external-dns --- .github/workflows/helm-chart-ci.yaml | 2 +- helm-chart/README.md | 2 +- helm-chart/templates/NOTES.txt | 2 +- helm-chart/templates/frontend.yaml | 10 +++++++--- helm-chart/values.yaml | 4 +++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/helm-chart-ci.yaml b/.github/workflows/helm-chart-ci.yaml index eac1e79b409..2c2afca9ae8 100644 --- a/.github/workflows/helm-chart-ci.yaml +++ b/.github/workflows/helm-chart-ci.yaml @@ -77,7 +77,7 @@ jobs: --set sidecars.create=true \ --set serviceAccounts.create=true \ --set authorizationPolicies.create=true \ - --set frontend.externalService=false \ + --set frontend.externalService.create=false \ --set frontend.virtualService.create=true \ --set frontend.virtualService.gateway.name=asm-ingressgateway \ --set frontend.virtualService.gateway.namespace=asm-ingress \ diff --git a/helm-chart/README.md b/helm-chart/README.md index 3073afc8f44..6bacef38385 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -16,7 +16,7 @@ helm upgrade onlineboutique oci://us-docker.pkg.dev/online-boutique-ci/charts/on --install \ --create-namespace \ --set images.repository=us-docker.pkg.dev/my-project/containers/onlineboutique \ - --set frontend.externalService=false \ + --set frontend.externalService.create=false \ --set redis.create=false \ --set cartservice.database.type=spanner \ --set cartservice.database.connectionString=projects/my-project/instances/onlineboutique/databases/carts \ diff --git a/helm-chart/templates/NOTES.txt b/helm-chart/templates/NOTES.txt index 35cb49a8fca..48fd071e454 100644 --- a/helm-chart/templates/NOTES.txt +++ b/helm-chart/templates/NOTES.txt @@ -1,4 +1,4 @@ -{{- if and .Values.frontend.create .Values.frontend.externalService }} +{{- if and .Values.frontend.create .Values.frontend.externalService.create }} Note: It may take a few minutes for the LoadBalancer IP to be available. Watch the status of the frontend IP address with: diff --git a/helm-chart/templates/frontend.yaml b/helm-chart/templates/frontend.yaml index 915ae4b9c58..bdda2b7d09b 100644 --- a/helm-chart/templates/frontend.yaml +++ b/helm-chart/templates/frontend.yaml @@ -146,13 +146,17 @@ spec: - name: http port: 80 targetPort: 8080 -{{- if .Values.frontend.externalService }} +{{- if .Values.frontend.externalService.create }} --- apiVersion: v1 kind: Service metadata: name: {{ .Values.frontend.name }}-external namespace: {{ .Release.Namespace }} + {{- with .Values.frontend.externalService.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: LoadBalancer selector: @@ -177,7 +181,7 @@ spec: - Ingress - Egress ingress: - {{- if .Values.frontend.externalService }} + {{- if .Values.frontend.externalService.create }} - {} {{- else }} - from: @@ -236,7 +240,7 @@ spec: matchLabels: app: {{ .Values.frontend.name }} rules: - {{- if .Values.frontend.externalService }} + {{- if .Values.frontend.externalService.create }} - to: {{- else }} - from: diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 34cc3ac849d..b49e77c115c 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -114,7 +114,9 @@ emailService: frontend: create: true name: frontend - externalService: true + externalService: + create: true + annotations: {} cymbalBranding: false # One of: local, gcp, aws, azure, onprem, alibaba. When not set, defaults to "local" unless running in GKE, otherwise auto-sets to gcp. platform: local