From 7a7ddb7ff213cb780d89877cd7ef46e28b5cb107 Mon Sep 17 00:00:00 2001 From: Marc Friedhoff Date: Fri, 3 Nov 2023 16:23:24 +0100 Subject: [PATCH] License File Handling unified --- microservicesruntime/helm/README.md | 11 ++++++- .../helm/templates/_helpers.tpl | 7 ++++ .../helm/templates/deployment.yaml | 4 +-- .../helm/templates/license.yaml | 33 +++++++++++++++++++ microservicesruntime/helm/values.yaml | 2 +- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 microservicesruntime/helm/templates/license.yaml diff --git a/microservicesruntime/helm/README.md b/microservicesruntime/helm/README.md index 8cc901e..b8cb81d 100644 --- a/microservicesruntime/helm/README.md +++ b/microservicesruntime/helm/README.md @@ -33,9 +33,12 @@ Microservices Runtime requires a license file. These license is supposed to be p Hence before running `helm install`, create the configmap: ``` -kubectl create configmap microservicesruntime-license-key --from-file=licenseKey.xml= +kubectl create configmap microservicesruntime-license-key --from-file=licensekey= ``` +Optionally you can also provide the license directly when installing your release (see also below). + + ## Examples for Use-cases Sub-folder `examples` contains some *values* examples for more use-cases. To use the use-case, adapt and add the provided `values.yaml` to your values. @@ -61,6 +64,12 @@ Install release with pulling image and setting secret (to pull image) ... helm install wm-msr webmethods/microservicesruntime \ ``` +... (optionally) provide the license key at installation time (can be ommitted for upgrade later) + +```shell +--set-file=licensekey= +``` + ... Ingress is enabled per default. Define Ingress service host ... ```shell diff --git a/microservicesruntime/helm/templates/_helpers.tpl b/microservicesruntime/helm/templates/_helpers.tpl index 659ad5f..37dd3ac 100644 --- a/microservicesruntime/helm/templates/_helpers.tpl +++ b/microservicesruntime/helm/templates/_helpers.tpl @@ -78,3 +78,10 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Create the name of the license config map +*/}} +{{- define "microservicesruntime.licenseConfigMapName" -}} +{{- default ( printf "%s-%s" (include "common.names.fullname" .) "-license") .Values.licenseConfigMap }} +{{- end }} diff --git a/microservicesruntime/helm/templates/deployment.yaml b/microservicesruntime/helm/templates/deployment.yaml index 5489a9c..1a494e6 100644 --- a/microservicesruntime/helm/templates/deployment.yaml +++ b/microservicesruntime/helm/templates/deployment.yaml @@ -166,10 +166,10 @@ spec: {{- end }} - name: microservicesruntime-license configMap: - name: {{ .Values.microservicesruntime.licenseConfigMap }} + name: {{ include "microservicesruntime.licenseConfigMapName" . }} defaultMode: 0666 items: - - key: licenseKey.xml + - key: licensekey path: licenseKey.xml - name: application-properties configMap: diff --git a/microservicesruntime/helm/templates/license.yaml b/microservicesruntime/helm/templates/license.yaml new file mode 100644 index 0000000..4ad24f7 --- /dev/null +++ b/microservicesruntime/helm/templates/license.yaml @@ -0,0 +1,33 @@ +{{ if .Values.license }} +--- +# /* +# * Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors +# * +# * SPDX-License-Identifier: Apache-2.0 +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +# */ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "microservicesruntime.licenseConfigMapName" . }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} + annotations: + helm.sh/resource-policy: keep +data: + licensekey: + {{ .Values.license | toYaml }} +{{- end }} \ No newline at end of file diff --git a/microservicesruntime/helm/values.yaml b/microservicesruntime/helm/values.yaml index 7503c57..d68c83f 100644 --- a/microservicesruntime/helm/values.yaml +++ b/microservicesruntime/helm/values.yaml @@ -137,7 +137,7 @@ microservicesruntime: readinessProbe: # -- Scheme of administration port port, uppercase scheme: "HTTP" - # -- Name of config map which contains the license key + # -- Name of config map which contains the license key. If you ommit this, it defaults to the release name + microservicesruntime-license. licenseConfigMap: "microservicesruntime-license-key" memoryHeap: ## -- Minimum of allocated heap memory