diff --git a/api/apps/v1alpha1/bucket/types.go b/api/apps/v1alpha1/bucket/types.go index 98e8f8551..2b3ad37f9 100644 --- a/api/apps/v1alpha1/bucket/types.go +++ b/api/apps/v1alpha1/bucket/types.go @@ -41,6 +41,8 @@ type ConfigSpec struct { } type User struct { + // Marks a platform account, such as the `system` user of the backup bucket, which backupstrategy-controller sets. Its keys stay in the `--credentials` Secret, which no tenant can read, and are never minted. Clearing it drops the chart-rendered BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted through its Credential. Leave it unset for your own users. + Platform bool `json:"platform,omitempty"` // Whether the user has read-only access. Readonly bool `json:"readonly,omitempty"` } diff --git a/packages/apps/bucket/README.md b/packages/apps/bucket/README.md index 8487c68c4..e14c50571 100644 --- a/packages/apps/bucket/README.md +++ b/packages/apps/bucket/README.md @@ -13,5 +13,6 @@ | `publicRead` | Serves the bucket's objects to anyone without credentials at `//`. Anonymous callers can read objects but cannot list the bucket or write to it. | `bool` | `false` | | `users` | Users configuration map. | `map[string]object` | `{}` | | `users[name].readonly` | Whether the user has read-only access. | `bool` | `false` | +| `users[name].platform` | Marks a platform account, such as the `system` user of the backup bucket, which backupstrategy-controller sets. Its keys stay in the `--credentials` Secret, which no tenant can read, and are never minted. Clearing it drops the chart-rendered BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted through its Credential. Leave it unset for your own users. | `bool` | `false` | | `schedulingClass` | 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. | `string` | `""` | diff --git a/packages/apps/bucket/templates/_accounts.tpl b/packages/apps/bucket/templates/_accounts.tpl new file mode 100644 index 000000000..de45a12c5 --- /dev/null +++ b/packages/apps/bucket/templates/_accounts.tpl @@ -0,0 +1,52 @@ +{{/* + Account naming, which must match pkg/credentials/account.MapName: the + credential of a user is ., where is the user + name lowercased with every character outside [a-z0-9-] replaced by "-". +*/}} +{{- define "bucket.accountName" -}} +{{- regexReplaceAll "[^a-z0-9-]" (lower .) "-" -}} +{{- end -}} + +{{/* + The BucketAccess of a tenant user, which also names the Secret the COSI + sidecar writes for it: -, as the chart named it before the + conversion, so that platform migration 71 hands the existing one, and its + keys, to the template; or - when - is not + a valid object name, since no BucketAccess was ever created under it. +*/}} +{{- define "bucket.accessName" -}} +{{- $root := index . 0 -}} +{{- $user := index . 1 -}} +{{- $legacy := printf "%s-%s" $root.Release.Name $user -}} +{{- if and (le (len $legacy) 253) (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" $legacy) -}} +{{- $legacy -}} +{{- else -}} +{{- printf "%s-%s" $root.Release.Name (include "bucket.accountName" $user) -}} +{{- end -}} +{{- end -}} + +{{/* + The BucketAccessClass a user's grant comes from: the storage pool's, and + its -readonly variant for a read-only user. +*/}} +{{- define "bucket.accessClass" -}} +{{- $root := index . 0 -}} +{{- $user := index . 1 -}} +{{- $root.Values._namespace.seaweedfs }}{{- if $root.Values.storagePool }}-{{ $root.Values.storagePool }}{{- end }}{{- if $user.readonly }}-readonly{{- end }} +{{- end -}} + +{{- define "bucket.accountsGuard" -}} +{{- $seen := dict -}} +{{- range $user, $u := .Values.users -}} + {{- if not (default false $u.platform) -}} + {{- $mapped := include "bucket.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 -}} +{{- end -}} diff --git a/packages/apps/bucket/templates/bucketclaim.yaml b/packages/apps/bucket/templates/bucketclaim.yaml index 0be116e15..7c06f51b3 100644 --- a/packages/apps/bucket/templates/bucketclaim.yaml +++ b/packages/apps/bucket/templates/bucketclaim.yaml @@ -44,18 +44,25 @@ spec: bucketClassName: {{ $seaweedfs }}{{- if $pool }}-{{ $pool }}{{- end }}{{- if .Values.locking }}-lock{{- if eq (toString .Values.lockingDefaultRetention) "false" }}-noretention{{- end }}{{- end }} protocols: - s3 +{{- /* + Only a platform user's BucketAccess is rendered here. A tenant user's is + created by cozystack-controller from its CredentialTemplate + (credentials.yaml), so that a mint can re-create it and a revoke delete it. +*/}} {{- range $name, $user := .Values.users }} +{{- if default false $user.platform }} --- apiVersion: objectstorage.k8s.io/v1alpha1 kind: BucketAccess metadata: name: {{ $.Release.Name }}-{{ $name }} spec: - bucketAccessClassName: {{ $seaweedfs }}{{- if $pool }}-{{ $pool }}{{- end }}{{- if $user.readonly }}-readonly{{- end }} + bucketAccessClassName: {{ include "bucket.accessClass" (list $ $user) }} bucketClaimName: {{ $.Release.Name }} credentialsSecretName: {{ $.Release.Name }}-{{ $name }} protocol: s3 {{- end }} +{{- end }} {{- if .Values.publicRead }} {{- if hasKey .Values.users "public-read" }} {{- fail "publicRead creates the BucketAccess -public-read, which the user \"public-read\" already owns: rename that user" }} diff --git a/packages/apps/bucket/templates/credentials.yaml b/packages/apps/bucket/templates/credentials.yaml new file mode 100644 index 000000000..7888f8e30 --- /dev/null +++ b/packages/apps/bucket/templates/credentials.yaml @@ -0,0 +1,29 @@ +{{- /* + One CredentialTemplate per tenant user: the account the Cozystack + credentials API mints and revokes through. The COSI driver issues a user's + keys, so the template names the BucketAccess whose grant issues them, and + cozystack-controller creates that BucketAccess, copies its keys into the + account Secret ..account, re-creates it on a mint and + deletes it on a revoke. The keys are stored as the driver issues them, so + the format is plaintext. The chart renders no BucketAccess and no key for + these users. A platform user keeps its chart-rendered BucketAccess in + bucketclaim.yaml. +*/ -}} +{{- include "bucket.accountsGuard" $ }} +{{- range $user, $u := .Values.users }} +{{- if not (default false $u.platform) }} +--- +apiVersion: cozystack.io/v1alpha1 +kind: CredentialTemplate +metadata: + name: {{ printf "%s.%s" $.Release.Name (include "bucket.accountName" $user) | quote }} +spec: + username: {{ $user | quote }} + format: + name: plaintext + bucketAccess: + name: {{ include "bucket.accessName" (list $ $user) | quote }} + bucketClaimName: {{ $.Release.Name | quote }} + bucketAccessClassName: {{ include "bucket.accessClass" (list $ $u) | quote }} +{{- end }} +{{- end }} diff --git a/packages/apps/bucket/tests/credential_templates_test.yaml b/packages/apps/bucket/tests/credential_templates_test.yaml new file mode 100644 index 000000000..eed9a9134 --- /dev/null +++ b/packages/apps/bucket/tests/credential_templates_test.yaml @@ -0,0 +1,143 @@ +suite: bucket credential templates + +templates: + - templates/credentials.yaml + - templates/bucketclaim.yaml + +release: + name: bucket-photos + namespace: tenant-foo + +set: + _namespace: + seaweedfs: tenant-root + +tests: + - it: renders one engine-issued template per tenant user, naming the BucketAccess the controller creates + template: templates/credentials.yaml + set: + users: + web: {} + asserts: + - hasDocuments: + count: 1 + - isKind: + of: CredentialTemplate + - equal: + path: metadata.name + value: bucket-photos.web + - equal: + path: spec + value: + username: web + format: + name: plaintext + bucketAccess: + name: bucket-photos-web + bucketClaimName: bucket-photos + bucketAccessClassName: tenant-root + + - it: takes the read-only class of the storage pool for a read-only user + template: templates/credentials.yaml + set: + storagePool: fast + users: + reader: + readonly: true + asserts: + - equal: + path: spec.bucketAccess.bucketAccessClassName + value: tenant-root-fast-readonly + + - it: renders no BucketAccess for a tenant user + template: templates/bucketclaim.yaml + set: + users: + web: {} + asserts: + - hasDocuments: + count: 1 + - isKind: + of: BucketClaim + + - it: keeps a platform user's BucketAccess in the chart and gives it no template + set: + users: + system: + platform: true + asserts: + - hasDocuments: + count: 0 + template: templates/credentials.yaml + - hasDocuments: + count: 2 + template: templates/bucketclaim.yaml + - equal: + path: spec + value: + bucketAccessClassName: tenant-root + bucketClaimName: bucket-photos + credentialsSecretName: bucket-photos-system + protocol: s3 + template: templates/bucketclaim.yaml + documentSelector: + path: kind + value: BucketAccess + + # The pre-conversion chart named a user's BucketAccess -, + # and migration 71 hands that one over by name, so a user name that is a + # valid object name keeps it. Any other one never had a BucketAccess and + # takes the account name. + - it: names the BucketAccess as the pre-conversion chart did when that name is valid + template: templates/credentials.yaml + set: + users: + archive.v2: {} + asserts: + - equal: + path: metadata.name + value: bucket-photos.archive-v2 + - equal: + path: spec.bucketAccess.name + value: bucket-photos-archive.v2 + + - it: names the BucketAccess after the account when the user name is not a valid object name + template: templates/credentials.yaml + set: + users: + Web_Uploads: {} + asserts: + - equal: + path: metadata.name + value: bucket-photos.web-uploads + - equal: + path: spec.bucketAccess.name + value: bucket-photos-web-uploads + + - it: refuses a user whose account name is not a valid name + template: templates/credentials.yaml + 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 + template: templates/credentials.yaml + set: + users: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: {} + asserts: + - failedTemplate: + errorPattern: at most 63 characters + + - it: refuses two users that map to one account + template: templates/credentials.yaml + set: + users: + Web: {} + web: {} + asserts: + - failedTemplate: + errorPattern: both map to the account name "web" diff --git a/packages/apps/bucket/tests/public_read_test.yaml b/packages/apps/bucket/tests/public_read_test.yaml index 1bdf5d82b..87370ba30 100644 --- a/packages/apps/bucket/tests/public_read_test.yaml +++ b/packages/apps/bucket/tests/public_read_test.yaml @@ -61,16 +61,18 @@ tests: path: spec.bucketAccessClassName value: tenant-root-public - - it: keeps the users' BucketAccesses next to the public one + - it: renders only the platform users' BucketAccesses next to the public one set: publicRead: true users: app: {} reader: readonly: true + system: + platform: true asserts: - hasDocuments: - count: 4 + count: 3 - it: refuses a user that would own the public BucketAccess name set: diff --git a/packages/apps/bucket/values.schema.json b/packages/apps/bucket/values.schema.json index 1e1311785..d7aa1d15d 100644 --- a/packages/apps/bucket/values.schema.json +++ b/packages/apps/bucket/values.schema.json @@ -37,6 +37,10 @@ "additionalProperties": { "type": "object", "properties": { + "platform": { + "description": "Marks a platform account, such as the `system` user of the backup bucket, which backupstrategy-controller sets. Its keys stay in the `\u003cbucket\u003e-\u003cuser\u003e-credentials` Secret, which no tenant can read, and are never minted. Clearing it drops the chart-rendered BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted through its Credential. Leave it unset for your own users.", + "type": "boolean" + }, "readonly": { "description": "Whether the user has read-only access.", "type": "boolean" diff --git a/packages/apps/bucket/values.yaml b/packages/apps/bucket/values.yaml index 5a6c92ece..5aafb5945 100644 --- a/packages/apps/bucket/values.yaml +++ b/packages/apps/bucket/values.yaml @@ -16,6 +16,7 @@ publicRead: false ## @typedef {struct} User - Bucket user configuration. ## @field {bool} [readonly] - Whether the user has read-only access. +## @field {bool} [platform] - Marks a platform account, such as the `system` user of the backup bucket, which backupstrategy-controller sets. Its keys stay in the `--credentials` Secret, which no tenant can read, and are never minted. Clearing it drops the chart-rendered BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted through its Credential. Leave it unset for your own users. ## @param {map[string]User} users - Users configuration map. users: {} diff --git a/packages/system/backupstrategy-controller/templates/bucket.yaml b/packages/system/backupstrategy-controller/templates/bucket.yaml index 9cca0f9e8..9f8395e15 100644 --- a/packages/system/backupstrategy-controller/templates/bucket.yaml +++ b/packages/system/backupstrategy-controller/templates/bucket.yaml @@ -6,6 +6,11 @@ metadata: namespace: {{ .Values.backupStorage.namespace }} spec: users: + # A platform user: its keys stay in the bucket-system Secret this + # controller reads (backupStorage.systemSecretName), which no tenant + # role selects, and it gets no CredentialTemplate whose mint would + # rotate them under every default backup. system: readonly: false + platform: true {{- end }} diff --git a/packages/system/backupstrategy-controller/tests/rendering_test.yaml b/packages/system/backupstrategy-controller/tests/rendering_test.yaml index d89b4ec0d..11778559e 100644 --- a/packages/system/backupstrategy-controller/tests/rendering_test.yaml +++ b/packages/system/backupstrategy-controller/tests/rendering_test.yaml @@ -42,6 +42,14 @@ tests: path: metadata.namespace value: tenant-root template: templates/bucket.yaml + # The system user is a platform account: its keys stay in the Secret + # this controller reads, and no tenant credential can rotate them. + - equal: + path: spec.users.system + value: + readonly: false + platform: true + template: templates/bucket.yaml - hasDocuments: count: 0 template: templates/strategy-cnpg-default.yaml diff --git a/packages/system/bucket-rd/cozyrds/bucket.yaml b/packages/system/bucket-rd/cozyrds/bucket.yaml index 290141d75..720456ef9 100644 --- a/packages/system/bucket-rd/cozyrds/bucket.yaml +++ b/packages/system/bucket-rd/cozyrds/bucket.yaml @@ -8,7 +8,7 @@ spec: plural: buckets singular: bucket openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"locking":{"description":"Provisions bucket from the `-lock` BucketClass (with object lock enabled).","type":"boolean","default":false},"lockingDefaultRetention":{"description":"With `locking`, keeps the default retention of the `-lock` BucketClass (COMPLIANCE, 365 days). Set to `false` to provision from the `-lock-noretention` BucketClass instead: Object Lock is enabled with no default retention, and retention is then set on the bucket or per object through the S3 API. Read at creation only.","type":"boolean","default":true},"storagePool":{"description":"Selects a specific BucketClass by storage pool name.","type":"string","default":"","x-cozystack-options":{"source":"storagepool"}},"ui":{"description":"Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `.`. Set to `false` to run the bucket without them.","type":"boolean","default":true},"publicRead":{"description":"Serves the bucket's objects to anyone without credentials at `//`. Anonymous callers can read objects but cannot list the bucket or write to it.","type":"boolean","default":false},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"readonly":{"description":"Whether the user has read-only access.","type":"boolean"}}}},"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":{"locking":{"description":"Provisions bucket from the `-lock` BucketClass (with object lock enabled).","type":"boolean","default":false},"lockingDefaultRetention":{"description":"With `locking`, keeps the default retention of the `-lock` BucketClass (COMPLIANCE, 365 days). Set to `false` to provision from the `-lock-noretention` BucketClass instead: Object Lock is enabled with no default retention, and retention is then set on the bucket or per object through the S3 API. Read at creation only.","type":"boolean","default":true},"storagePool":{"description":"Selects a specific BucketClass by storage pool name.","type":"string","default":"","x-cozystack-options":{"source":"storagepool"}},"ui":{"description":"Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `.`. Set to `false` to run the bucket without them.","type":"boolean","default":true},"publicRead":{"description":"Serves the bucket's objects to anyone without credentials at `//`. Anonymous callers can read objects but cannot list the bucket or write to it.","type":"boolean","default":false},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"platform":{"description":"Marks a platform account, such as the `system` user of the backup bucket, which backupstrategy-controller sets. Its keys stay in the `--credentials` Secret, which no tenant can read, and are never minted. Clearing it drops the chart-rendered BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted through its Credential. Leave it unset for your own users.","type":"boolean"},"readonly":{"description":"Whether the user has read-only access.","type":"boolean"}}}},"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: bucket- labels: diff --git a/packages/system/bucket/templates/user-credentials.yaml b/packages/system/bucket/templates/user-credentials.yaml index a45320254..30acc89db 100644 --- a/packages/system/bucket/templates/user-credentials.yaml +++ b/packages/system/bucket/templates/user-credentials.yaml @@ -36,23 +36,46 @@ to every bucket needs a controller that owns them and is tracked separately. */}} +{{- /* + What the Secret holds depends on who consumes the user. A tenant user's keys + live in the account Secret of its CredentialTemplate and are shown only by a + mint, so its Secret here carries the endpoint and bucket name, which are not + secret. A platform user (users..platform) has no template: its Secret + keeps the keys for the platform component that reads it, and is labelled so + the tenant Secret view and the dashboard leave it out. +*/}} {{- range $name, $user := .Values.users }} {{- $secretName := printf "%s-%s" $.Values.bucketName $name }} {{- $existingSecret := lookup "v1" "Secret" $.Release.Namespace $secretName }} {{- if $existingSecret }} {{- $bucketInfo := fromJson (b64dec (index $existingSecret.data "BucketInfo")) }} +{{- $platform := default false $user.platform }} --- apiVersion: v1 kind: Secret metadata: name: {{ $secretName }}-credentials labels: + {{- if $platform }} + internal.cozystack.io/tenantresource: "false" + {{- else }} apps.cozystack.io/user-secret: "true" + {{- end }} type: Opaque -stringData: - accessKey: {{ index $bucketInfo.spec.secretS3 "accessKeyID" | quote }} - secretKey: {{ index $bucketInfo.spec.secretS3 "accessSecretKey" | quote }} - endpoint: {{ index $bucketInfo.spec.secretS3 "endpoint" | trimPrefix "https://" | trimPrefix "http://" | quote }} - bucketName: {{ index $bucketInfo.spec "bucketName" | quote }} +{{- /* + data rather than stringData: Helm's three-way merge removes a live key only + when the previous manifest named it, and a stringData key never appears in + data, so a key dropped from stringData stays in the Secret. Rendered as + data, a key this chart stops emitting is removed on the upgrade that drops + it. The keys the stringData chart left on tenant users are stripped by + platform migration 71. +*/}} +data: + {{- if $platform }} + accessKey: {{ index $bucketInfo.spec.secretS3 "accessKeyID" | b64enc | quote }} + secretKey: {{ index $bucketInfo.spec.secretS3 "accessSecretKey" | b64enc | quote }} + {{- end }} + endpoint: {{ index $bucketInfo.spec.secretS3 "endpoint" | trimPrefix "https://" | trimPrefix "http://" | b64enc | quote }} + bucketName: {{ index $bucketInfo.spec "bucketName" | b64enc | quote }} {{- end }} {{- end }} diff --git a/packages/system/bucket/tests/user_credentials_test.yaml b/packages/system/bucket/tests/user_credentials_test.yaml index c0c4a1634..a59124275 100644 --- a/packages/system/bucket/tests/user_credentials_test.yaml +++ b/packages/system/bucket/tests/user_credentials_test.yaml @@ -78,3 +78,77 @@ tests: - equal: path: metadata.name value: bucket-cozy-backups-ui + + # With the COSI Secrets present (kubernetesProvider), what the per-user + # Secret holds depends on who consumes the user: a tenant user's keys live + # in its account Secret and are shown only by a mint, a platform user keeps + # them here, hidden from tenants. + - it: "a tenant user's Secret carries the endpoint and bucket name, no keys" + templates: + - templates/user-credentials.yaml + set: + <<: *base + users: + web: {} + kubernetesProvider: &cosiSecrets + scheme: + "v1/Secret": + gvr: + version: "v1" + resource: "secrets" + namespaced: true + objects: + - kind: Secret + apiVersion: v1 + metadata: + name: bucket-cozy-backups-web + namespace: tenant-root + data: + BucketInfo: eyJtZXRhZGF0YSI6eyJuYW1lIjoiYmMtdWlkIn0sInNwZWMiOnsiYnVja2V0TmFtZSI6ImJ1Y2tldC1jbGFpbS11aWQiLCJzZWNyZXRTMyI6eyJlbmRwb2ludCI6Imh0dHBzOi8vczMuZXhhbXBsZS5vcmciLCJhY2Nlc3NLZXlJRCI6IkFLSUFURVNUIiwiYWNjZXNzU2VjcmV0S2V5IjoidGVzdC1zZWNyZXQifX19 + - kind: Secret + apiVersion: v1 + metadata: + name: bucket-cozy-backups-system + namespace: tenant-root + data: + BucketInfo: eyJtZXRhZGF0YSI6eyJuYW1lIjoiYmMtdWlkIn0sInNwZWMiOnsiYnVja2V0TmFtZSI6ImJ1Y2tldC1jbGFpbS11aWQiLCJzZWNyZXRTMyI6eyJlbmRwb2ludCI6Imh0dHBzOi8vczMuZXhhbXBsZS5vcmciLCJhY2Nlc3NLZXlJRCI6IkFLSUFURVNUIiwiYWNjZXNzU2VjcmV0S2V5IjoidGVzdC1zZWNyZXQifX19 + asserts: + - hasDocuments: + count: 1 + - equal: + path: metadata.labels + value: + apps.cozystack.io/user-secret: "true" + - equal: + path: data + value: + endpoint: czMuZXhhbXBsZS5vcmc= + bucketName: YnVja2V0LWNsYWltLXVpZA== + # Rendered as data, so a key the chart stops emitting is removed by + # Helm's three-way merge on the upgrade that drops it. + - notExists: + path: stringData + + - it: "a platform user's Secret keeps the keys and is hidden from tenants" + templates: + - templates/user-credentials.yaml + set: + <<: *base + users: + system: + platform: true + kubernetesProvider: *cosiSecrets + asserts: + - hasDocuments: + count: 1 + - equal: + path: metadata.labels + value: + internal.cozystack.io/tenantresource: "false" + - equal: + path: data + value: + accessKey: QUtJQVRFU1Q= + secretKey: dGVzdC1zZWNyZXQ= + endpoint: czMuZXhhbXBsZS5vcmc= + bucketName: YnVja2V0LWNsYWltLXVpZA==