Skip to content

Commit

Permalink
chart: add resourceSuffix value
Browse files Browse the repository at this point in the history
Hack for resources that may conflict in parallel environments.
  • Loading branch information
tronghn committed Nov 14, 2024
1 parent ca4ebb6 commit f60cf79
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions charts/wonderwall/Feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,7 @@ values:
type: string
ignoreKind:
- legacy
resourceSuffix:
description: Suffix for resources that may conflict in parallel environments.
config:
type: string
12 changes: 9 additions & 3 deletions charts/wonderwall/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ Aiven instance name.
The last part of the fully qualified name (e.g. <instance> in `redis-<namespace>-<instance>`)
*/}}
{{- define "aiven.instanceName" -}}
{{- printf "wonderwall-%s" . }}
{{- $root := .root }}
{{- $provider := .provider }}
{{- if $root.Values.resourceSuffix }}
{{- printf "wonderwall-%s-%s" $provider $root.Values.resourceSuffix }}
{{- else }}
{{- printf "wonderwall-%s" $provider }}
{{- end }}
{{- end }}

{{/*
Expand All @@ -134,7 +140,7 @@ Expects a dict with the following keys:
{{- define "aiven.redisName" -}}
{{- $root := .root }}
{{- $provider := .provider }}
{{- printf "redis-%s-%s" $root.Release.Namespace (include "aiven.instanceName" $provider) }}
{{- printf "redis-%s-%s" $root.Release.Namespace (include "aiven.instanceName" (dict "provider" $provider "root" $root)) }}
{{- end }}

{{/*
Expand All @@ -147,5 +153,5 @@ Expects a dict with the following keys:
{{- define "aiven.serviceintegrationName" -}}
{{- $root := .root }}
{{- $provider := .provider }}
{{- printf "serviceintegration-%s-%s" $root.Release.Namespace (include "aiven.instanceName" $provider) }}
{{- printf "serviceintegration-%s-%s" $root.Release.Namespace (include "aiven.instanceName" (dict "provider" $provider "root" $root)) }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/wonderwall/templates/_resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Expects a dict as input with the following keys:
{{- $provider := .provider }}
{{- $access := .access }}
{{- $secretName := .secretName -}}
{{- $instance := include "aiven.instanceName" $provider }}
{{- $instance := include "aiven.instanceName" (dict "provider" $provider "root" $root) }}
---
apiVersion: aiven.nais.io/v1
kind: AivenApplication
Expand Down
4 changes: 4 additions & 0 deletions charts/wonderwall/templates/fa-azureapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
apiVersion: nais.io/v1
kind: AzureAdApplication
metadata:
{{- if .Values.resourceSuffix }}
name: {{ include "wonderwall.fullname" . }}-fa-{{ .Values.resourceSuffix }}
{{- else }}
name: {{ include "wonderwall.fullname" . }}-fa
{{- end }}
labels:
{{- include "wonderwall.labelsForwardAuth" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions charts/wonderwall/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ resources:
requests:
cpu: 100m
memory: 64Mi
resourceSuffix: ""
podDisruptionBudget:
maxUnavailable: 1
otel:
Expand Down

0 comments on commit f60cf79

Please sign in to comment.