diff --git a/Makefile b/Makefile index 285bb76..ac54905 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ test: @$(foreach chart,$(HELM_CHARTS),helm unittest --strict -f 'tests/**/*_test.yaml' charts/$(chart);) define test-uncommitted-for-chart - $(eval uncommitted_files := $(shell git diff --name-status head -- charts/$(1)/tests | grep -v '^D' | awk '{print $$2}' | sed -e "s/charts\/$(1)\///g")) + $(eval uncommitted_files := $(shell git diff --name-status head -- charts/$(1)/tests | grep -v '^D' | awk '{print $$NF}' | sed -e "s/charts\/$(1)\///g")) if [ "$(uncommitted_files)" != "" ]; then \ helm unittest --strict $(addprefix -f ,$(uncommitted_files)) charts/$(1); \ fi diff --git a/charts/risingwave/templates/_helpers.tpl b/charts/risingwave/templates/_helpers.tpl index 6a7f986..0b87422 100644 --- a/charts/risingwave/templates/_helpers.tpl +++ b/charts/risingwave/templates/_helpers.tpl @@ -97,7 +97,7 @@ T {{- end }} {{/* -Create the name of the etcd credentials Secret to use +Create the name of the etcd credentials Secret to use. */}} {{- define "risingwave.etcdCredentialsSecretName" -}} {{- if .Values.metaStore.etcd.authentication.existingSecretName }} @@ -107,6 +107,29 @@ Create the name of the etcd credentials Secret to use {{- end }} {{- end }} + +{{/* +Create the name of the PostgreSQL credentials Secret to use. +*/}} +{{- define "risingwave.postgresCredentialsSecretName" -}} +{{- if .Values.metaStore.postgresql.authentication.existingSecretName }} +{{- .Values.metaStore.postgresql.authentication.existingSecretName }} +{{- else }} +{{- printf "%s-postgres" (include "risingwave.fullname" .) | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{/* +Create the name of the MySQL credentials Secret to use. +*/}} +{{- define "risingwave.mysqlCredentialsSecretName" -}} +{{- if .Values.metaStore.mysql.authentication.existingSecretName }} +{{- .Values.metaStore.mysql.authentication.existingSecretName }} +{{- else }} +{{- printf "%s-mysql" (include "risingwave.fullname" .) | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + {{/* Create the name of the S3 credentials Secret to use */}} @@ -200,6 +223,49 @@ Create the meta backend type string to use. {{- define "risingwave.metaBackend" -}} {{- if or (include "risingwave.bundle.etcd.enabled" .) .Values.metaStore.etcd.enabled }} {{- print "etcd" }} +{{- else if or .Values.metaStore.sqlite.enabled .Values.metaStore.postgresql.enabled .Values.metaStore.mysql.enabled }} +{{- print "sql" }} +{{- else }} +{{- print "" }} +{{- end }} +{{- end }} + + +{{/* +Convert connection options. +*/}} +{{- define "common.convertConnectionOptions" -}} +{{- $list := list -}} +{{- range $k, $v := . -}} +{{- $list = append $list (printf "%s=%s" $k (urlquery $v)) -}} +{{- end -}} +{{ join "&" $list }} +{{- end -}} + +{{/* +Create the SQL endpoint string to use. +*/}} +{{- define "risingwave.sqlEndpoint" -}} +{{- if .Values.metaStore.sqlite.enabled }} +{{- printf "sqlite://%s?mode=rwc" .Values.metaStore.sqlite.path }} +{{- else if .Values.metaStore.postgresql.enabled }} +{{- if .Values.metaStore.postgresql.options }} +{{- printf "postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@%s:%d/%s?%s" + .Values.metaStore.postgresql.host (.Values.metaStore.postgresql.port | int) .Values.metaStore.postgresql.database + (include "common.convertConnectionOptions" .Values.metaStore.postgresql.options) }} +{{- else }} +{{- printf "postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@%s:%d/%s" + .Values.metaStore.postgresql.host (.Values.metaStore.postgresql.port | int) .Values.metaStore.postgresql.database }} +{{- end }} +{{- else if .Values.metaStore.mysql.enabled }} +{{- if .Values.metaStore.mysql.options }} +{{- printf "mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@%s:%d/%s?%s" + .Values.metaStore.mysql.host (.Values.metaStore.mysql.port | int) .Values.metaStore.mysql.database + (include "common.convertConnectionOptions" .Values.metaStore.mysql.options) }} +{{- else }} +{{- printf "mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@%s:%d/%s" + .Values.metaStore.mysql.host (.Values.metaStore.mysql.port | int) .Values.metaStore.mysql.database }} +{{- end }} {{- else }} {{- print "" }} {{- end }} @@ -230,6 +296,8 @@ Create the hummock connection string to use. {{- printf "hummock+hdfs://%s" .Values.stateStore.hdfs.nameNode }} {{- else if .Values.stateStore.obs.enabled }} {{- printf "hummock+obs://%s" .Values.stateStore.obs.bucket }} +{{- else if .Values.stateStore.localFs.enabled }} +{{- printf "hummock+fs://%s" .Values.stateStore.localFs.path }} {{- else }} {{- print "" }} {{- end }} diff --git a/charts/risingwave/templates/compute-sts.yaml b/charts/risingwave/templates/compute-sts.yaml index 498b78d..5c63b63 100644 --- a/charts/risingwave/templates/compute-sts.yaml +++ b/charts/risingwave/templates/compute-sts.yaml @@ -29,6 +29,14 @@ spec: maxUnavailable: "100%" podManagementPolicy: Parallel minReadySeconds: 0 + {{- if .Values.computeComponent.volumeClaimTemplates }} + volumeClaimTemplates: + {{- toYaml .Values.computeComponent.volumeClaimTemplates | nindent 2 }} + {{- end }} + {{- if .Values.computeComponent.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml .Values.computeComponent.persistentVolumeClaimRetentionPolicy | nindent 4 }} + {{- end }} template: metadata: labels: diff --git a/charts/risingwave/templates/meta-sts.yaml b/charts/risingwave/templates/meta-sts.yaml index 22fcd54..02fe66a 100644 --- a/charts/risingwave/templates/meta-sts.yaml +++ b/charts/risingwave/templates/meta-sts.yaml @@ -29,6 +29,14 @@ spec: maxUnavailable: "100%" podManagementPolicy: Parallel minReadySeconds: 0 + {{- if .Values.metaComponent.volumeClaimTemplates }} + volumeClaimTemplates: + {{- toYaml .Values.metaComponent.volumeClaimTemplates | nindent 2 }} + {{- end }} + {{- if .Values.metaComponent.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml .Values.metaComponent.persistentVolumeClaimRetentionPolicy | nindent 4 }} + {{- end }} template: metadata: labels: @@ -137,6 +145,14 @@ spec: - secretRef: name: {{ include "risingwave.etcdCredentialsSecretName" . }} {{- end }} + {{- if .Values.metaStore.postgresql.enabled }} + - secretRef: + name: {{ include "risingwave.postgresCredentialsSecretName" . }} + {{- end }} + {{- if .Values.metaStore.mysql.enabled }} + - secretRef: + name: {{ include "risingwave.mysqlCredentialsSecretName" . }} + {{- end }} env: # 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 @@ -254,6 +270,35 @@ spec: {{- if .Values.metaComponent.extraEnvVars }} {{- .Values.metaComponent.extraEnvVars | toYaml | nindent 8 }} {{- end }} + # SQL meta backend. + {{- if and .Values.metaStore.postgresql.enabled .Values.metaStore.postgresql.authentication.existingSecretName }} + - name: RW_POSTGRES_USERNAME + valueFrom: + secretKeyRef: + key: username + name: {{ .Values.metaStore.postgresql.authentication.existingSecretName }} + - name: RW_POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: {{ .Values.metaStore.postgresql.authentication.existingSecretName }} + {{- end }} + {{- if and .Values.metaStore.mysql.enabled .Values.metaStore.mysql.authentication.existingSecretName }} + - name: RW_MYSQL_USERNAME + valueFrom: + secretKeyRef: + key: username + name: {{ .Values.metaStore.mysql.authentication.existingSecretName }} + - name: RW_MYSQL_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: {{ .Values.metaStore.mysql.authentication.existingSecretName }} + {{- end }} + {{- if eq (include "risingwave.metaBackend" . ) "sql" }} + - name: RW_SQL_ENDPOINT + value: {{ include "risingwave.sqlEndpoint" . }} + {{- end }} resources: {{- if .Values.metaComponent.resources.limits }} limits: diff --git a/charts/risingwave/templates/metastore/mysql-secret.yaml b/charts/risingwave/templates/metastore/mysql-secret.yaml new file mode 100644 index 0000000..cd31ab0 --- /dev/null +++ b/charts/risingwave/templates/metastore/mysql-secret.yaml @@ -0,0 +1,23 @@ +{{/* +Copyright RisingWave Labs +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.metaStore.mysql.enabled }} +{{- if not .Values.metaStore.mysql.authentication.existingSecretName }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "risingwave.mysqlCredentialsSecretName" . }} + labels: + {{- include "risingwave.labels" . | nindent 4 }} + {{- $annotations := (include "risingwave.annotations" . ) | trim }} + {{- if $annotations }} + annotations: + {{ nindent 4 $annotations }} + {{- end }} +stringData: + RW_MYSQL_USERNAME: {{ .Values.metaStore.mysql.authentication.username | quote }} + RW_MYSQL_PASSWORD: {{ .Values.metaStore.mysql.authentication.password | quote }} +{{- end }} +{{- end }} diff --git a/charts/risingwave/templates/metastore/postgres-secret.yaml b/charts/risingwave/templates/metastore/postgres-secret.yaml new file mode 100644 index 0000000..098ac15 --- /dev/null +++ b/charts/risingwave/templates/metastore/postgres-secret.yaml @@ -0,0 +1,23 @@ +{{/* +Copyright RisingWave Labs +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.metaStore.postgresql.enabled }} +{{- if not .Values.metaStore.postgresql.authentication.existingSecretName }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "risingwave.postgresCredentialsSecretName" . }} + labels: + {{- include "risingwave.labels" . | nindent 4 }} + {{- $annotations := (include "risingwave.annotations" . ) | trim }} + {{- if $annotations }} + annotations: + {{ nindent 4 $annotations }} + {{- end }} +stringData: + RW_POSTGRES_USERNAME: {{ .Values.metaStore.postgresql.authentication.username | quote }} + RW_POSTGRES_PASSWORD: {{ .Values.metaStore.postgresql.authentication.password | quote }} +{{- end }} +{{- end }} diff --git a/charts/risingwave/templates/standalone/standalone-sts.yaml b/charts/risingwave/templates/standalone/standalone-sts.yaml index 634db58..ec7bc94 100644 --- a/charts/risingwave/templates/standalone/standalone-sts.yaml +++ b/charts/risingwave/templates/standalone/standalone-sts.yaml @@ -28,6 +28,14 @@ spec: maxUnavailable: "100%" podManagementPolicy: Parallel minReadySeconds: 0 + {{- if .Values.standalone.volumeClaimTemplates }} + volumeClaimTemplates: + {{- toYaml .Values.standalone.volumeClaimTemplates | nindent 2 }} + {{- end }} + {{- if .Values.standalone.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml .Values.standalone.persistentVolumeClaimRetentionPolicy | nindent 4 }} + {{- end }} template: metadata: labels: @@ -115,7 +123,12 @@ spec: --dashboard-host 0.0.0.0:{{ .Values.ports.meta.dashboard }} --prometheus-host 0.0.0.0:{{ .Values.ports.meta.metrics }} --backend $(RW_BACKEND) + {{- if .Values.metaStore.etcd.enabled }} --etcd-endpoints $(RW_ETCD_ENDPOINTS) + {{- end }} + {{- if eq (include "risingwave.metaBackend" . ) "sql" }} + --sql-endpoint $(RW_SQL_ENDPOINT) + {{- end }} --state-store $(RW_STATE_STORE) --data-directory $(RW_DATA_DIRECTORY) --config-path /risingwave/config/risingwave.toml @@ -194,6 +207,14 @@ spec: - secretRef: name: {{ include "risingwave.etcdCredentialsSecretName" . }} {{- end }} + {{- if .Values.metaStore.postgresql.enabled }} + - secretRef: + name: {{ include "risingwave.postgresCredentialsSecretName" . }} + {{- end }} + {{- if .Values.metaStore.mysql.enabled }} + - secretRef: + name: {{ include "risingwave.mysqlCredentialsSecretName" . }} + {{- end }} env: # 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 @@ -300,6 +321,35 @@ spec: name: {{ include "risingwave.etcdCredentialsSecretName" . }} {{- end }} {{- end }} + # SQL meta backend. + {{- if and .Values.metaStore.postgresql.enabled .Values.metaStore.postgresql.authentication.existingSecretName }} + - name: RW_POSTGRES_USERNAME + valueFrom: + secretKeyRef: + key: username + name: {{ .Values.metaStore.postgresql.authentication.existingSecretName }} + - name: RW_POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: {{ .Values.metaStore.postgresql.authentication.existingSecretName }} + {{- end }} + {{- if and .Values.metaStore.mysql.enabled .Values.metaStore.mysql.authentication.existingSecretName }} + - name: RW_MYSQL_USERNAME + valueFrom: + secretKeyRef: + key: username + name: {{ .Values.metaStore.mysql.authentication.existingSecretName }} + - name: RW_MYSQL_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: {{ .Values.metaStore.mysql.authentication.existingSecretName }} + {{- end }} + {{- if eq (include "risingwave.metaBackend" . ) "sql" }} + - name: RW_SQL_ENDPOINT + value: {{ include "risingwave.sqlEndpoint" . }} + {{- end }} {{- if .Values.standalone.extraEnvVars }} {{- .Values.standalone.extraEnvVars | toYaml | nindent 8 }} {{- end }} diff --git a/charts/risingwave/templates/validation.yaml b/charts/risingwave/templates/validation.yaml index 90f6d9e..13e43f6 100644 --- a/charts/risingwave/templates/validation.yaml +++ b/charts/risingwave/templates/validation.yaml @@ -16,6 +16,7 @@ Validate state store backends. {{- if .azblob.enabled }}{{ $count = add1 $count }}{{ $name = "AZBLOB" }}{{- end }} {{- if .hdfs.enabled }}{{ $count = add1 $count }}{{ $name = "HDFS" }}{{- end }} {{- if .obs.enabled }}{{ $count = add1 $count }}{{ $name = "OBS" }}{{- end }} + {{- if .localFs.enabled }}{{ $count = add1 $count }}{{ $name = "LocalFS" }}{{- end }} {{- end }} # If there's no state store and bundled minio enabled, count = 1 {{- if (include "risingwave.bundle.minio.enabled" .) }} @@ -51,6 +52,9 @@ Validate meta store backends. # Count without etcd. {{- with .Values.metaStore }} {{/* {{- if .etcd.enabled }}{{ $count = add1 $count }}{{ $name = "etcd" }}{{- end }}*/}} +{{- if .sqlite.enabled }}{{ $count = add1 $count }}{{ $name = "sqlite" }}{{- end }} +{{- if .mysql.enabled }}{{ $count = add1 $count }}{{ $name = "mysql" }}{{- end }} +{{- if .postgresql.enabled }}{{ $count = add1 $count }}{{ $name = "postgresql" }}{{- end }} {{- end }} # If there's no state store and bundled minio enabled, count = 1 {{- if (include "risingwave.bundle.etcd.enabled" .) }} @@ -75,7 +79,7 @@ Validate parameters of etcd meta store. {{- if not (include "risingwave.bundle.etcd.enabled" .) }} {{- if .Values.metaStore.etcd.enabled }} {{- if empty .Values.metaStore.etcd.endpoints }} - {{- fail "Meta store etcd endpoints must be set!" }} + {{- fail "Endpoints .metaStore.etcd.endpoints must be set!" }} {{- end }} {{- if .Values.metaStore.etcd.authentication.enabled }} {{- if not (or .Values.metaStore.etcd.authentication.existingSecretName @@ -86,6 +90,59 @@ Validate parameters of etcd meta store. {{- end }} {{- end }} +{{/* +Validate parameters of sqlite meta store. +*/}} +{{- if .Values.metaStore.sqlite.enabled }} + {{- if empty .Values.metaStore.sqlite.path }} + {{- fail "DB path .metaStore.sqlite.path must be set!" }} + {{- end }} +{{- end }} + +{{/* +Validate parameters of PostgreSQL meta store. +*/}} +{{- if .Values.metaStore.postgresql.enabled }} + {{- if empty .Values.metaStore.postgresql.host }} + {{- fail "Host .metaStore.postgresql.host must be set!" }} + {{- end }} + {{- if empty .Values.metaStore.postgresql.port }} + {{- fail "Port .metaStore.postgresql.port must be set!" }} + {{- end }} + {{- if empty .Values.metaStore.postgresql.database }} + {{- fail "Database .metaStore.postgresql.database must be set!" }} + {{- end }} + {{- with .Values.metaStore.postgresql.authentication }} + {{- if not .existingSecretName }} + {{- if or (empty .username) (empty .password) }} + {{- fail "Credentials to connect PostgreSQL must be provided!\nCheck .metaStore.postgresql.authentication for details!" }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} + +{{/* +Validate parameters of MySQL meta store. +*/}} +{{- if .Values.metaStore.mysql.enabled }} + {{- if empty .Values.metaStore.mysql.host }} + {{- fail "Host .metaStore.mysql.host must be set!" }} + {{- end }} + {{- if empty .Values.metaStore.mysql.port }} + {{- fail "Port .metaStore.mysql.port must be set!" }} + {{- end }} + {{- if empty .Values.metaStore.mysql.database }} + {{- fail "Database .metaStore.mysql.database must be set!" }} + {{- end }} + {{- with .Values.metaStore.mysql.authentication }} + {{- if not .existingSecretName }} + {{- if or (empty .username) (empty .password) }} + {{- fail "Credentials to connect MySQL must be provided!\nCheck .metaStore.mysql.authentication for details!" }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} + {{/* Validate parameters of S3 state store. */}} @@ -198,3 +255,12 @@ Validate parameters of AzureBlob state store. {{- end }} {{- end }} {{- end }} + +{{/* +Validate parameters of LocalFS state store. +*/}} +{{- if .Values.stateStore.localFs.enabled }} + {{- if empty .Values.stateStore.localFs.path }} + {{- fail "Path .stateStore.localFs.path must be set!" }} + {{- end }} +{{- end }} diff --git a/charts/risingwave/tests/metastore/etcd_validation_test.yaml b/charts/risingwave/tests/metastore/etcd_validation_test.yaml deleted file mode 100644 index 43177f7..0000000 --- a/charts/risingwave/tests/metastore/etcd_validation_test.yaml +++ /dev/null @@ -1,123 +0,0 @@ -suite: Test etcd existing secret validation -templates: -- templates/validation.yaml -chart: - appVersion: 1.0.0 - version: 0.0.1 -tests: -- it: no authentication should pass - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: false - asserts: - - notFailedTemplate: { } -- it: existing secret should pass - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: true - existingSecretName: a - asserts: - - notFailedTemplate: { } -- it: username/password should pass - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: true - username: a - password: b - asserts: - - notFailedTemplate: { } -- it: no credentials should fail - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: true - asserts: - - failedTemplate: - errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" -- it: username only should fail - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: true - username: a - asserts: - - failedTemplate: - errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" -- it: password only should fail - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - dummy - authentication: - enabled: true - password: a - asserts: - - failedTemplate: - errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" -- it: no endpoints should fail - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - asserts: - - failedTemplate: - errorMessage: "Meta store etcd endpoints must be set!" -- it: multiple endpoints should pass - set: - tags: - minio: true - - metaStore: - etcd: - enabled: true - endpoints: - - a - - b - asserts: - - notFailedTemplate: { } diff --git a/charts/risingwave/tests/metastore/meta-sts_env_test.yaml b/charts/risingwave/tests/metastore/meta-sts_env_test.yaml index 96bd11c..d04f233 100644 --- a/charts/risingwave/tests/metastore/meta-sts_env_test.yaml +++ b/charts/risingwave/tests/metastore/meta-sts_env_test.yaml @@ -173,4 +173,209 @@ tests: valueFrom: secretKeyRef: key: password - name: s \ No newline at end of file + name: s +# Tests for sqlite. +## true-negative (sqlite) +- it: envs must not contain RW_SQL_ENDPOINT (non-sqlite) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (sqlite) +- it: envs must contain necessary ones (sqlite) + set: + metaStore: + sqlite: + enabled: true + path: /risingwave.db + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: sqlite:///risingwave.db?mode=rwc +# Tests for PostgreSQL. +## true-negative (postgres) +- it: envs must not contain RW_SQL_ENDPOINT (non-postgres) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (postgres) +- it: envs must contain necessary ones (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@host:5432/risingwave + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-postgres +- it: envs should reflect options + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + options: + a: b + c: d=e + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@host:5432/risingwave?a=b&c=d%3De +- it: envs must reflect existing secret (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + existingSecretName: s + asserts: + - notContains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-postgres + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_POSTGRES_USERNAME + valueFrom: + secretKeyRef: + key: username + name: s + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: s +# Tests for MySQL. +## true-negative (mysql) +- it: envs must not contain RW_SQL_ENDPOINT (non-mysql) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (mysql) +- it: envs must contain necessary ones (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@host:5432/risingwave + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-mysql +- it: envs should reflect options + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + options: + a: b + c: d=e + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@host:5432/risingwave?a=b&c=d%3De +- it: envs must reflect existing secret (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + existingSecretName: s + asserts: + - notContains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-mysql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_MYSQL_USERNAME + valueFrom: + secretKeyRef: + key: username + name: s + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_MYSQL_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: s diff --git a/charts/risingwave/tests/metastore/metastore_validation_test.yaml b/charts/risingwave/tests/metastore/metastore_validation_test.yaml new file mode 100644 index 0000000..05c880e --- /dev/null +++ b/charts/risingwave/tests/metastore/metastore_validation_test.yaml @@ -0,0 +1,313 @@ +suite: Test etcd existing secret validation +templates: +- templates/validation.yaml +chart: + appVersion: 1.0.0 + version: 0.0.1 +set: + tags: + minio: true +tests: +- it: no meta store backend should fail + asserts: + - failedTemplate: + errorMessage: "No meta store backend!" +- it: multiple backends should fail + set: + metaStore: + etcd: + enabled: true + mysql: + enabled: true + asserts: + - failedTemplate: + errorMessage: "More than one meta store backends!" +# Tests for etcd. +- it: no authentication should pass (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: false + asserts: + - notFailedTemplate: { } +- it: existing secret should pass (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: true + existingSecretName: a + asserts: + - notFailedTemplate: { } +- it: username/password should pass (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: true + username: a + password: b + asserts: + - notFailedTemplate: { } +- it: no credentials should fail (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: true + asserts: + - failedTemplate: + errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" +- it: username only should fail (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: true + username: a + asserts: + - failedTemplate: + errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" +- it: password only should fail (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - dummy + authentication: + enabled: true + password: a + asserts: + - failedTemplate: + errorMessage: "Meta store etcd's authentication is enabled, either existing secret or username/password should be provided!" +- it: no endpoints should fail (etcd) + set: + metaStore: + etcd: + enabled: true + asserts: + - failedTemplate: + errorMessage: "Endpoints .metaStore.etcd.endpoints must be set!" +- it: multiple endpoints should pass (etcd) + set: + metaStore: + etcd: + enabled: true + endpoints: + - a + - b + asserts: + - notFailedTemplate: { } +# Tests for sqlite. +- it: empty path should fail (sqlite) + set: + metaStore: + sqlite: + enabled: true + path: "" + asserts: + - failedTemplate: + errorMessage: "DB path .metaStore.sqlite.path must be set!" +# Tests for PostgreSQL. +- it: empty host should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: "" + asserts: + - failedTemplate: + errorMessage: "Host .metaStore.postgresql.host must be set!" +- it: empty port should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 0 + asserts: + - failedTemplate: + errorMessage: "Port .metaStore.postgresql.port must be set!" +- it: empty database should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "" + asserts: + - failedTemplate: + errorMessage: "Database .metaStore.postgresql.database must be set!" +- it: empty credentials should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "risingwave" + asserts: + - failedTemplate: + errorMessage: "Credentials to connect PostgreSQL must be provided!" +- it: missing username should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + password: p + asserts: + - failedTemplate: + errorMessage: "Credentials to connect PostgreSQL must be provided!" +- it: missing password should fail (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + username: u + asserts: + - failedTemplate: + errorMessage: "Credentials to connect PostgreSQL must be provided!" +- it: existing secret name should pass (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + existingSecretName: s + asserts: + - notFailedTemplate: { } +- it: username/password should pass (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + username: u + password: p + asserts: + - notFailedTemplate: { } +# Tests for MySQL. +- it: empty host should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: "" + asserts: + - failedTemplate: + errorMessage: "Host .metaStore.mysql.host must be set!" +- it: empty port should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 0 + asserts: + - failedTemplate: + errorMessage: "Port .metaStore.mysql.port must be set!" +- it: empty database should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 3306 + database: "" + asserts: + - failedTemplate: + errorMessage: "Database .metaStore.mysql.database must be set!" +- it: empty credentials should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: "risingwave" + asserts: + - failedTemplate: + errorMessage: "Credentials to connect MySQL must be provided!" +- it: missing username should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + password: p + asserts: + - failedTemplate: + errorMessage: "Credentials to connect MySQL must be provided!" +- it: missing password should fail (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + username: u + asserts: + - failedTemplate: + errorMessage: "Credentials to connect MySQL must be provided!" +- it: existing secret name should pass (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + existingSecretName: s + asserts: + - notFailedTemplate: { } +- it: username/password should pass (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: "risingwave" + authentication: + username: u + password: p + asserts: + - notFailedTemplate: { } diff --git a/charts/risingwave/tests/metastore/mysql_secret_test.yaml b/charts/risingwave/tests/metastore/mysql_secret_test.yaml new file mode 100644 index 0000000..07c9151 --- /dev/null +++ b/charts/risingwave/tests/metastore/mysql_secret_test.yaml @@ -0,0 +1,71 @@ +suite: Test mysql secret +templates: +- templates/metastore/mysql-secret.yaml +chart: + appVersion: 1.0.0 + version: 0.0.1 +tests: +- it: mysql with existing secret should not render secret + set: + metaStore.mysql.authentication: + existingSecretName: EXISTING_SECRET_NAME + asserts: + - hasDocuments: + count: 0 +- it: mysql with username/password should pass + set: + metaStore: + mysql: + enabled: true + authentication: + username: USERNAME + password: PASSWORD + asserts: + - hasDocuments: + count: 1 + - containsDocument: + apiVersion: v1 + kind: Secret + - equal: + path: metadata.name + value: RELEASE-NAME-risingwave-mysql + - isSubset: + path: metadata.labels + content: + helm.sh/chart: risingwave-0.0.1 + app.kubernetes.io/name: risingwave + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: 1.0.0 + app.kubernetes.io/instance: RELEASE-NAME + - notExists: + path: metadata.annotations + - equal: + path: stringData + value: + RW_MYSQL_USERNAME: "USERNAME" + RW_MYSQL_PASSWORD: "PASSWORD" +- it: mysql secret contains common labels and annotations + set: + commonLabels: + LABEL: LABEL_V + commonAnnotations: + ANNOTATION: ANNOTATION_V + metaStore: + mysql: + enabled: true + asserts: + - isSubset: + path: metadata.labels + content: + helm.sh/chart: risingwave-0.0.1 + app.kubernetes.io/name: risingwave + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: 1.0.0 + app.kubernetes.io/instance: RELEASE-NAME + LABEL: LABEL_V + - exists: + path: metadata.annotations + - isSubset: + path: metadata.annotations + content: + ANNOTATION: ANNOTATION_V diff --git a/charts/risingwave/tests/metastore/postgresql_secret_test.yaml b/charts/risingwave/tests/metastore/postgresql_secret_test.yaml new file mode 100644 index 0000000..82ac505 --- /dev/null +++ b/charts/risingwave/tests/metastore/postgresql_secret_test.yaml @@ -0,0 +1,71 @@ +suite: Test postgresql secret +templates: +- templates/metastore/postgres-secret.yaml +chart: + appVersion: 1.0.0 + version: 0.0.1 +tests: +- it: postgresql with existing secret should not render secret + set: + metaStore.postgresql.authentication: + existingSecretName: EXISTING_SECRET_NAME + asserts: + - hasDocuments: + count: 0 +- it: postgresql with username/password should pass + set: + metaStore: + postgresql: + enabled: true + authentication: + username: USERNAME + password: PASSWORD + asserts: + - hasDocuments: + count: 1 + - containsDocument: + apiVersion: v1 + kind: Secret + - equal: + path: metadata.name + value: RELEASE-NAME-risingwave-postgres + - isSubset: + path: metadata.labels + content: + helm.sh/chart: risingwave-0.0.1 + app.kubernetes.io/name: risingwave + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: 1.0.0 + app.kubernetes.io/instance: RELEASE-NAME + - notExists: + path: metadata.annotations + - equal: + path: stringData + value: + RW_POSTGRES_USERNAME: "USERNAME" + RW_POSTGRES_PASSWORD: "PASSWORD" +- it: postgresql secret contains common labels and annotations + set: + commonLabels: + LABEL: LABEL_V + commonAnnotations: + ANNOTATION: ANNOTATION_V + metaStore: + postgresql: + enabled: true + asserts: + - isSubset: + path: metadata.labels + content: + helm.sh/chart: risingwave-0.0.1 + app.kubernetes.io/name: risingwave + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: 1.0.0 + app.kubernetes.io/instance: RELEASE-NAME + LABEL: LABEL_V + - exists: + path: metadata.annotations + - isSubset: + path: metadata.annotations + content: + ANNOTATION: ANNOTATION_V diff --git a/charts/risingwave/tests/metastore/standalone-sts_env_test.yaml b/charts/risingwave/tests/metastore/standalone-sts_env_test.yaml index 361b79d..b95c1cb 100644 --- a/charts/risingwave/tests/metastore/standalone-sts_env_test.yaml +++ b/charts/risingwave/tests/metastore/standalone-sts_env_test.yaml @@ -175,4 +175,209 @@ tests: valueFrom: secretKeyRef: key: password - name: s \ No newline at end of file + name: s +# Tests for sqlite. +## true-negative (sqlite) +- it: envs must not contain RW_SQL_ENDPOINT (non-sqlite) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (sqlite) +- it: envs must contain necessary ones (sqlite) + set: + metaStore: + sqlite: + enabled: true + path: /risingwave.db + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: sqlite:///risingwave.db?mode=rwc +# Tests for PostgreSQL. +## true-negative (postgres) +- it: envs must not contain RW_SQL_ENDPOINT (non-postgres) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (postgres) +- it: envs must contain necessary ones (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@host:5432/risingwave + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-postgres +- it: envs should reflect options + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + options: + a: b + c: d=e + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: postgres://$(RW_POSTGRES_USERNAME):$(RW_POSTGRES_PASSWORD)@host:5432/risingwave?a=b&c=d%3De +- it: envs must reflect existing secret (postgres) + set: + metaStore: + postgresql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + existingSecretName: s + asserts: + - notContains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-postgres + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_POSTGRES_USERNAME + valueFrom: + secretKeyRef: + key: username + name: s + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: s +# Tests for MySQL. +## true-negative (mysql) +- it: envs must not contain RW_SQL_ENDPOINT (non-mysql) + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + any: true +## true-positive (mysql) +- it: envs must contain necessary ones (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_BACKEND + value: sql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@host:5432/risingwave + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-mysql +- it: envs should reflect options + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + options: + a: b + c: d=e + authentication: + username: u + password: p + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_SQL_ENDPOINT + value: mysql://$(RW_MYSQL_USERNAME):$(RW_MYSQL_PASSWORD)@host:5432/risingwave?a=b&c=d%3De +- it: envs must reflect existing secret (mysql) + set: + metaStore: + mysql: + enabled: true + host: host + port: 5432 + database: risingwave + authentication: + existingSecretName: s + asserts: + - notContains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: RELEASE-NAME-risingwave-mysql + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_MYSQL_USERNAME + valueFrom: + secretKeyRef: + key: username + name: s + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_MYSQL_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: s diff --git a/charts/risingwave/tests/standalone/standalone_sts_test.yaml b/charts/risingwave/tests/standalone/standalone_sts_test.yaml index 155de4f..f729435 100644 --- a/charts/risingwave/tests/standalone/standalone_sts_test.yaml +++ b/charts/risingwave/tests/standalone/standalone_sts_test.yaml @@ -138,7 +138,6 @@ tests: --dashboard-host 0.0.0.0:5691 --prometheus-host 0.0.0.0:1250 --backend $(RW_BACKEND) - --etcd-endpoints $(RW_ETCD_ENDPOINTS) --state-store $(RW_STATE_STORE) --data-directory $(RW_DATA_DIRECTORY) --config-path /risingwave/config/risingwave.toml @@ -574,3 +573,49 @@ tests: content: name: y image: z +- it: statefulset should contain extra volume claim templates + set: + standalone: + enabled: true + volumeClaimTemplates: + - metadata: + name: www + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: "my-storage-class" + resources: + requests: + storage: 1Gi + asserts: + - contains: + path: spec.volumeClaimTemplates + content: + metadata: + name: www + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: "my-storage-class" + resources: + requests: + storage: 1Gi +- it: statefulset should reflect pvc retention policy + set: + standalone: + enabled: true + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Delete + asserts: + - equal: + path: spec.persistentVolumeClaimRetentionPolicy + value: + whenDeleted: Retain + whenScaled: Delete +- it: statefulset should reflect pvc retention policy (-) + set: + standalone: + enabled: true + persistentVolumeClaimRetentionPolicy: null + asserts: + - notExists: + path: spec.persistentVolumeClaimRetentionPolicy diff --git a/charts/risingwave/tests/statestore/cluster_workloads_env_test.yaml b/charts/risingwave/tests/statestore/cluster_workloads_env_test.yaml index 29afa05..66fb2fd 100644 --- a/charts/risingwave/tests/statestore/cluster_workloads_env_test.yaml +++ b/charts/risingwave/tests/statestore/cluster_workloads_env_test.yaml @@ -510,4 +510,17 @@ tests: path: spec.template.spec.containers[0].envFrom content: secretRef: - name: s \ No newline at end of file + name: s +# Tests for LocalFS. +- it: envs must match hummock string (local fs) + set: + stateStore: + localFs: + enabled: true + path: /data + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_STATE_STORE + value: hummock+fs:///data diff --git a/charts/risingwave/tests/statestore/standalone-sts_env_test.yaml b/charts/risingwave/tests/statestore/standalone-sts_env_test.yaml index 5002f17..871ae3d 100644 --- a/charts/risingwave/tests/statestore/standalone-sts_env_test.yaml +++ b/charts/risingwave/tests/statestore/standalone-sts_env_test.yaml @@ -505,4 +505,17 @@ tests: path: spec.template.spec.containers[0].envFrom content: secretRef: - name: s \ No newline at end of file + name: s +# Tests for LocalFS. +- it: envs must match hummock string (local fs) + set: + stateStore: + localFs: + enabled: true + path: /data + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: RW_STATE_STORE + value: hummock+fs:///data diff --git a/charts/risingwave/tests/statestore/statestore_validation_test.yaml b/charts/risingwave/tests/statestore/statestore_validation_test.yaml index a66e6b4..75b55a6 100644 --- a/charts/risingwave/tests/statestore/statestore_validation_test.yaml +++ b/charts/risingwave/tests/statestore/statestore_validation_test.yaml @@ -543,3 +543,20 @@ tests: accountKey: ak asserts: - notFailedTemplate: { } +- it: local fs empty path should fail + set: + stateStore: + localFs: + enabled: true + path: "" + asserts: + - failedTemplate: + errorMessage: "Path .stateStore.localFs.path must be set!" +- it: local fs should pass + set: + stateStore: + localFs: + enabled: true + path: "/" + asserts: + - notFailedTemplate: { } diff --git a/charts/risingwave/values.yaml b/charts/risingwave/values.yaml index 4dcc925..3ffb369 100644 --- a/charts/risingwave/values.yaml +++ b/charts/risingwave/values.yaml @@ -326,6 +326,14 @@ standalone: ## Defaults to full. rustBacktrace: full + ## @param standalone.volumeClaimTemplates Persistent volume claim templates that can be referenced. + volumeClaimTemplates: [] + + ## @param standalone.persistentVolumeClaimRetentionPolicy Policy that controls how PVCs are deleted. + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Delete + ## @section RisingWave meta store values. ## @@ -358,6 +366,96 @@ metaStore: ## existingSecretName: "" + ## @section metaStore.sqlite Values for sqlite backend. + sqlite: + ## @param metaStore.sqlite.enabled Enable/disable the meta store backend. + ## + enabled: false + + ## @param metaStore.sqlite.path Path to the sqlite file. Defaults to risingwave.db. + ## Note that the file is not in a persistent volume by default. If you would like to persist + ## the file during pod restarts, please create and mount a pvc and change the path. + ## + path: risingwave.db + + ## @section metaStore.mysql Values for PostgreSQL backend. + postgresql: + ## @param metaStore.postgresql.enabled Enable/disable the meta store backend. + ## + enabled: false + + ## @param metaStore.postgresql.host Host of the PostgreSQL server. + ## + host: "" + + ## @param metaStore.postgresql.port Port of the PostgreSQL server. Defaults to 5432. + ## + port: 5432 + + ## @param metaStore.postgresql.database Database of the PostgreSQL server. + ## + database: "" + + ## @param metaStore.postgresql.options Options to connect. + ## + options: {} + + ## @param metaStore.postgresql.authentication Authentication information. + ## + authentication: + ## @param metaStore.postgresql.authentication.username Username to connect the DB. + ## If existingSecretName is specified, the field is ignored. + ## + username: "" + ## @param metaStore.postgresql.authentication.password Password to connect the DB. + ## If existingSecretName is specified, the field is ignored. + ## + password: "" + ## @param metaStore.postgresql.authentication.existingSecretName Existing secret name. + ## The Secret must contain `username` and `password` keys. + ## If it is specified, username and password above are ignored. + ## + existingSecretName: "" + + ## @section metaStore.mysql Values for MySQL backend. + mysql: + ## @param metaStore.mysql.enabled Enable/disable the meta store backend. + ## + enabled: false + + ## @param metaStore.mysql.host Host of the MySQL server. + ## + host: "" + + ## @param metaStore.mysql.port Port of the MySQL server. Defaults to 3306. + ## + port: 3306 + + ## @param metaStore.mysql.database Database of the MySQL server. + ## + database: "" + + ## @param metaStore.mysql.options Options to connect. + ## + options: {} + + ## @param metaStore.mysql.authentication Authentication information. + ## + authentication: + ## @param metaStore.mysql.authentication.username Username to connect the DB. + ## If existingSecretName is specified, the field is ignored. + ## + username: "" + ## @param metaStore.mysql.authentication.password Password to connect the DB. + ## If existingSecretName is specified, the field is ignored. + ## + password: "" + ## @param metaStore.mysql.authentication.existingSecretName Existing secret name. + ## The Secret must contain `username` and `password` keys. + ## If it is specified, username and password above are ignored. + ## + existingSecretName: "" + ## @section RisingWave state store values. ## @@ -571,6 +669,20 @@ stateStore: ## nameNode: "" + ## @section stateStore.localFs Local FS values. + ## + + localFs: + ## @param stateStore.localFs.enabled Use local file system. For test purpose only. + ## + enabled: false + + ## @param stateStore.localFs.path Local path. + ## Note: the path is non-persistent by default. + ## If you would like to persist data, please create and mount PVCs to the path. + ## + path: data + ## @section RisingWave configuration values. ## @@ -698,6 +810,14 @@ metaComponent: ## Defaults to full. rustBacktrace: full + ## @param metaComponent.volumeClaimTemplates Persistent volume claim templates that can be referenced. + volumeClaimTemplates: [ ] + + ## @param metaComponent.persistentVolumeClaimRetentionPolicy Policy that controls how PVCs are deleted. + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Delete + frontendComponent: ## @param frontendComponent.podLabels Labels to add to the component pods. ## @@ -908,6 +1028,14 @@ computeComponent: ## Defaults to full. rustBacktrace: full + ## @param computeComponent.volumeClaimTemplates Persistent volume claim templates that can be referenced. + volumeClaimTemplates: [ ] + + ## @param computeComponent.persistentVolumeClaimRetentionPolicy Policy that controls how PVCs are deleted. + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Delete + compactorComponent: ## @param compactorComponent.podLabels Labels to add to the component pods. ## diff --git a/examples/dev/dev.values.yaml b/examples/dev/dev.values.yaml new file mode 100644 index 0000000..a6bfd47 --- /dev/null +++ b/examples/dev/dev.values.yaml @@ -0,0 +1,29 @@ +metaStore: + sqlite: + enabled: true + path: /data/metastore/risingwave.db + +stateStore: + localFs: + enabled: true + path: /data/statestore + +standalone: + enabled: true + + extraVolumeMounts: + - name: data + mountPath: /data/metastore + subPath: metastore + - name: data + mountPath: /data/statestore + subPath: statestore + + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 50Gi diff --git a/examples/meta-stores/mysql.values.yaml b/examples/meta-stores/mysql.values.yaml new file mode 100644 index 0000000..242b808 --- /dev/null +++ b/examples/meta-stores/mysql.values.yaml @@ -0,0 +1,9 @@ +metaStore: + mysql: + enabled: true + host: mysql.example + port: 3306 + database: risingwave + authentication: + username: "root" + password: "123456" diff --git a/examples/meta-stores/postgresql.values.yaml b/examples/meta-stores/postgresql.values.yaml new file mode 100644 index 0000000..daef27e --- /dev/null +++ b/examples/meta-stores/postgresql.values.yaml @@ -0,0 +1,11 @@ +metaStore: + postgresql: + enabled: true + host: postgresql.example + port: 5432 + database: risingwave + options: + currentSchema: my_schema + authentication: + username: "root" + password: "123456" diff --git a/examples/meta-stores/sqlite.values.yaml b/examples/meta-stores/sqlite.values.yaml new file mode 100644 index 0000000..1ca796b --- /dev/null +++ b/examples/meta-stores/sqlite.values.yaml @@ -0,0 +1,4 @@ +metaStore: + sqlite: + enabled: true + path: /risingwave.db diff --git a/examples/state-stores/local-fs.values.yaml b/examples/state-stores/local-fs.values.yaml new file mode 100644 index 0000000..cf8514b --- /dev/null +++ b/examples/state-stores/local-fs.values.yaml @@ -0,0 +1,5 @@ +stateStore: + dataDirectory: "prefix/of/data" + localFs: + enabled: true + path: /data