diff --git a/charts/risingwave/Chart.yaml b/charts/risingwave/Chart.yaml index b2690ea..cb15a46 100644 --- a/charts/risingwave/Chart.yaml +++ b/charts/risingwave/Chart.yaml @@ -19,7 +19,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.1 +version: 0.2.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/risingwave/templates/_helpers.tpl b/charts/risingwave/templates/_helpers.tpl index 592b24b..c9a7604 100644 --- a/charts/risingwave/templates/_helpers.tpl +++ b/charts/risingwave/templates/_helpers.tpl @@ -598,3 +598,17 @@ Cloud related enviroments. {{- end }} {{- end }} {{- end }} + +{{/* Env vars for license key */}} +{{- define "risingwave.licenseKeyEnv" }} +{{- if and .Values.license.secret.key .Values.license.secret.name }} +- name: RW_LICENSE_KEY + valueFrom: + secretKeyRef: + name: {{ .Values.license.secret.name | quote }} + key: {{ .Values.license.secret.key | quote }} +{{- else if .Values.license.key }} +- name: RW_LICENSE_KEY + value: {{ .Values.license.key | quote }} +{{- end }} +{{- end }} diff --git a/charts/risingwave/templates/meta-sts.yaml b/charts/risingwave/templates/meta-sts.yaml index 9c07bef..19f394e 100644 --- a/charts/risingwave/templates/meta-sts.yaml +++ b/charts/risingwave/templates/meta-sts.yaml @@ -159,6 +159,7 @@ spec: name: {{ include "risingwave.mysqlCredentialsSecretName" . }} {{- end }} env: + {{ include "risingwave.licenseKeyEnv" . | nindent 8 }} {{ include "risingwave.cloudEnvironments" . | nindent 8 }} # Disable auto region loading. Refer to the original source for more information. # https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/aws-config/src/imds/region.rs diff --git a/charts/risingwave/templates/standalone/standalone-sts.yaml b/charts/risingwave/templates/standalone/standalone-sts.yaml index cb64a12..b4d496c 100644 --- a/charts/risingwave/templates/standalone/standalone-sts.yaml +++ b/charts/risingwave/templates/standalone/standalone-sts.yaml @@ -205,6 +205,7 @@ spec: name: {{ include "risingwave.mysqlCredentialsSecretName" . }} {{- end }} env: + {{ include "risingwave.licenseKeyEnv" . | nindent 8 }} {{ include "risingwave.cloudEnvironments" . | nindent 8 }} # Disable auto region loading. Refer to the original source for more information. # https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/aws-config/src/imds/region.rs diff --git a/charts/risingwave/tests/license_standalone_test.yaml b/charts/risingwave/tests/license_standalone_test.yaml new file mode 100644 index 0000000..f583a1b --- /dev/null +++ b/charts/risingwave/tests/license_standalone_test.yaml @@ -0,0 +1,58 @@ +suite: Test license key (standalone) +templates: +- standalone/standalone-sts.yaml +chart: + appVersion: 1.0.0 + version: 0.0.1 +set: + standalone: + enabled: true +tests: +- it: no license key + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + any: true +- it: license key found with raw key + set: + license: + key: "ABC" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + value: "ABC" +- it: license key found with secret ref + set: + license: + secret: + name: LICENSE-SECRET + key: LICENSE-KEY + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + valueFrom: + secretKeyRef: + name: LICENSE-SECRET + key: LICENSE-KEY +- it: license key found with secret ref and key + set: + license: + key: "ABC" + secret: + name: LICENSE-SECRET + key: LICENSE-KEY + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + valueFrom: + secretKeyRef: + name: LICENSE-SECRET + key: LICENSE-KEY diff --git a/charts/risingwave/tests/license_test.yaml b/charts/risingwave/tests/license_test.yaml new file mode 100644 index 0000000..caf737a --- /dev/null +++ b/charts/risingwave/tests/license_test.yaml @@ -0,0 +1,55 @@ +suite: Test license key (distributed) +templates: +- meta-sts.yaml +chart: + appVersion: 1.0.0 + version: 0.0.1 +tests: +- it: no license key + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + any: true +- it: license key found with raw key + set: + license: + key: "ABC" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + value: "ABC" +- it: license key found with secret ref + set: + license: + secret: + name: LICENSE-SECRET + key: LICENSE-KEY + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + valueFrom: + secretKeyRef: + name: LICENSE-SECRET + key: LICENSE-KEY +- it: license key found with secret ref and key + set: + license: + key: "ABC" + secret: + name: LICENSE-SECRET + key: LICENSE-KEY + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_LICENSE_KEY + valueFrom: + secretKeyRef: + name: LICENSE-SECRET + key: LICENSE-KEY diff --git a/charts/risingwave/values.yaml b/charts/risingwave/values.yaml index cca9f6a..e49b894 100644 --- a/charts/risingwave/values.yaml +++ b/charts/risingwave/values.yaml @@ -1389,3 +1389,21 @@ cloud: ## This only works when endpoint is not set and region is set. ## useVPCEndpoint: false + +## @section license. Enterprise license key configuration for RisingWave enterprise. +## + +license: + ## @param key RisingWave enterprise license key. + ## + key: "" + + ## @param secret Use existing Secret to provide license key. + ## If set, value of key will be ignored. + secret: + ## @param name Name of the existing Secret. + ## + name: "" + ## @param key Key in the Secret. Defaults to "licenseKey". + ## + key: "licenseKey"