Skip to content

Commit

Permalink
feat: add permission product name
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Feb 19, 2024
1 parent 22dec3a commit 9ceeee8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{ .Release.Name }}-{{ .Values.name | default .Chart.Name }}
{{- end -}}

{{- define "app-angular.product.name" -}}
{{ .Release.Name }}
{{- end -}}


{{- define "app-angular.version" -}}
{{ .Values.image.tag }}
{{- end -}}
Expand Down Expand Up @@ -36,6 +41,14 @@
{{ end }}
{{- end -}}

{{- define "app-angular.permission.product.name" -}}
{{- if .Values.operator.permission.spec.productName -}}
{{- .Values.operator.permission.spec.productName -}}
{{- else -}}
{{ include "app-angular.product.name" $ }}
{{- end -}}
{{- end -}}

{{- define "app-angular.labels.common" -}}
version: {{ .Values.version | default .Values.image.tag | quote }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Expand Down
1 change: 1 addition & 0 deletions templates/config-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ metadata:
data:
APP_VERSION: {{ .Values.image.tag }}
APP_ID: {{ template "app-angular.id" $ }}
PRODUCT_NAME: {{ include "app-angular.permission.product.name" $ }}
{{ if and .Values.routing.enabled .Values.routing.path }}APP_BASE_HREF: {{ .Values.routing.path }}{{ end }}
2 changes: 1 addition & 1 deletion templates/operator-permission.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app: {{ include "app-angular.fullname" . }}
{{ include "app-angular.labels.common" $ | indent 4 }}
spec:
productName: {{ .Values.operator.permission.spec.productName | default .Release.Name }}
productName: {{ include "app-angular.permission.product.name" $ }}
appId: {{ .Values.operator.permission.spec.appId | default (include "app-angular.fullname" .) }}
name: {{ .Values.operator.permission.spec.name | default (include "app-angular.fullname" .) }}
description: {{ .Values.operator.permission.spec.description | default (include "app-angular.fullname" .) }}
Expand Down
5 changes: 5 additions & 0 deletions tests/permissions-product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
operator:
permission:
enabled: true
spec:
productName: newProductName
3 changes: 3 additions & 0 deletions tests/permissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
operator:
permission:
enabled: true

0 comments on commit 9ceeee8

Please sign in to comment.