From 2f4f82a36c024bc5fcfc823395acddcd51c1a174 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Sat, 21 Nov 2026 08:47:57 +0100 Subject: [PATCH] feat(clickhouse)!: render a CredentialTemplate per user Tenant passwords move to platform-minted credentials. The chart no longer generates, looks up or renders any tenant password and ignores users..password: it renders one CredentialTemplate per user, and cozystack-controller keeps the account Secret holding the SHA-256 of the password the Cozystack API mints. The operator watches no Secrets, and a hash inline in the ClickHouseInstallation is the only path it applies without a restart, so the template asks for a valuesPath: the HelmRelease pulls each stored hash into _accounts.u, the chart renders it as password_sha256_hex, and the Flux watch label upgrades the release when a mint changes the Secret. A user with no verifier in the values is left out of the installation, because the operator would give a passwordless user the password "default". backup stays a platform account in -credentials, which now holds only it, is labelled not tenant visible and is no longer selected by the ApplicationDefinition. The names backup, default and clickhouse_operator are refused for tenant users. A rotation of the backup password restarts the pods once, since the backup sidecar reads it from its environment at start. A user whose account name is longer than 63 characters, does not start and end with a letter or a digit, or is shared with another user is refused at render, as credentials-migrate refuses it, so an install and an upgrade accept the same names. A users..password left in values draws an admission warning that points at a mint on the user's Credential. Existing clients lose readable passwords; an administrator mints a new one. Assisted-by: LLM Signed-off-by: Andrei Kvapil --- api/apps/v1alpha1/clickhouse/types.go | 4 +- .../clickhouse/clickhouse-backup.yaml | 3 +- hack/e2e-chainsaw/clickhouse/clickhouse.yaml | 3 +- packages/apps/clickhouse/README.md | 13 +- .../apps/clickhouse/templates/_accounts.tpl | 48 ++++++ .../apps/clickhouse/templates/clickhouse.yaml | 58 ++++--- .../clickhouse/templates/credentials.yaml | 25 +++ .../tests/credential_templates_test.yaml | 113 +++++++++++++ .../tests/no_tenant_password_test.yaml | 153 ++++++++++++++++++ packages/apps/clickhouse/values.schema.json | 6 +- packages/apps/clickhouse/values.yaml | 7 +- .../clickhouse-rd/cozyrds/clickhouse.yaml | 6 +- pkg/registry/apps/application/rest.go | 10 +- ...est_warn_removed_password_callsite_test.go | 3 +- 14 files changed, 399 insertions(+), 53 deletions(-) create mode 100644 packages/apps/clickhouse/templates/_accounts.tpl create mode 100644 packages/apps/clickhouse/templates/credentials.yaml create mode 100644 packages/apps/clickhouse/tests/credential_templates_test.yaml create mode 100644 packages/apps/clickhouse/tests/no_tenant_password_test.yaml diff --git a/api/apps/v1alpha1/clickhouse/types.go b/api/apps/v1alpha1/clickhouse/types.go index a8cda85bd..521f3eef2 100644 --- a/api/apps/v1alpha1/clickhouse/types.go +++ b/api/apps/v1alpha1/clickhouse/types.go @@ -45,7 +45,7 @@ type ConfigSpec struct { // TTL (expiration time) for `query_log` and `query_thread_log`. // +kubebuilder:default:=15 LogTTL int `json:"logTTL"` - // Users configuration map. + // Users configuration map. Passwords are issued through the Cozystack credentials API: a mint on the user's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SHA-256, and a revoke retires the password without issuing one. A user can log in once a password has been minted, after the release has upgraded with it. The names `backup`, `default` and `clickhouse_operator` are reserved for platform accounts. A `password` key here is ignored. // +kubebuilder:default:={} Users map[string]User `json:"users,omitempty"` // Backup configuration. @@ -155,8 +155,6 @@ type S3CredentialsSecret struct { } type User struct { - // Password for the user. - Password string `json:"password,omitempty"` // User is readonly (default: false). Readonly bool `json:"readonly,omitempty"` } diff --git a/hack/e2e-chainsaw/clickhouse/clickhouse-backup.yaml b/hack/e2e-chainsaw/clickhouse/clickhouse-backup.yaml index fb0979146..0e85a2ac4 100644 --- a/hack/e2e-chainsaw/clickhouse/clickhouse-backup.yaml +++ b/hack/e2e-chainsaw/clickhouse/clickhouse-backup.yaml @@ -29,8 +29,7 @@ spec: resourcesPreset: nano resources: {} users: - testuser: - password: xai7Wepo + testuser: {} backup: enabled: true useSystemBucket: false diff --git a/hack/e2e-chainsaw/clickhouse/clickhouse.yaml b/hack/e2e-chainsaw/clickhouse/clickhouse.yaml index 86b9b4e01..2d84e5bbd 100644 --- a/hack/e2e-chainsaw/clickhouse/clickhouse.yaml +++ b/hack/e2e-chainsaw/clickhouse/clickhouse.yaml @@ -10,8 +10,7 @@ spec: storageClass: "" logTTL: 15 users: - testuser: - password: xai7Wepo + testuser: {} backup: enabled: false s3Region: us-east-1 diff --git a/packages/apps/clickhouse/README.md b/packages/apps/clickhouse/README.md index a74c91b98..9a67e8747 100644 --- a/packages/apps/clickhouse/README.md +++ b/packages/apps/clickhouse/README.md @@ -123,13 +123,12 @@ chart-emitted CronJob renders only when `backup.schedule` is non-empty. ### Application-specific parameters -| Name | Description | Type | Value | -| ---------------------- | ------------------------------------------------------------- | ------------------- | ------- | -| `logStorageSize` | Size of Persistent Volume for logs. | `quantity` | `2Gi` | -| `logTTL` | TTL (expiration time) for `query_log` and `query_thread_log`. | `int` | `15` | -| `users` | Users configuration map. | `map[string]object` | `{}` | -| `users[name].password` | Password for the user. | `string` | `""` | -| `users[name].readonly` | User is readonly (default: false). | `bool` | `false` | +| Name | Description | Type | Value | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------- | +| `logStorageSize` | Size of Persistent Volume for logs. | `quantity` | `2Gi` | +| `logTTL` | TTL (expiration time) for `query_log` and `query_thread_log`. | `int` | `15` | +| `users` | Users configuration map. Passwords are issued through the Cozystack credentials API: a mint on the user's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SHA-256, and a revoke retires the password without issuing one. A user can log in once a password has been minted, after the release has upgraded with it. The names `backup`, `default` and `clickhouse_operator` are reserved for platform accounts. A `password` key here is ignored. | `map[string]object` | `{}` | +| `users[name].readonly` | User is readonly (default: false). | `bool` | `false` | ### Backup parameters diff --git a/packages/apps/clickhouse/templates/_accounts.tpl b/packages/apps/clickhouse/templates/_accounts.tpl new file mode 100644 index 000000000..6572e7248 --- /dev/null +++ b/packages/apps/clickhouse/templates/_accounts.tpl @@ -0,0 +1,48 @@ +{{/* + Account naming, which must match pkg/credentials/account.MapName: the + template is . and its Secret ..account, + where is the user name lowercased with every character outside + [a-z0-9-] replaced by "-". +*/}} +{{- define "clickhouse.accountName" -}} +{{- regexReplaceAll "[^a-z0-9-]" (lower .) "-" -}} +{{- end -}} + +{{/* + The stored SHA-256 of a user's password, which the HelmRelease pulls from + the account Secret into _accounts.u through the + valuesFrom entry cozystack-controller adds for the template. Empty until the + Secret exists, and for anything but a SHA-256 hex, so a value in another + format leaves the account out rather than giving the engine a broken one. +*/}} +{{- define "clickhouse.accountVerifier" -}} +{{- $root := index . 0 -}} +{{- $user := index . 1 -}} +{{- $v := get ($root.Values._accounts | default dict) (printf "u%s" (sha256sum $user)) | toString | trim | lower -}} +{{- if regexMatch "^[0-9a-f]{64}$" $v -}} +{{- $v -}} +{{- end -}} +{{- end -}} + +{{/* + Refusals for user names. backup is the platform account the backup jobs log + in with, default is the account the replicas talk to each other with, and + clickhouse_operator the one the operator logs in with: a tenant account + under any of them would take over or expose a platform login. +*/}} +{{- define "clickhouse.accountsGuard" -}} +{{- $seen := dict -}} +{{- range $user, $_ := .Values.users -}} + {{- if has $user (list "backup" "default" "clickhouse_operator") -}} + {{- fail (printf "user %q is reserved: backup, default and clickhouse_operator are platform accounts; rename the user" $user) -}} + {{- end -}} + {{- $mapped := include "clickhouse.accountName" $user -}} + {{- if or (gt (len $mapped) 63) (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $mapped)) -}} + {{- fail (printf "user %q maps to the account name %q, which must be at most 63 characters and start and end with a letter or a digit; rename the user" $user $mapped) -}} + {{- end -}} + {{- with index $seen $mapped -}} + {{- fail (printf "users %q and %q both map to the account name %q; rename one of them" . $user $mapped) -}} + {{- end -}} + {{- $_ := set $seen $mapped $user -}} +{{- end -}} +{{- end -}} diff --git a/packages/apps/clickhouse/templates/clickhouse.yaml b/packages/apps/clickhouse/templates/clickhouse.yaml index b9badef4b..05cb9e14c 100644 --- a/packages/apps/clickhouse/templates/clickhouse.yaml +++ b/packages/apps/clickhouse/templates/clickhouse.yaml @@ -1,31 +1,32 @@ {{- $clusterDomain := (index .Values._cluster "cluster-domain") | default "cozy.local" }} +{{- include "clickhouse.accountsGuard" $ }} +{{- /* + -credentials holds only the platform's backup account, which the + backup sidecar and the legacy CronJob log in with. It stays chart-generated + and is kept from tenants: no ApplicationDefinition selects it, no Role + grants it, and the label keeps the lineage webhook from marking it tenant + visible. Tenant accounts live in their account Secrets (credentials.yaml). +*/}} {{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (printf "%s-credentials" .Release.Name) }} -{{- $passwords := dict }} -{{- $users := .Values.users }} -{{- $_ := set $users "backup" dict }} - +{{- $backupPassword := "" }} {{- with (index $existingSecret "data") }} - {{- range $k, $v := . }} - {{- $_ := set $passwords $k (b64dec $v) }} + {{- with .backup }} + {{- $backupPassword = b64dec . }} {{- end }} {{- end }} - -{{- range $user, $u := $users }} - {{- if $u.password }} - {{- $_ := set $passwords $user $u.password }} - {{- else if not (index $passwords $user) }} - {{- $_ := set $passwords $user (randAlphaNum 16) }} - {{- end }} +{{- if not $backupPassword }} + {{- $backupPassword = randAlphaNum 16 }} {{- end }} +{{- $backupRotated := dig "metadata" "annotations" "credentials.cozystack.io/rotated" "" ($existingSecret | default dict) }} apiVersion: v1 kind: Secret metadata: name: {{ .Release.Name }}-credentials + labels: + internal.cozystack.io/tenantresource: "false" stringData: - {{- range $user, $u := .Values.users }} - {{ quote $user }}: {{ quote (index $passwords $user) }} - {{- end }} + backup: {{ quote $backupPassword }} --- apiVersion: "clickhouse.altinity.com/v1" @@ -40,14 +41,23 @@ spec: podTemplate: clickhouse-per-host serviceTemplate: svc-template configuration: - {{- with $users }} users: - {{- range $name, $u := . }} - {{ $name }}/password_sha256_hex: {{ sha256sum (index $passwords $name) }} + {{- /* + A tenant account with no verifier in the values yet, as before + cozystack-controller has seeded its Secret, is left out: without a + password the operator would give it the password "default". + */}} + {{- range $name, $u := .Values.users }} + {{- $verifier := include "clickhouse.accountVerifier" (list $ $name) }} + {{- if $verifier }} + {{ $name }}/password_sha256_hex: {{ $verifier | quote }} {{ $name }}/profile: {{ ternary "readonly" "default" (index $u "readonly" | default false) }} {{ $name }}/networks/ip: ["::/0"] {{- end }} - {{- end }} + {{- end }} + backup/password_sha256_hex: {{ sha256sum $backupPassword | quote }} + backup/profile: default + backup/networks/ip: ["::/0"] files: config.d/z_log_disable.xml: | @@ -128,6 +138,14 @@ spec: metadata: labels: app.kubernetes.io/instance: {{ .Release.Name }} + {{- if and .Values.backup.enabled $backupRotated }} + {{- /* + The backup sidecar reads the backup password from its environment + at start, so a rotation of it restarts the pods once. + */}} + annotations: + credentials.cozystack.io/backup-rotated: {{ $backupRotated | quote }} + {{- end }} spec: affinity: podAntiAffinity: diff --git a/packages/apps/clickhouse/templates/credentials.yaml b/packages/apps/clickhouse/templates/credentials.yaml new file mode 100644 index 000000000..5d1007a0a --- /dev/null +++ b/packages/apps/clickhouse/templates/credentials.yaml @@ -0,0 +1,25 @@ +{{- /* + One CredentialTemplate per user: the account the Cozystack credentials API + mints and revokes through. The operator reads no Secret, so the template + asks for a valuesPath: cozystack-controller adds a valuesFrom entry that + pulls the account Secret's SHA-256 into the release values, and the label + makes Flux upgrade the release when a mint or a revoke changes the Secret. + clickhouse.yaml renders the verifier into the ClickHouseInstallation. The + chart renders no tenant password. +*/ -}} +{{- include "clickhouse.accountsGuard" $ }} +{{- range $user, $_ := .Values.users }} +--- +apiVersion: cozystack.io/v1alpha1 +kind: CredentialTemplate +metadata: + name: {{ printf "%s.%s" $.Release.Name (include "clickhouse.accountName" $user) | quote }} +spec: + username: {{ $user | quote }} + format: + name: sha256 + secret: + labels: + reconcile.fluxcd.io/watch: Enabled + valuesPath: _accounts +{{- end }} diff --git a/packages/apps/clickhouse/tests/credential_templates_test.yaml b/packages/apps/clickhouse/tests/credential_templates_test.yaml new file mode 100644 index 000000000..86ffb8526 --- /dev/null +++ b/packages/apps/clickhouse/tests/credential_templates_test.yaml @@ -0,0 +1,113 @@ +suite: one CredentialTemplate per user, with the verifier delivered through values + +# The template is the account the credentials API mints through. The operator +# reads no Secret, so the template asks for a valuesPath, and the chart reads +# the stored SHA-256 back from _accounts.u. + +templates: + - templates/credentials.yaml + +release: + name: ch-test + namespace: tenant-test + +set: + _cluster: {} + +tests: + - it: renders nothing without users + asserts: + - hasDocuments: + count: 0 + + - it: renders a template per user, named for the account Secret's mapping + set: + users: + web: {} + Bob.Smith: + readonly: true + asserts: + - hasDocuments: + count: 2 + - isKind: + of: CredentialTemplate + - equal: + path: apiVersion + value: cozystack.io/v1alpha1 + - equal: + path: metadata.name + value: ch-test.bob-smith + documentIndex: 0 + - equal: + path: spec.username + value: Bob.Smith + documentIndex: 0 + - equal: + path: metadata.name + value: ch-test.web + documentIndex: 1 + + - it: stores SHA-256 verifiers, asks for the Flux watch label and a values path + set: + users: + web: {} + asserts: + - equal: + path: spec.format.name + value: sha256 + - equal: + path: spec.secret.labels + value: + reconcile.fluxcd.io/watch: Enabled + - equal: + path: spec.valuesPath + value: _accounts + + - it: refuses two users that map to one account + set: + users: + web: {} + Web: {} + asserts: + - failedTemplate: + errorPattern: map to + + - it: refuses a user whose name maps to no valid account name + set: + users: + "-web": {} + asserts: + - failedTemplate: + errorPattern: start and end with a letter or a digit + + - it: refuses a user whose account name is longer than a DNS label + set: + users: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: {} + asserts: + - failedTemplate: + errorPattern: at most 63 characters + + - it: refuses the backup platform account as a tenant user + set: + users: + backup: {} + asserts: + - failedTemplate: + errorPattern: reserved + + - it: refuses the default user + set: + users: + default: {} + asserts: + - failedTemplate: + errorPattern: reserved + + - it: refuses the operator's user + set: + users: + clickhouse_operator: {} + asserts: + - failedTemplate: + errorPattern: reserved diff --git a/packages/apps/clickhouse/tests/no_tenant_password_test.yaml b/packages/apps/clickhouse/tests/no_tenant_password_test.yaml new file mode 100644 index 000000000..c2a37b63e --- /dev/null +++ b/packages/apps/clickhouse/tests/no_tenant_password_test.yaml @@ -0,0 +1,153 @@ +suite: tenant passwords stay out of the chart; backup stays a hidden platform account + +# The ClickHouseInstallation gets each tenant user's SHA-256 from the values +# the HelmRelease pulls from the account Secret, and leaves out a user with no +# verifier yet, since the operator would give it the password "default". +# -credentials keeps only the platform's backup account and is never +# tenant visible. + +templates: + - templates/clickhouse.yaml + +release: + name: ch-test + namespace: tenant-test + +set: + _cluster: {} + +tests: + - it: renders the verifier a user has in values and leaves out one without + template: templates/clickhouse.yaml + documentSelector: + path: kind + value: ClickHouseInstallation + set: + users: + web: + readonly: true + reports: {} + _accounts: + u4b5e57f6eb2f42b9039b3d1e13929295f231749c510cbe341cd68036d9af97e2: ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb + asserts: + - equal: + path: spec.configuration.users["web/password_sha256_hex"] + value: ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb + - equal: + path: spec.configuration.users["web/profile"] + value: readonly + - notExists: + path: spec.configuration.users["reports/password_sha256_hex"] + - notExists: + path: spec.configuration.users["reports/profile"] + - notExists: + path: spec.configuration.users["reports/networks/ip"] + - exists: + path: spec.configuration.users["backup/password_sha256_hex"] + + - it: ignores a leftover users..password + template: templates/clickhouse.yaml + set: + users: + web: + password: leftover-plaintext + asserts: + - notExists: + path: spec.configuration.users["web/password_sha256_hex"] + documentSelector: + path: kind + value: ClickHouseInstallation + - notExists: + path: stringData.web + documentSelector: + path: kind + value: Secret + + - it: leaves out a value that is not a SHA-256 hex + template: templates/clickhouse.yaml + documentSelector: + path: kind + value: ClickHouseInstallation + set: + users: + web: {} + _accounts: + u4b5e57f6eb2f42b9039b3d1e13929295f231749c510cbe341cd68036d9af97e2: "*0123456789ABCDEF0123456789ABCDEF01234567" + asserts: + - notExists: + path: spec.configuration.users["web/password_sha256_hex"] + + - it: keeps only backup in -credentials, labelled not tenant visible + template: templates/clickhouse.yaml + documentSelector: + path: kind + value: Secret + set: + users: + web: {} + asserts: + - equal: + path: metadata.name + value: ch-test-credentials + - equal: + path: metadata.labels["internal.cozystack.io/tenantresource"] + value: "false" + - exists: + path: stringData.backup + - notExists: + path: stringData.web + + - it: preserves the backup password and keys a sidecar restart on its rotation + template: templates/clickhouse.yaml + set: + backup: + enabled: true + kubernetesProvider: + scheme: + "v1/Secret": + gvr: + version: "v1" + resource: "secrets" + namespaced: true + objects: + - kind: Secret + apiVersion: v1 + metadata: + name: ch-test-credentials + namespace: tenant-test + annotations: + credentials.cozystack.io/rotated: "2026-11-21T00:00:00Z" + data: + # base64 of "platform-backup" + backup: cGxhdGZvcm0tYmFja3Vw + asserts: + - equal: + path: stringData.backup + value: platform-backup + documentSelector: + path: kind + value: Secret + - equal: + path: spec.configuration.users["backup/password_sha256_hex"] + value: dde39b6ad76cd9704ad0f6c554950b313995547e4df6513f909ed693d5c73450 + documentSelector: + path: kind + value: ClickHouseInstallation + - equal: + path: spec.templates.podTemplates[0].metadata.annotations["credentials.cozystack.io/backup-rotated"] + value: "2026-11-21T00:00:00Z" + documentSelector: + path: kind + value: ClickHouseInstallation + + - it: adds no restart annotation before a rotation + template: templates/clickhouse.yaml + documentSelector: + path: kind + value: ClickHouseInstallation + set: + backup: + enabled: true + asserts: + - notExists: + path: spec.templates.podTemplates[0].metadata.annotations diff --git a/packages/apps/clickhouse/values.schema.json b/packages/apps/clickhouse/values.schema.json index 46f84a497..6fe521ed4 100644 --- a/packages/apps/clickhouse/values.schema.json +++ b/packages/apps/clickhouse/values.schema.json @@ -157,16 +157,12 @@ "default": 15 }, "users": { - "description": "Users configuration map.", + "description": "Users configuration map. Passwords are issued through the Cozystack credentials API: a mint on the user's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SHA-256, and a revoke retires the password without issuing one. A user can log in once a password has been minted, after the release has upgraded with it. The names `backup`, `default` and `clickhouse_operator` are reserved for platform accounts. A `password` key here is ignored.", "type": "object", "default": {}, "additionalProperties": { "type": "object", "properties": { - "password": { - "description": "Password for the user.", - "type": "string" - }, "readonly": { "description": "User is readonly (default: false).", "type": "boolean" diff --git a/packages/apps/clickhouse/values.yaml b/packages/apps/clickhouse/values.yaml index 07891079b..e4e749df9 100644 --- a/packages/apps/clickhouse/values.yaml +++ b/packages/apps/clickhouse/values.yaml @@ -94,18 +94,15 @@ logStorageSize: 2Gi logTTL: 15 ## @typedef {struct} User - User configuration. -## @field {string} [password] - Password for the user. ## @field {bool} [readonly] - User is readonly (default: false). -## @param {map[string]User} users - Users configuration map. +## @param {map[string]User} users - Users configuration map. Passwords are issued through the Cozystack credentials API: a mint on the user's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SHA-256, and a revoke retires the password without issuing one. A user can log in once a password has been minted, after the release has upgraded with it. The names `backup`, `default` and `clickhouse_operator` are reserved for platform accounts. A `password` key here is ignored. users: {} ## Example: ## users: -## user1: -## password: strongpassword +## user1: {} ## user2: ## readonly: true -## password: hackme ## ## diff --git a/packages/system/clickhouse-rd/cozyrds/clickhouse.yaml b/packages/system/clickhouse-rd/cozyrds/clickhouse.yaml index fd23668d9..ed13761c4 100644 --- a/packages/system/clickhouse-rd/cozyrds/clickhouse.yaml +++ b/packages/system/clickhouse-rd/cozyrds/clickhouse.yaml @@ -8,7 +8,7 @@ spec: singular: clickhouse plural: clickhouses openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of ClickHouse replicas.","type":"integer","default":2},"shards":{"description":"Number of ClickHouse shards.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each ClickHouse replica. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"ClickHouse major.minor version to deploy. Applies to both the ClickHouse server and ClickHouse Keeper images. Downgrading to an older major is unsafe (ClickHouse cannot read data written by a newer server and Keeper snapshots are not backward compatible) — only increase this value.","type":"string","default":"v24.9","enum":["v25.8","v25.3","v24.9"]},"logStorageSize":{"description":"Size of Persistent Volume for logs.","default":"2Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"logTTL":{"description":"TTL (expiration time) for `query_log` and `query_thread_log`.","type":"integer","default":15},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user.","type":"string"},"readonly":{"description":"User is readonly (default: false).","type":"boolean"}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"cleanupStrategy":{"description":"Legacy. Restic retention policy passed to the legacy CronJob (`restic forget …`). Unused by the Altinity strategy.","type":"string","default":"--keep-last=3 --keep-daily=3 --keep-within-weekly=1m"},"enabled":{"description":"Enable backup integration. Materialises the chart-emitted `-backup-s3` Secret consumed by the Altinity backup strategy and, when `schedule` is non-empty, also renders the legacy chart-managed CronJob.","type":"boolean","default":false},"endpoint":{"description":"DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar.","type":"string","default":""},"endpointCA":{"description":"CA bundle the sidecar trusts when the S3 endpoint's certificate is signed by a private CA (e.g. Cozystack's in-cluster SeaweedFS). Applies to both the per-tenant and the `useSystemBucket` flow, and to the `clickhouse-backup` sidecar only — the legacy `schedule` CronJob writes to S3 through restic and does not consume it, so a private-CA endpoint combined with `schedule` still fails TLS. Use the BackupClass flow for such an endpoint.","type":"object","default":{},"properties":{"key":{"description":"Key inside the Secret holding the PEM CA bundle. Defaults to `ca.crt`.","type":"string","default":"ca.crt"},"name":{"description":"Name of the Secret in the application namespace. Empty (default) mounts nothing and leaves the sidecar on the system trust store only.","type":"string","default":""}}},"resticPassword":{"description":"Legacy. Password for Restic backup encryption used by the legacy CronJob. Unused by the Altinity strategy.","type":"string","default":""},"s3AccessKey":{"description":"DEPRECATED. Tenants no longer supply S3 keys; the platform-managed Bucket Secret is the source of truth. Optional now so `useSystemBucket: true` tenants can omit it.","type":"string","default":""},"s3Bucket":{"description":"DEPRECATED. Optional; see `s3Region`.","type":"string","default":"s3.example.org/clickhouse-backups"},"s3CredentialsSecret":{"description":"DEPRECATED. Pre-existing Secret reference for the legacy chart-emitted sidecar. The platform flow projects `cozy-backups-creds` instead.","type":"object","default":{},"properties":{"accessKeyIDKey":{"description":"Key in the Secret holding the access key ID. Defaults to `accessKey`.","type":"string","default":""},"bucketKey":{"description":"Key in the Secret holding the bucket name. Defaults to `bucketName`.","type":"string","default":""},"endpointKey":{"description":"Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`.","type":"string","default":""},"name":{"description":"Name of the Secret in the application namespace. Empty means the chart materialises `-backup-s3` from the legacy `s3*` fields.","type":"string","default":""},"regionKey":{"description":"Key in the Secret holding the S3 region. Defaults to `region`.","type":"string","default":""},"secretAccessKeyKey":{"description":"Key in the Secret holding the secret access key. Defaults to `secretKey`.","type":"string","default":""}}},"s3PathOverride":{"description":"DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically.","type":"string","default":""},"s3Region":{"description":"DEPRECATED. Per-tenant S3 configuration is being phased out in favour of the platform-managed `cozy-default` BackupClass. Optional now so tenants on `useSystemBucket: true` can omit it.","type":"string","default":"us-east-1"},"s3SecretKey":{"description":"DEPRECATED. Optional; see `s3AccessKey`.","type":"string","default":""},"schedule":{"description":"Legacy. Cron schedule for the chart-emitted CronJob that runs the dump+restic backup. Empty (default) skips the legacy CronJob; recommended when a `BackupClass` + `Plan` from `backups.cozystack.io` already drives backup orchestration via the Altinity strategy.","type":"string","default":""},"useSystemBucket":{"description":"Opt-in: when true, the chart-emitted `-backup-s3` Secret is skipped and the `clickhouse-backup` sidecar reads bucket coordinates + S3 credentials from the platform-projected `cozy-backups-creds` Secret. `S3_PATH` is set to `/` for cross-tenant isolation. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill any `s3*` field below.","type":"boolean","default":false}}},"clickhouseKeeper":{"description":"ClickHouse Keeper configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Deploy ClickHouse Keeper for cluster coordination.","type":"boolean","default":true},"replicas":{"description":"Number of Keeper replicas.","type":"integer","default":3},"resourcesPreset":{"description":"Default sizing preset.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"1Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} + {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of ClickHouse replicas.","type":"integer","default":2},"shards":{"description":"Number of ClickHouse shards.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each ClickHouse replica. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"ClickHouse major.minor version to deploy. Applies to both the ClickHouse server and ClickHouse Keeper images. Downgrading to an older major is unsafe (ClickHouse cannot read data written by a newer server and Keeper snapshots are not backward compatible) — only increase this value.","type":"string","default":"v24.9","enum":["v25.8","v25.3","v24.9"]},"logStorageSize":{"description":"Size of Persistent Volume for logs.","default":"2Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"logTTL":{"description":"TTL (expiration time) for `query_log` and `query_thread_log`.","type":"integer","default":15},"users":{"description":"Users configuration map. Passwords are issued through the Cozystack credentials API: a mint on the user's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SHA-256, and a revoke retires the password without issuing one. A user can log in once a password has been minted, after the release has upgraded with it. The names `backup`, `default` and `clickhouse_operator` are reserved for platform accounts. A `password` key here is ignored.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"readonly":{"description":"User is readonly (default: false).","type":"boolean"}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"cleanupStrategy":{"description":"Legacy. Restic retention policy passed to the legacy CronJob (`restic forget …`). Unused by the Altinity strategy.","type":"string","default":"--keep-last=3 --keep-daily=3 --keep-within-weekly=1m"},"enabled":{"description":"Enable backup integration. Materialises the chart-emitted `-backup-s3` Secret consumed by the Altinity backup strategy and, when `schedule` is non-empty, also renders the legacy chart-managed CronJob.","type":"boolean","default":false},"endpoint":{"description":"DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar.","type":"string","default":""},"endpointCA":{"description":"CA bundle the sidecar trusts when the S3 endpoint's certificate is signed by a private CA (e.g. Cozystack's in-cluster SeaweedFS). Applies to both the per-tenant and the `useSystemBucket` flow, and to the `clickhouse-backup` sidecar only — the legacy `schedule` CronJob writes to S3 through restic and does not consume it, so a private-CA endpoint combined with `schedule` still fails TLS. Use the BackupClass flow for such an endpoint.","type":"object","default":{},"properties":{"key":{"description":"Key inside the Secret holding the PEM CA bundle. Defaults to `ca.crt`.","type":"string","default":"ca.crt"},"name":{"description":"Name of the Secret in the application namespace. Empty (default) mounts nothing and leaves the sidecar on the system trust store only.","type":"string","default":""}}},"resticPassword":{"description":"Legacy. Password for Restic backup encryption used by the legacy CronJob. Unused by the Altinity strategy.","type":"string","default":""},"s3AccessKey":{"description":"DEPRECATED. Tenants no longer supply S3 keys; the platform-managed Bucket Secret is the source of truth. Optional now so `useSystemBucket: true` tenants can omit it.","type":"string","default":""},"s3Bucket":{"description":"DEPRECATED. Optional; see `s3Region`.","type":"string","default":"s3.example.org/clickhouse-backups"},"s3CredentialsSecret":{"description":"DEPRECATED. Pre-existing Secret reference for the legacy chart-emitted sidecar. The platform flow projects `cozy-backups-creds` instead.","type":"object","default":{},"properties":{"accessKeyIDKey":{"description":"Key in the Secret holding the access key ID. Defaults to `accessKey`.","type":"string","default":""},"bucketKey":{"description":"Key in the Secret holding the bucket name. Defaults to `bucketName`.","type":"string","default":""},"endpointKey":{"description":"Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`.","type":"string","default":""},"name":{"description":"Name of the Secret in the application namespace. Empty means the chart materialises `-backup-s3` from the legacy `s3*` fields.","type":"string","default":""},"regionKey":{"description":"Key in the Secret holding the S3 region. Defaults to `region`.","type":"string","default":""},"secretAccessKeyKey":{"description":"Key in the Secret holding the secret access key. Defaults to `secretKey`.","type":"string","default":""}}},"s3PathOverride":{"description":"DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically.","type":"string","default":""},"s3Region":{"description":"DEPRECATED. Per-tenant S3 configuration is being phased out in favour of the platform-managed `cozy-default` BackupClass. Optional now so tenants on `useSystemBucket: true` can omit it.","type":"string","default":"us-east-1"},"s3SecretKey":{"description":"DEPRECATED. Optional; see `s3AccessKey`.","type":"string","default":""},"schedule":{"description":"Legacy. Cron schedule for the chart-emitted CronJob that runs the dump+restic backup. Empty (default) skips the legacy CronJob; recommended when a `BackupClass` + `Plan` from `backups.cozystack.io` already drives backup orchestration via the Altinity strategy.","type":"string","default":""},"useSystemBucket":{"description":"Opt-in: when true, the chart-emitted `-backup-s3` Secret is skipped and the `clickhouse-backup` sidecar reads bucket coordinates + S3 credentials from the platform-projected `cozy-backups-creds` Secret. `S3_PATH` is set to `/` for cross-tenant isolation. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill any `s3*` field below.","type":"boolean","default":false}}},"clickhouseKeeper":{"description":"ClickHouse Keeper configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Deploy ClickHouse Keeper for cluster coordination.","type":"boolean","default":true},"replicas":{"description":"Number of Keeper replicas.","type":"integer","default":3},"resourcesPreset":{"description":"Default sizing preset.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"1Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} release: prefix: clickhouse- labels: @@ -27,9 +27,7 @@ spec: keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "replicas"], ["spec", "shards"], ["spec", "resources"], ["spec", "resourcesPreset"], ["spec", "size"], ["spec", "storageClass"], ["spec", "version"], ["spec", "logStorageSize"], ["spec", "logTTL"], ["spec", "users"], ["spec", "backup"], ["spec", "backup", "enabled"], ["spec", "backup", "useSystemBucket"], ["spec", "backup", "s3Region"], ["spec", "backup", "s3Bucket"], ["spec", "backup", "endpoint"], ["spec", "backup", "s3PathOverride"], ["spec", "backup", "schedule"], ["spec", "backup", "cleanupStrategy"], ["spec", "backup", "s3AccessKey"], ["spec", "backup", "s3SecretKey"], ["spec", "backup", "resticPassword"], ["spec", "backup", "s3CredentialsSecret"], ["spec", "backup", "s3CredentialsSecret", "name"], ["spec", "backup", "s3CredentialsSecret", "bucketKey"], ["spec", "backup", "s3CredentialsSecret", "endpointKey"], ["spec", "backup", "s3CredentialsSecret", "regionKey"], ["spec", "backup", "s3CredentialsSecret", "accessKeyIDKey"], ["spec", "backup", "s3CredentialsSecret", "secretAccessKeyKey"], ["spec", "backup", "endpointCA"], ["spec", "backup", "endpointCA", "name"], ["spec", "backup", "endpointCA", "key"], ["spec", "clickhouseKeeper"], ["spec", "clickhouseKeeper", "enabled"], ["spec", "clickhouseKeeper", "size"], ["spec", "clickhouseKeeper", "resourcesPreset"], ["spec", "clickhouseKeeper", "replicas"], ["spec", "schedulingClass"]] secrets: exclude: [] - include: - - resourceNames: - - clickhouse-{{ .name }}-credentials + include: [] services: exclude: [] include: diff --git a/pkg/registry/apps/application/rest.go b/pkg/registry/apps/application/rest.go index 3c7c96097..60bf004c7 100644 --- a/pkg/registry/apps/application/rest.go +++ b/pkg/registry/apps/application/rest.go @@ -2365,8 +2365,9 @@ func (r *REST) warnRemovedKubernetesFields(ctx context.Context, app *appsv1alpha // change it. Warn so an operator editing it is told it has no effect instead of // getting a silent 200, and where the password comes from now. var removedUserPasswordKinds = map[string]string{ - postgresKind: mintedPasswordWarning, - mariadbKind: "spec.users[%q].password is ignored: passwords are auto-generated into the -credentials Secret and cannot be set from values. Read the current password from that Secret; editing this field has no effect.", + postgresKind: mintedPasswordWarning, + mariadbKind: "spec.users[%q].password is ignored: passwords are auto-generated into the -credentials Secret and cannot be set from values. Read the current password from that Secret; editing this field has no effect.", + clickhouseKind: mintedPasswordWarning, } // mintedPasswordWarning is the warning of a kind whose user passwords the @@ -2375,8 +2376,9 @@ var removedUserPasswordKinds = map[string]string{ const mintedPasswordWarning = "spec.users[%q].password is ignored: passwords are issued through the credentials API and cannot be set from values. Mint a new password on the user's Credential (credentials.core.cozystack.io, mint subresource); editing this field has no effect." const ( - postgresKind = "Postgres" - mariadbKind = "MariaDB" + clickhouseKind = "ClickHouse" + postgresKind = "Postgres" + mariadbKind = "MariaDB" ) // warnRemovedUserPasswords emits a client-facing admission warning for every diff --git a/pkg/registry/apps/application/rest_warn_removed_password_callsite_test.go b/pkg/registry/apps/application/rest_warn_removed_password_callsite_test.go index 1c65a2b54..ddf5d87b0 100644 --- a/pkg/registry/apps/application/rest_warn_removed_password_callsite_test.go +++ b/pkg/registry/apps/application/rest_warn_removed_password_callsite_test.go @@ -164,6 +164,7 @@ func TestWarnRemovedUserPasswords(t *testing.T) { }{ {"postgres warns", postgresKind, rawWithPassword, true}, {"mariadb warns", mariadbKind, rawWithPassword, true}, + {"clickhouse warns", clickhouseKind, rawWithPassword, true}, {"other kind stays quiet", "Redis", rawWithPassword, false}, {"no password stays quiet", postgresKind, `{"users":{"app":{}}}`, false}, {"warns on a good user despite a non-object user", postgresKind, `{"users":{"good":{"password":"x"},"bad":"str"}}`, true}, @@ -195,7 +196,7 @@ func TestWarnRemovedUserPasswords(t *testing.T) { // mint on the user's Credential: its -credentials Secret holds no user // password a tenant can read, so naming it sends the reader to a dead end. func TestWarnRemovedUserPasswords_PointsAtMint(t *testing.T) { - for _, kind := range []string{postgresKind} { + for _, kind := range []string{postgresKind, clickhouseKind} { t.Run(kind, func(t *testing.T) { r := &REST{kindName: kind} app := &appsv1alpha1.Application{Spec: &apiextv1.JSON{Raw: []byte(`{"users":{"app":{"password":"hackme"}}}`)}}