From 9ceeee8b21e97882648660c892084988bc46b871 Mon Sep 17 00:00:00 2001 From: Andrej Petras Date: Mon, 19 Feb 2024 17:51:37 +0100 Subject: [PATCH] feat: add permission product name --- templates/_helpers.tpl | 13 +++++++++++++ templates/config-env.yaml | 1 + templates/operator-permission.yaml | 2 +- tests/permissions-product.yaml | 5 +++++ tests/permissions.yaml | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/permissions-product.yaml create mode 100644 tests/permissions.yaml diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index bf63328..8c81a33 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -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 -}} @@ -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 "+" "_" }} diff --git a/templates/config-env.yaml b/templates/config-env.yaml index 52cf9ca..39057ec 100644 --- a/templates/config-env.yaml +++ b/templates/config-env.yaml @@ -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 }} \ No newline at end of file diff --git a/templates/operator-permission.yaml b/templates/operator-permission.yaml index 4bc577e..a31c441 100644 --- a/templates/operator-permission.yaml +++ b/templates/operator-permission.yaml @@ -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" .) }} diff --git a/tests/permissions-product.yaml b/tests/permissions-product.yaml new file mode 100644 index 0000000..0a60219 --- /dev/null +++ b/tests/permissions-product.yaml @@ -0,0 +1,5 @@ +operator: + permission: + enabled: true + spec: + productName: newProductName \ No newline at end of file diff --git a/tests/permissions.yaml b/tests/permissions.yaml new file mode 100644 index 0000000..9e9e6de --- /dev/null +++ b/tests/permissions.yaml @@ -0,0 +1,3 @@ +operator: + permission: + enabled: true \ No newline at end of file