From 4b8eaffa530da5e88b2c57fc650b10b9d741104c Mon Sep 17 00:00:00 2001 From: Myasnikov Daniil Date: Thu, 3 Dec 2026 10:03:17 +0000 Subject: [PATCH] security(apps): quote and validate tenant values in chart templates Application values reach chart templates as strings, maps and lists, and several templates rendered them as-is. Values are now quoted or converted to their type where they are rendered, map keys used as names or config keys are checked against what their target accepts, hook Jobs read their data from environment variables, and values handed to upstream charts are passed in the form those charts expect. cozy-lib gains cozy-lib.yaml.toYaml and cozy-lib.yaml.fromYaml, which fail the render on a value they cannot encode or decode instead of returning an empty result. external-dns GoDaddy credentials move from args to a Secret. Values that were valid before keep rendering: NATS units, restic short keep flags, MongoDB database names by MongoDB's own rule, uppercase and IPv6 VPN hosts, bootbox hostnames that are subdomains, netmask whitelists, bracketed IPv6 registries for the Talos installer, time zones and intervals in the MongoDB backup schedule. Co-authored-by: Timofei Larkin Assisted-by: LLM Signed-off-by: Myasnikov Daniil --- api/apps/v1alpha1/bucket/types.go | 2 + api/apps/v1alpha1/clickhouse/types.go | 22 +++ api/apps/v1alpha1/foundationdb/types.go | 9 + api/apps/v1alpha1/harbor/types.go | 4 + api/apps/v1alpha1/kafka/types.go | 4 + api/apps/v1alpha1/kubernetes/types.go | 10 ++ api/apps/v1alpha1/kubernetesnodes/types.go | 4 + api/apps/v1alpha1/mariadb/types.go | 6 + api/apps/v1alpha1/mongodb/types.go | 9 + api/apps/v1alpha1/nats/types.go | 2 + api/apps/v1alpha1/openbao/types.go | 2 + api/apps/v1alpha1/opensearch/types.go | 2 + api/apps/v1alpha1/postgresql/types.go | 21 +++ api/apps/v1alpha1/qdrant/types.go | 2 + api/apps/v1alpha1/rabbitmq/types.go | 2 + api/apps/v1alpha1/redis/types.go | 2 + api/apps/v1alpha1/tenant/types.go | 4 + api/apps/v1alpha1/valkey/types.go | 2 + api/apps/v1alpha1/vmdisk/types.go | 6 + api/apps/v1alpha1/vminstance/types.go | 14 ++ api/apps/v1alpha1/vpc/types.go | 9 + api/apps/v1alpha1/vpn/types.go | 4 +- hack/app-cleanup-hooks_test.bats | 64 ++++++- hack/kafka-migration-hook.bats | 60 ++++++- hack/talos-reconcile-heredoc_test.bats | 53 +++++- hack/tenant-values-line-break_test.bats | 92 ++++++++++ .../apps/bucket/templates/bucketclaim.yaml | 17 +- .../apps/bucket/templates/helmrelease.yaml | 2 +- .../bucket/tests/helmrelease_users_test.yaml | 28 +++ packages/apps/bucket/values.schema.json | 2 + packages/apps/bucket/values.yaml | 2 + .../clickhouse/templates/backup-cronjob.yaml | 4 +- .../clickhouse/templates/backup-secret.yaml | 6 +- .../apps/clickhouse/templates/chkeeper.yaml | 4 +- .../apps/clickhouse/templates/clickhouse.yaml | 23 ++- .../clickhouse/templates/workloadmonitor.yaml | 4 +- .../tests/backup_cleanup_strategy_test.yaml | 75 ++++++++ packages/apps/clickhouse/values.schema.json | 50 ++++-- packages/apps/clickhouse/values.yaml | 22 +++ .../apps/foundationdb/templates/backup.yaml | 6 +- .../apps/foundationdb/templates/cluster.yaml | 20 +-- packages/apps/foundationdb/values.schema.json | 17 +- packages/apps/foundationdb/values.yaml | 9 + packages/apps/harbor/templates/harbor.yaml | 20 +-- .../apps/harbor/templates/hooks/cleanup.yaml | 3 +- .../apps/harbor/tests/cleanup_hook_test.yaml | 29 ++- packages/apps/harbor/values.schema.json | 6 +- packages/apps/harbor/values.yaml | 4 + .../apps/kafka/templates/migration-hook.yaml | 168 +++++++++--------- packages/apps/kafka/templates/topics.yaml | 17 +- .../apps/kafka/tests/migration-hook_test.yaml | 65 +++---- packages/apps/kafka/tests/topics_test.yaml | 17 ++ packages/apps/kafka/values.schema.json | 6 +- packages/apps/kafka/values.yaml | 4 + .../templates/_talosconfigtemplate.tpl | 16 +- .../kubernetes-nodes/templates/nodegroup.yaml | 12 +- .../apps/kubernetes-nodes/values.schema.json | 8 +- packages/apps/kubernetes-nodes/values.yaml | 4 + .../templates/ccm-proxmox/controller.yaml | 2 +- .../apps/kubernetes/templates/cluster.yaml | 20 ++- .../templates/csi-proxmox/controller.yaml | 2 +- .../helmreleases/cert-manager-crds.yaml | 3 +- .../templates/helmreleases/cert-manager.yaml | 2 +- .../templates/helmreleases/cilium.yaml | 2 +- .../templates/helmreleases/coredns.yaml | 2 +- .../templates/helmreleases/csi-proxmox.yaml | 23 +++ .../templates/helmreleases/gpu-operator.yaml | 2 +- .../templates/helmreleases/hami.yaml | 2 +- .../templates/helmreleases/ingress-nginx.yaml | 2 +- .../helmreleases/monitoring-agents.yaml | 2 +- .../templates/helmreleases/ouroboros.yaml | 2 +- .../templates/helmreleases/velero.yaml | 2 +- .../helmreleases/vertical-pod-autoscaler.yaml | 2 +- .../templates/oidc-authn-config.yaml | 3 +- .../kubernetes/templates/oidc-rbac-job.yaml | 12 +- .../addons_values_override_keys_test.yaml | 45 +++++ .../tests/apiserver_authentication_test.yaml | 19 ++ .../csi_proxmox_storage_class_input_test.yaml | 90 ++++++++++ .../tests/kamaji_managed_args_job_test.yaml | 6 +- packages/apps/kubernetes/values.schema.json | 18 +- packages/apps/kubernetes/values.yaml | 10 ++ .../mariadb/templates/backup-cronjob.yaml | 4 +- .../apps/mariadb/templates/backup-secret.yaml | 6 +- packages/apps/mariadb/templates/mariadb.yaml | 6 +- .../apps/mariadb/templates/regsecret.yaml | 5 +- .../mariadb/templates/workloadmonitor.yaml | 2 +- .../tests/backup_cleanup_strategy_test.yaml | 75 ++++++++ packages/apps/mariadb/values.schema.json | 14 +- packages/apps/mariadb/values.yaml | 6 + packages/apps/mongodb/templates/mongodb.yaml | 37 ++-- packages/apps/mongodb/templates/restore.yaml | 4 +- .../mongodb/tests/database_name_test.yaml | 59 ++++++ packages/apps/mongodb/tests/mongodb_test.yaml | 63 +++++++ packages/apps/mongodb/values.schema.json | 21 ++- packages/apps/mongodb/values.yaml | 9 + packages/apps/nats/templates/_config.tpl | 65 +++++++ packages/apps/nats/templates/nats.yaml | 14 +- .../apps/nats/tests/config_merge_test.yaml | 75 ++++++++ packages/apps/nats/values.schema.json | 2 + packages/apps/nats/values.yaml | 2 + packages/apps/openbao/templates/openbao.yaml | 14 +- .../openbao/templates/workloadmonitor.yaml | 2 +- packages/apps/openbao/values.schema.json | 2 + packages/apps/openbao/values.yaml | 2 + .../apps/opensearch/templates/opensearch.yaml | 10 +- packages/apps/opensearch/templates/users.yaml | 6 +- packages/apps/opensearch/values.schema.json | 2 + packages/apps/opensearch/values.yaml | 2 + packages/apps/postgres/templates/db.yaml | 59 +++--- .../apps/postgres/templates/regsecret.yaml | 5 +- .../postgres/tests/backup_storage_test.yaml | 3 +- .../postgres/tests/restore_adoption_test.yaml | 6 +- packages/apps/postgres/values.schema.json | 47 +++-- packages/apps/postgres/values.yaml | 21 +++ packages/apps/qdrant/templates/qdrant.yaml | 6 +- .../qdrant/templates/workloadmonitor.yaml | 2 +- packages/apps/qdrant/values.schema.json | 2 + packages/apps/qdrant/values.yaml | 2 + .../apps/rabbitmq/templates/rabbitmq.yaml | 26 +-- .../rabbitmq/templates/workloadmonitor.yaml | 2 +- packages/apps/rabbitmq/values.schema.json | 2 + packages/apps/rabbitmq/values.yaml | 2 + .../apps/redis/templates/redisfailover.yaml | 12 +- packages/apps/redis/values.schema.json | 2 + packages/apps/redis/values.yaml | 2 + .../tcp-balancer/templates/configmap.yaml | 12 ++ .../tests/haproxy-config_test.yaml | 22 +++ packages/apps/tenant/templates/namespace.yaml | 4 +- packages/apps/tenant/values.schema.json | 8 +- packages/apps/tenant/values.yaml | 4 + .../apps/valkey/templates/valkeyfailover.yaml | 8 +- packages/apps/valkey/values.schema.json | 2 + packages/apps/valkey/values.yaml | 2 + packages/apps/vm-disk/templates/dv.yaml | 4 +- .../vm-disk/templates/pvc-resize-hook.yaml | 11 +- packages/apps/vm-disk/values.schema.json | 8 +- packages/apps/vm-disk/values.yaml | 6 + .../apps/vm-instance/templates/secret.yaml | 6 +- .../vm-instance/templates/vm-update-hook.yaml | 45 +++-- packages/apps/vm-instance/templates/vm.yaml | 22 +-- .../tests/instancetype_resources_test.yaml | 15 +- .../vm-instance/tests/portclaim_test.yaml | 9 +- .../vm-instance/tests/vpc_cozyplane_test.yaml | 11 +- packages/apps/vm-instance/values.schema.json | 20 ++- packages/apps/vm-instance/values.yaml | 14 ++ packages/apps/vpc/templates/vpc.yaml | 14 +- packages/apps/vpc/values.schema.json | 21 ++- packages/apps/vpc/values.yaml | 9 + packages/apps/vpn/README.md | 2 +- packages/apps/vpn/templates/secret.yaml | 53 +++--- packages/apps/vpn/tests/host_guard_test.yaml | 43 +++++ packages/apps/vpn/values.schema.json | 6 +- packages/apps/vpn/values.yaml | 4 +- packages/extra/bootbox/README.md | 2 +- packages/extra/bootbox/templates/_helpers.tpl | 18 ++ .../bootbox/templates/matchbox/ingress.yaml | 7 +- .../bootbox/templates/matchbox/machines.yaml | 15 +- .../bootbox/tests/machine_hostname_test.yaml | 51 ++++++ packages/extra/bootbox/values.schema.json | 9 +- packages/extra/bootbox/values.yaml | 5 +- packages/extra/etcd/values.schema.json | 7 +- packages/extra/etcd/values.yaml | 3 + packages/extra/external-dns/README.md | 16 +- .../external-dns/templates/external-dns.yaml | 75 ++++++-- .../extra/external-dns/tests/args_test.yaml | 83 +++++++++ .../extra/external-dns/values.schema.json | 6 +- packages/extra/external-dns/values.yaml | 6 +- .../extra/ingress/templates/_whitelist.tpl | 10 ++ .../ingress/templates/nginx-ingress.yaml | 2 +- .../extra/monitoring/templates/_helpers.tpl | 65 +++++++ .../monitoring/templates/helmrelease.yaml | 10 +- .../monitoring/tests/helmrelease_test.yaml | 58 ++++++ packages/extra/monitoring/values.schema.json | 57 ++++-- packages/extra/monitoring/values.yaml | 25 +++ .../extra/seaweedfs/templates/_whitelist.tpl | 10 ++ .../templates/client/cosi-deployment.yaml | 4 +- .../extra/seaweedfs/templates/ingress.yaml | 4 +- .../extra/seaweedfs/templates/seaweedfs.yaml | 61 ++++--- .../tests/db_storage_class_test.yaml | 7 +- .../tests/volume_storage_class_test.yaml | 46 ++--- .../tests/zone_node_selector_test.yaml | 53 ++++++ packages/extra/seaweedfs/values.schema.json | 32 +++- packages/extra/seaweedfs/values.yaml | 14 ++ .../library/cozy-lib/templates/_affinity.tpl | 24 +++ packages/library/cozy-lib/templates/_etcd.tpl | 10 +- .../library/cozy-lib/templates/_resources.tpl | 6 +- packages/library/cozy-lib/templates/_yaml.tpl | 70 ++++++++ .../system/bootbox-rd/cozyrds/bootbox.yaml | 2 +- packages/system/bucket-rd/cozyrds/bucket.yaml | 2 +- .../clickhouse-rd/cozyrds/clickhouse.yaml | 2 +- packages/system/etcd-rd/cozyrds/etcd.yaml | 2 +- .../external-dns-rd/cozyrds/external-dns.yaml | 2 +- .../foundationdb-rd/cozyrds/foundationdb.yaml | 2 +- packages/system/harbor-rd/cozyrds/harbor.yaml | 2 +- packages/system/kafka-rd/cozyrds/kafka.yaml | 2 +- .../cozyrds/kubernetes-nodes.yaml | 2 +- .../kubernetes-rd/cozyrds/kubernetes.yaml | 2 +- .../system/mariadb-rd/cozyrds/mariadb.yaml | 2 +- .../system/mongodb-rd/cozyrds/mongodb.yaml | 2 +- .../monitoring-agents/templates/vmagent.yaml | 2 +- .../tests/vmagent_external_labels_test.yaml | 17 ++ .../monitoring-rd/cozyrds/monitoring.yaml | 2 +- .../monitoring/templates/vm/vmagent.yaml | 2 +- .../tests/vmagent_external_labels_test.yaml | 19 ++ packages/system/nats-rd/cozyrds/nats.yaml | 2 +- .../system/openbao-rd/cozyrds/openbao.yaml | 2 +- .../opensearch-rd/cozyrds/opensearch.yaml | 2 +- .../system/postgres-rd/cozyrds/postgres.yaml | 2 +- packages/system/qdrant-rd/cozyrds/qdrant.yaml | 2 +- .../system/rabbitmq-rd/cozyrds/rabbitmq.yaml | 2 +- packages/system/redis-rd/cozyrds/redis.yaml | 2 +- .../seaweedfs-rd/cozyrds/seaweedfs.yaml | 2 +- packages/system/tenant-rd/cozyrds/tenant.yaml | 2 +- packages/system/valkey-rd/cozyrds/valkey.yaml | 2 +- .../cozyrds/virtualprivatecloud.yaml | 2 +- .../system/vm-disk-rd/cozyrds/vm-disk.yaml | 2 +- .../vm-instance-rd/cozyrds/vm-instance.yaml | 2 +- packages/system/vpn-rd/cozyrds/vpn.yaml | 2 +- .../cozy-lib-tests/templates/tests/yaml.yaml | 35 ++++ .../tests/cozy-lib-tests/tests/yaml_test.yaml | 111 ++++++++++++ 220 files changed, 2897 insertions(+), 663 deletions(-) create mode 100644 hack/tenant-values-line-break_test.bats create mode 100644 packages/apps/bucket/tests/helmrelease_users_test.yaml create mode 100644 packages/apps/clickhouse/tests/backup_cleanup_strategy_test.yaml create mode 100644 packages/apps/kubernetes/tests/addons_values_override_keys_test.yaml create mode 100644 packages/apps/kubernetes/tests/csi_proxmox_storage_class_input_test.yaml create mode 100644 packages/apps/mariadb/tests/backup_cleanup_strategy_test.yaml create mode 100644 packages/apps/mongodb/tests/database_name_test.yaml create mode 100644 packages/apps/nats/templates/_config.tpl create mode 100644 packages/extra/bootbox/templates/_helpers.tpl create mode 100644 packages/extra/bootbox/tests/machine_hostname_test.yaml create mode 100644 packages/extra/external-dns/tests/args_test.yaml create mode 100644 packages/extra/ingress/templates/_whitelist.tpl create mode 100644 packages/extra/seaweedfs/templates/_whitelist.tpl create mode 100644 packages/extra/seaweedfs/tests/zone_node_selector_test.yaml create mode 100644 packages/library/cozy-lib/templates/_affinity.tpl create mode 100644 packages/library/cozy-lib/templates/_yaml.tpl create mode 100644 packages/system/monitoring-agents/tests/vmagent_external_labels_test.yaml create mode 100644 packages/system/monitoring/tests/vmagent_external_labels_test.yaml create mode 100644 packages/tests/cozy-lib-tests/templates/tests/yaml.yaml create mode 100644 packages/tests/cozy-lib-tests/tests/yaml_test.yaml diff --git a/api/apps/v1alpha1/bucket/types.go b/api/apps/v1alpha1/bucket/types.go index 2b3ad37f9..051ee42bf 100644 --- a/api/apps/v1alpha1/bucket/types.go +++ b/api/apps/v1alpha1/bucket/types.go @@ -24,6 +24,8 @@ type ConfigSpec struct { LockingDefaultRetention bool `json:"lockingDefaultRetention"` // Selects a specific BucketClass by storage pool name. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$" StoragePool string `json:"storagePool,omitempty"` // Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `.`. Set to `false` to run the bucket without them. // +kubebuilder:default:=true diff --git a/api/apps/v1alpha1/clickhouse/types.go b/api/apps/v1alpha1/clickhouse/types.go index 521f3eef2..6b70648c3 100644 --- a/api/apps/v1alpha1/clickhouse/types.go +++ b/api/apps/v1alpha1/clickhouse/types.go @@ -63,12 +63,14 @@ type ConfigSpec struct { type Backup struct { // Legacy. Restic retention policy passed to the legacy CronJob (`restic forget …`). Unused by the Altinity strategy. // +kubebuilder:default:="--keep-last=3 --keep-daily=3 --keep-within-weekly=1m" + // +kubebuilder:validation:Pattern="^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$" CleanupStrategy string `json:"cleanupStrategy,omitempty"` // 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. // +kubebuilder:default:=false Enabled bool `json:"enabled"` // DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" Endpoint string `json:"endpoint,omitempty"` // 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. // +kubebuilder:default:={} @@ -81,21 +83,25 @@ type Backup struct { S3AccessKey string `json:"s3AccessKey,omitempty"` // DEPRECATED. Optional; see `s3Region`. // +kubebuilder:default:="s3.example.org/clickhouse-backups" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" S3Bucket string `json:"s3Bucket,omitempty"` // DEPRECATED. Pre-existing Secret reference for the legacy chart-emitted sidecar. The platform flow projects `cozy-backups-creds` instead. // +kubebuilder:default:={} S3CredentialsSecret S3CredentialsSecret `json:"s3CredentialsSecret,omitempty"` // DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" S3PathOverride string `json:"s3PathOverride,omitempty"` // 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. // +kubebuilder:default:="us-east-1" + // +kubebuilder:validation:Pattern="^[A-Za-z0-9_.-]*$" S3Region string `json:"s3Region,omitempty"` // DEPRECATED. Optional; see `s3AccessKey`. // +kubebuilder:default:="" S3SecretKey string `json:"s3SecretKey,omitempty"` // 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. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[-0-9A-Za-z*/,@? ]*$" Schedule string `json:"schedule,omitempty"` // 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. // +kubebuilder:default:=false @@ -120,9 +126,13 @@ type ClickHouseKeeper struct { type EndpointCA struct { // Key inside the Secret holding the PEM CA bundle. Defaults to `ca.crt`. // +kubebuilder:default:="ca.crt" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" Key string `json:"key,omitempty"` // Name of the Secret in the application namespace. Empty (default) mounts nothing and leaves the sidecar on the system trust store only. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` } @@ -136,21 +146,33 @@ type Resources struct { type S3CredentialsSecret struct { // Key in the Secret holding the access key ID. Defaults to `accessKey`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" AccessKeyIDKey string `json:"accessKeyIDKey,omitempty"` // Key in the Secret holding the bucket name. Defaults to `bucketName`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" BucketKey string `json:"bucketKey,omitempty"` // Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" EndpointKey string `json:"endpointKey,omitempty"` // Name of the Secret in the application namespace. Empty means the chart materialises `-backup-s3` from the legacy `s3*` fields. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` // Key in the Secret holding the S3 region. Defaults to `region`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" RegionKey string `json:"regionKey,omitempty"` // Key in the Secret holding the secret access key. Defaults to `secretKey`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" SecretAccessKeyKey string `json:"secretAccessKeyKey,omitempty"` } diff --git a/api/apps/v1alpha1/foundationdb/types.go b/api/apps/v1alpha1/foundationdb/types.go index 1e84621c2..d40e48187 100644 --- a/api/apps/v1alpha1/foundationdb/types.go +++ b/api/apps/v1alpha1/foundationdb/types.go @@ -71,12 +71,15 @@ type Backup struct { type BackupS3 struct { // DEPRECATED S3 bucket name. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^([a-z0-9][a-z0-9.-]*[a-z0-9])?$" Bucket string `json:"bucket"` // DEPRECATED S3 credentials. // +kubebuilder:default:={} Credentials BackupS3Credentials `json:"credentials"` // DEPRECATED S3 endpoint URL. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" Endpoint string `json:"endpoint"` // DEPRECATED S3 region. // +kubebuilder:default:="us-east-1" @@ -110,9 +113,13 @@ type Cluster struct { type ClusterFaultDomain struct { // Fault domain key. // +kubebuilder:default:="kubernetes.io/hostname" + // +kubebuilder:validation:MaxLength=317 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" Key string `json:"key"` // Fault domain value source. // +kubebuilder:default:="spec.nodeName" + // +kubebuilder:validation:MaxLength=317 + // +kubebuilder:validation:Pattern="^[A-Za-z0-9_.$'\\[\\]/-]*$" ValueFrom string `json:"valueFrom"` } @@ -156,6 +163,8 @@ type Storage struct { Size resource.Quantity `json:"size"` // Storage class (if not set, uses cluster default). // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` } diff --git a/api/apps/v1alpha1/harbor/types.go b/api/apps/v1alpha1/harbor/types.go index 47efc04d6..dec5e32a7 100644 --- a/api/apps/v1alpha1/harbor/types.go +++ b/api/apps/v1alpha1/harbor/types.go @@ -19,12 +19,16 @@ type Config struct { type ConfigSpec struct { // Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host). // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Host string `json:"host,omitempty"` // IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API. // +kubebuilder:default:={} ManagementWhitelist []string `json:"managementWhitelist,omitempty"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Entry-point proxy configuration. diff --git a/api/apps/v1alpha1/kafka/types.go b/api/apps/v1alpha1/kafka/types.go index cde73cf14..0b09fd307 100644 --- a/api/apps/v1alpha1/kafka/types.go +++ b/api/apps/v1alpha1/kafka/types.go @@ -60,6 +60,8 @@ type Kafka struct { Size resource.Quantity `json:"size"` // StorageClass used to store the Kafka data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` } @@ -80,6 +82,8 @@ type Topic struct { // Topic configuration. Config *k8sRuntime.RawExtension `json:"config,omitempty"` // Topic name. + // +kubebuilder:validation:MaxLength=249 + // +kubebuilder:validation:Pattern="^[a-zA-Z0-9._-]+$" Name string `json:"name"` // Number of partitions. Partitions int `json:"partitions"` diff --git a/api/apps/v1alpha1/kubernetes/types.go b/api/apps/v1alpha1/kubernetes/types.go index 592a580e1..a105d20af 100644 --- a/api/apps/v1alpha1/kubernetes/types.go +++ b/api/apps/v1alpha1/kubernetes/types.go @@ -20,6 +20,8 @@ type Config struct { type ConfigSpec struct { // Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name. // +kubebuilder:default:="replicated" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Kubernetes major.minor version to deploy @@ -27,6 +29,8 @@ type ConfigSpec struct { Version Version `json:"version"` // External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Host string `json:"host"` // Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one. // +kubebuilder:default:="kubevirt" @@ -272,6 +276,8 @@ type OIDCCustomConfig struct { type OIDCSecretRef struct { // Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` } @@ -315,12 +321,16 @@ type Proxmox struct { type ProxmoxCCM struct { // Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" CredentialsSecretName string `json:"credentialsSecretName"` } type ProxmoxCSI struct { // Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" CredentialsSecretName string `json:"credentialsSecretName"` // Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all. // +kubebuilder:default:=true diff --git a/api/apps/v1alpha1/kubernetesnodes/types.go b/api/apps/v1alpha1/kubernetesnodes/types.go index 5e4608ac7..2c05112db 100644 --- a/api/apps/v1alpha1/kubernetesnodes/types.go +++ b/api/apps/v1alpha1/kubernetesnodes/types.go @@ -76,6 +76,7 @@ type ConfigSpec struct { MaxUnhealthy string `json:"maxUnhealthy"` // Maximum time a Machine is allowed to spend reaching the Ready condition before it is remediated. Raise for slow first boots (the Talos image import from the Image Factory, or a storage class slow to provision or clone the worker disk). The MachineHealthCheck measures it from the later of the Machine's creation and its InfrastructureReady transition, so the clock restarts when the infrastructure reports ready: a worker gets this long for the disk image import and the VM to come up, and then this long again for the guest to boot and its kubelet to register with the tenant apiserver. Either leg stretches on a host under load, and a Machine remediated here is deleted before it ever joins, so its replacement starts the same sequence from the beginning. // +kubebuilder:default:="20m" + // +kubebuilder:validation:Pattern="^(0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+)$" NodeStartupTimeout string `json:"nodeStartupTimeout"` // How long a worker Node may report `Ready=Unknown` before the MachineHealthCheck remediates the Machine, which for a KubeVirt worker means deleting the VM. `Ready=Unknown` is what the node lifecycle controller writes once it stops hearing from a kubelet, on a grace period of its own, so the wall clock from a guest going quiet to a deleted worker is this value plus that grace period. A guest starved of CPU stops answering long before it is dead, so a value of a few tens of seconds deletes workers that would have come back on their own. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips. // +kubebuilder:default:="5m" @@ -106,6 +107,8 @@ type ConfigSpec struct { type GPU struct { // Name of GPU, such as "nvidia.com/AD102GL_L40S". + // +kubebuilder:validation:MaxLength=317 + // +kubebuilder:validation:Pattern="^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" Name string `json:"name"` } @@ -187,6 +190,7 @@ type Talos struct { ImageFactoryURL string `json:"imageFactoryURL"` // OCI repository prefix for the Talos installer image, written into the worker machine config as `machine.install.image`. Resolved as `/:` against whatever this pool's `osImage` pins, falling back to `talos.schematicID` and `talos.version` — so the installer matches the OS the pool actually booted. The prefix itself has no `osImage.*` override, so an air-gapped pool needs it pointed at a reachable registry as well. Defaults to the public factory's installer path. Override for air-gapped or mirrored registries. No trailing slash. // +kubebuilder:default:="factory.talos.dev/installer" + // +kubebuilder:validation:Pattern="^([A-Za-z0-9]|\\[[0-9A-Fa-f:.]+\\])[-A-Za-z0-9._:/@]*$" InstallerRepository string `json:"installerRepository"` // Talos `machine.registries.mirrors` passthrough for worker nodes: a map of upstream registry host to `{ endpoints: [ ... ] }`. Empty by default, so workers pull container images (the Talos `kubelet` image included) directly from the upstream registry. Point a host such as `ghcr.io` at an in-cluster pull-through mirror for air-gapped, rate-limited, or flaky-egress environments so a worker's boot does not depend on live public egress. Talos still falls back to the upstream registry unless a host also sets `skipFallback: true`, so a mirror alone does not enforce air-gap. This value is part of the worker machine config, whose content hash names the TalosConfigTemplate, so changing it rolls every existing worker in the pool rather than only affecting nodes created later. // +kubebuilder:default:={} diff --git a/api/apps/v1alpha1/mariadb/types.go b/api/apps/v1alpha1/mariadb/types.go index 3dd98045c..e4818e722 100644 --- a/api/apps/v1alpha1/mariadb/types.go +++ b/api/apps/v1alpha1/mariadb/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. @@ -60,6 +62,7 @@ type ConfigSpec struct { type Backup struct { // DEPRECATED: Retention strategy for cleaning up old backups. // +kubebuilder:default:="--keep-last=3 --keep-daily=3 --keep-within-weekly=1m" + // +kubebuilder:validation:Pattern="^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$" CleanupStrategy string `json:"cleanupStrategy"` // DEPRECATED: Enable regular backups (default: false). // +kubebuilder:default:=false @@ -72,15 +75,18 @@ type Backup struct { S3AccessKey string `json:"s3AccessKey"` // DEPRECATED: S3 bucket used for storing backups. // +kubebuilder:default:="s3.example.org/mariadb-backups" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" S3Bucket string `json:"s3Bucket"` // DEPRECATED: AWS S3 region where backups are stored. // +kubebuilder:default:="us-east-1" + // +kubebuilder:validation:Pattern="^[A-Za-z0-9_.-]*$" S3Region string `json:"s3Region"` // DEPRECATED: Secret key for S3 authentication. // +kubebuilder:default:="" S3SecretKey string `json:"s3SecretKey"` // DEPRECATED: Cron schedule for automated backups. // +kubebuilder:default:="0 2 * * *" + // +kubebuilder:validation:Pattern="^[-0-9A-Za-z*/,@? ]*$" Schedule string `json:"schedule"` } diff --git a/api/apps/v1alpha1/mongodb/types.go b/api/apps/v1alpha1/mongodb/types.go index d0c522406..e225897ac 100644 --- a/api/apps/v1alpha1/mongodb/types.go +++ b/api/apps/v1alpha1/mongodb/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. @@ -66,12 +68,14 @@ type ConfigSpec struct { type Backup struct { // Destination path for backups (e.g. s3://bucket/path/). Ignored when useSystemBucket is true (the driver injects the platform bucket). // +kubebuilder:default:="s3://bucket/path/to/folder/" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" DestinationPath string `json:"destinationPath,omitempty"` // Enable regular backups. // +kubebuilder:default:=false Enabled bool `json:"enabled"` // S3 endpoint URL for uploads. Ignored when useSystemBucket is true (the strategy supplies the platform endpoint). // +kubebuilder:default:="http://minio-gateway-service:9000" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" EndpointURL string `json:"endpointURL,omitempty"` // Skip TLS verification for the S3 endpoint (self-signed, e.g. in-cluster seaweedfs). Ignored when useSystemBucket is true (the platform backupStorage knob applies instead). // +kubebuilder:default:=false @@ -87,6 +91,7 @@ type Backup struct { S3SecretKey string `json:"s3SecretKey,omitempty"` // Cron schedule for automated backups. Ignored when useSystemBucket is true (scheduling moves to the BackupClass Plan). // +kubebuilder:default:="0 2 * * *" + // +kubebuilder:validation:Pattern="^[-0-9A-Za-z*/,@? ._=]*$" Schedule string `json:"schedule,omitempty"` // Opt-in: back up to the platform system bucket without supplying S3 credentials. The cozy-default MongoDB BackupClass injects the storage at BackupJob time; tenants do not set s3AccessKey/s3SecretKey/destinationPath/endpointURL, and backups scope to `/`. Scheduling moves to a BackupClass Plan; `schedule`, `retentionPolicy` and PITR are ignored while this is on, and this flow has no retention yet (see https://cozystack.io/docs/v1/operations/services/backup-classes/). Requires `backup.enabled: true` (the pbm agents run on that flag); the chart refuses the combination with `enabled: false` at render time; the schema carries the same rule as a marker for the UI and for the day the apiserver enforces CEL on application schemas (cozystack/cozystack#2657), which it does not yet. A release that has not yet rendered this flag (its cluster still carries the chart's scheduled tasks and PITR) holds a BackupJob until it does, so the tenant's own storage is never injected over. // +kubebuilder:default:=false @@ -96,12 +101,14 @@ type Backup struct { type Bootstrap struct { // Name of backup to restore from. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" BackupName string `json:"backupName"` // Whether to restore from a backup. // +kubebuilder:default:=false Enabled bool `json:"enabled"` // Timestamp for point-in-time recovery; empty means latest. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[0-9TZtz:.+ -]*$" RecoveryTime string `json:"recoveryTime,omitempty"` } @@ -126,6 +133,8 @@ type Resources struct { type Shard struct { // Shard name. + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" Name string `json:"name"` // Number of replicas in this shard. Replicas int `json:"replicas"` diff --git a/api/apps/v1alpha1/nats/types.go b/api/apps/v1alpha1/nats/types.go index 961e10d41..b6b35a9b2 100644 --- a/api/apps/v1alpha1/nats/types.go +++ b/api/apps/v1alpha1/nats/types.go @@ -29,6 +29,8 @@ type ConfigSpec struct { ResourcesPreset ResourcesPreset `json:"resourcesPreset"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/openbao/types.go b/api/apps/v1alpha1/openbao/types.go index ef553f5bf..d685a4848 100644 --- a/api/apps/v1alpha1/openbao/types.go +++ b/api/apps/v1alpha1/openbao/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/opensearch/types.go b/api/apps/v1alpha1/opensearch/types.go index d387545e9..de1fa6f0c 100644 --- a/api/apps/v1alpha1/opensearch/types.go +++ b/api/apps/v1alpha1/opensearch/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/postgresql/types.go b/api/apps/v1alpha1/postgresql/types.go index 95b0a57c1..8d5bd150a 100644 --- a/api/apps/v1alpha1/postgresql/types.go +++ b/api/apps/v1alpha1/postgresql/types.go @@ -32,6 +32,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. @@ -122,6 +124,7 @@ type Autoscaling struct { type Backup struct { // DEPRECATED. Per-tenant S3 configuration is superseded by the platform-managed `cozy-default` BackupClass and the `cozy-backups` system bucket. Leave empty for new installations; the BackupClass driver picks up the system-managed coordinates. Kept for in-place upgrade compatibility. // +kubebuilder:default:="s3://bucket/path/to/folder/" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" DestinationPath string `json:"destinationPath,omitempty"` // Enable regular backups. // +kubebuilder:default:=false @@ -131,9 +134,11 @@ type Backup struct { EndpointCA EndpointCA `json:"endpointCA,omitempty"` // DEPRECATED. See `destinationPath`. // +kubebuilder:default:="http://minio-gateway-service:9000" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" EndpointURL string `json:"endpointURL,omitempty"` // Retention policy (e.g. "30d"). // +kubebuilder:default:="30d" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" RetentionPolicy string `json:"retentionPolicy,omitempty"` // DEPRECATED. Tenants no longer supply S3 keys; the system Bucket Secret is projected into the tenant namespace by the backup controller. Ignored when `s3CredentialsSecret.name` is set or `useSystemBucket` is true. The chart skips materialising `-s3-creds` whenever this field is empty so a default install does not leak placeholder credentials into the tenant namespace. // +kubebuilder:default:="" @@ -155,21 +160,27 @@ type Backup struct { type Bootstrap struct { // Barman ID of the base backup to recover from, passed as `recoveryTarget.backupID`. Empty lets the barman-cloud plugin pick one: the newest backup when `recoveryTime` is empty, otherwise the newest one ending at or before it, on any timeline. The CNPG backup driver sets this on restore. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" BackupID string `json:"backupID,omitempty"` // Whether to restore from a backup. // +kubebuilder:default:=false Enabled bool `json:"enabled"` // WAL-archive server name (S3 path prefix) the RESTORED cluster writes to. Must differ from `serverName` (the recovery source) so a restored cluster archives to a fresh, empty prefix and barman-cloud-check-wal-archive passes while it recovers from the source's prefix. The CNPG backup driver sets this on restore; empty means the cluster archives under its own name. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" NewServerName string `json:"newServerName,omitempty"` // Previous cluster name before deletion. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" OldName string `json:"oldName"` // Timestamp (RFC3339) for point-in-time recovery; empty means latest. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[0-9TZtz:.+ -]*$" RecoveryTime string `json:"recoveryTime,omitempty"` // Server name (S3 path prefix) used by the original cluster when writing backups; passed to the barman-cloud plugin via `externalClusters[].plugin.parameters.serverName`. Defaults to `bootstrap.oldName`. Set this only when the original cluster wrote backups under an explicit server name that differed from its Kubernetes resource name. // +kubebuilder:default:="" + // +kubebuilder:validation:Pattern="^[^\\s\"'$`\\x5c;&|<>(){}]*$" ServerName string `json:"serverName,omitempty"` // Image of the cluster the backup was taken from. A restore of a backup taken on one of the bare Debian bullseye tags the chart used before standard-trixie comes back on that image (see `allowCollationChange`); any other value is ignored. The CNPG backup driver sets this on restore and clears it with `enabled`. // +kubebuilder:default:="" @@ -193,9 +204,13 @@ type DatabaseRoles struct { type EndpointCA struct { // Key within the Secret containing the CA bundle. Defaults to `ca.crt`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" Key string `json:"key,omitempty"` // Name of the Secret in the application namespace. Empty means no endpointCA is emitted (the plugin uses the system trust store). // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` } @@ -226,12 +241,18 @@ type Resources struct { type S3CredentialsSecret struct { // Key in the Secret holding the access key ID. Defaults to `AWS_ACCESS_KEY_ID`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" AccessKeyIDKey string `json:"accessKeyIDKey,omitempty"` // Name of the Secret in the application namespace. Empty means the chart materialises `-s3-creds` from `s3AccessKey`/`s3SecretKey`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` // Key in the Secret holding the secret access key. Defaults to `AWS_SECRET_ACCESS_KEY`. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^[-._a-zA-Z0-9]*$" SecretAccessKeyKey string `json:"secretAccessKeyKey,omitempty"` } diff --git a/api/apps/v1alpha1/qdrant/types.go b/api/apps/v1alpha1/qdrant/types.go index 7eb05e94e..ba01d6cd6 100644 --- a/api/apps/v1alpha1/qdrant/types.go +++ b/api/apps/v1alpha1/qdrant/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/rabbitmq/types.go b/api/apps/v1alpha1/rabbitmq/types.go index 751af6c5a..971eb95bc 100644 --- a/api/apps/v1alpha1/rabbitmq/types.go +++ b/api/apps/v1alpha1/rabbitmq/types.go @@ -32,6 +32,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/redis/types.go b/api/apps/v1alpha1/redis/types.go index 602b5203d..32b7904df 100644 --- a/api/apps/v1alpha1/redis/types.go +++ b/api/apps/v1alpha1/redis/types.go @@ -35,6 +35,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. Can be enabled only when the instance is created, together with `tls.enabled: true`; turning it on for an existing instance, or changing `tls.enabled` while it is on, is refused at admission. diff --git a/api/apps/v1alpha1/tenant/types.go b/api/apps/v1alpha1/tenant/types.go index 191ee76f4..f37ff7088 100644 --- a/api/apps/v1alpha1/tenant/types.go +++ b/api/apps/v1alpha1/tenant/types.go @@ -19,6 +19,8 @@ type Config struct { type ConfigSpec struct { // The hostname used to access tenant services (defaults to using the tenant name as a subdomain for its parent tenant host). // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Host string `json:"host,omitempty"` // Deploy own Etcd cluster. // +kubebuilder:default:=false @@ -46,6 +48,8 @@ type ConfigSpec struct { Computeplane bool `json:"computeplane"` // The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" SchedulingClass string `json:"schedulingClass,omitempty"` // SchedulingClasses an application in this tenant may select through its own `schedulingClass`, in place of the tenant's. Empty allows none, so every application runs under the tenant's class. Inherited from the parent tenant, and not settable here, when the parent has a `schedulingClass` or a non-empty list. // +kubebuilder:default:={} diff --git a/api/apps/v1alpha1/valkey/types.go b/api/apps/v1alpha1/valkey/types.go index 0f25d0b1c..0aaf95ba5 100644 --- a/api/apps/v1alpha1/valkey/types.go +++ b/api/apps/v1alpha1/valkey/types.go @@ -31,6 +31,8 @@ type ConfigSpec struct { Size resource.Quantity `json:"size"` // StorageClass used to store the data. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Enable external access from outside the cluster. diff --git a/api/apps/v1alpha1/vmdisk/types.go b/api/apps/v1alpha1/vmdisk/types.go index 19f9a1073..f9d0c7246 100644 --- a/api/apps/v1alpha1/vmdisk/types.go +++ b/api/apps/v1alpha1/vmdisk/types.go @@ -29,6 +29,8 @@ type ConfigSpec struct { Storage resource.Quantity `json:"storage"` // StorageClass used to store the data. // +kubebuilder:default:="replicated" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable" StorageClass string `json:"storageClass"` // Provision the volume at disk creation instead of waiting for a consumer. @@ -53,6 +55,8 @@ type Source struct { type SourceDisk struct { // Name of the vm-disk to clone. + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" Name string `json:"name"` } @@ -63,6 +67,8 @@ type SourceHTTP struct { type SourceImage struct { // Name of the image to use. + // +kubebuilder:validation:MaxLength=235 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" Name string `json:"name"` } diff --git a/api/apps/v1alpha1/vminstance/types.go b/api/apps/v1alpha1/vminstance/types.go index f30e8dee8..f747d8c57 100644 --- a/api/apps/v1alpha1/vminstance/types.go +++ b/api/apps/v1alpha1/vminstance/types.go @@ -34,9 +34,13 @@ type ConfigSpec struct { RunStrategy RunStrategy `json:"runStrategy"` // Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it. // +kubebuilder:default:="u1.medium" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" InstanceType string `json:"instanceType"` // Virtual Machine preferences profile. // +kubebuilder:default:="ubuntu" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" InstanceProfile string `json:"instanceProfile"` // List of disks to attach. // +kubebuilder:default:={} @@ -57,6 +61,8 @@ type ConfigSpec struct { Gpus []GPU `json:"gpus,omitempty"` // Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=128 + // +kubebuilder:validation:Pattern="^([A-Za-z0-9][-A-Za-z0-9_.+]*)?$" CpuModel string `json:"cpuModel"` // Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM). // +kubebuilder:default:={} @@ -87,8 +93,12 @@ type Disk struct { // +kubebuilder:validation:Minimum=1 BootOrder *int `json:"bootOrder,omitempty"` // Disk bus type (e.g. "sata"). + // +kubebuilder:validation:MaxLength=16 + // +kubebuilder:validation:Pattern="^[a-z0-9]*$" Bus string `json:"bus,omitempty"` // Disk name. + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" Name string `json:"name"` } @@ -103,11 +113,15 @@ type Firmware struct { type GPU struct { // The name of the GPU resource to attach. + // +kubebuilder:validation:MaxLength=317 + // +kubebuilder:validation:Pattern="^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" Name string `json:"name"` } type Network struct { // Network attachment name. + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" Name string `json:"name,omitempty"` } diff --git a/api/apps/v1alpha1/vpc/types.go b/api/apps/v1alpha1/vpc/types.go index d79460681..70a6c4784 100644 --- a/api/apps/v1alpha1/vpc/types.go +++ b/api/apps/v1alpha1/vpc/types.go @@ -29,15 +29,21 @@ type ConfigSpec struct { type Peer struct { // Namespace of the remote tenant + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" TenantNamespace string `json:"tenantNamespace"` // Logical name of the remote VPC (without "virtualprivatecloud-" prefix) + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" VpcName string `json:"vpcName"` } type Route struct { // Destination CIDR + // +kubebuilder:validation:Pattern="^[0-9A-Fa-f.:/,]*$" Cidr string `json:"cidr"` // Next hop IP address + // +kubebuilder:validation:Pattern="^[0-9A-Fa-f.:]*$" NextHopIP string `json:"nextHopIP"` } @@ -45,7 +51,10 @@ type Subnet struct { // Additional source CIDRs admitted into this private subnet, such as remote networks routed in through a gateway VM AllowSubnets []string `json:"allowSubnets,omitempty"` // IP address range + // +kubebuilder:validation:Pattern="^[0-9A-Fa-f.:/,]*$" Cidr string `json:"cidr,omitempty"` // Subnet name + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern="^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" Name string `json:"name"` } diff --git a/api/apps/v1alpha1/vpn/types.go b/api/apps/v1alpha1/vpn/types.go index 3cdaca92a..9248531a5 100644 --- a/api/apps/v1alpha1/vpn/types.go +++ b/api/apps/v1alpha1/vpn/types.go @@ -29,8 +29,10 @@ type ConfigSpec struct { // Enable external access from outside the cluster. // +kubebuilder:default:=false External bool `json:"external"` - // Host used to substitute into generated URLs. + // Host used to substitute into generated URLs: a DNS name, an IPv4 address or an IPv6 address. // +kubebuilder:default:="" + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern="^(([A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*)|[0-9A-Fa-f.]*:[0-9A-Fa-f:.]*)?$" Host string `json:"host"` // Users configuration map. // +kubebuilder:default:={} diff --git a/hack/app-cleanup-hooks_test.bats b/hack/app-cleanup-hooks_test.bats index ba1b41bbb..406a4a646 100644 --- a/hack/app-cleanup-hooks_test.bats +++ b/hack/app-cleanup-hooks_test.bats @@ -32,16 +32,22 @@ QDRANT_CHART=packages/apps/qdrant HARBOR_CHART=packages/apps/harbor # render_hook [extra helm args…] -# Extract the named Job's shell script from the rendered chart into . The -# non-empty check must be an early `return 1`: hack/cozytest.sh rewrites every -# line matching ^}$ into `return 0` plus `}`, helpers included, so a check left -# in last-command position has its status discarded. +# Extract the named Job's shell script from the rendered chart into , +# preceded by an export of every literal env value of its container: the hooks +# take release data such as harbor's host from the environment rather than +# from the script text, so a script run without them is not the one the Job +# runs. The non-empty check must be an early `return 1`: hack/cozytest.sh +# rewrites every line matching ^}$ into `return 0` plus `}`, helpers included, +# so a check left in last-command position has its status discarded. render_hook() { chart=$1 release=$2 namespace=$3 job=$4 out=$5 shift 5 - helm template "$release" "$chart" --namespace "$namespace" "$@" \ - | yq eval "select(.kind == \"Job\" and .metadata.name == \"$job\") | .spec.template.spec.containers[0].command[2]" - > "$out" - [ -s "$out" ] || return 1 + container="select(.kind == \"Job\" and .metadata.name == \"$job\") | .spec.template.spec.containers[0]" + helm template "$release" "$chart" --namespace "$namespace" "$@" > "$out.yaml" || return 1 + yq eval "$container | .command[2]" "$out.yaml" > "$out.script" + [ -s "$out.script" ] || return 1 + yq eval "$container | .env[] | select(has(\"value\")) | \"export \" + .name + \"=\" + (.value | @sh)" "$out.yaml" > "$out" + cat "$out.script" >> "$out" } # write_fake_kubectl @@ -315,6 +321,50 @@ persistentvolumeclaim/db-qdrant-test-0' rm -rf "$tmp" } +@test "harbor hook passes a host holding shell syntax to kubectl verbatim" { + # The host reaches the script only through HOST, so the script text is + # static and a substitution in the host stays text, reaching kubectl's + # filters verbatim. The chart's own host field is held to a DNS name by the + # schema; the _namespace.host it falls back to is not in the schema. + tmp=$(mktemp -d) + write_fake_kubectl "$tmp" + render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \ + --set "_namespace.host=example.org\$(touch $tmp/marker)" --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01' + + export KLOG="$tmp/calls" + export CHALLENGE_LIST='' + export SOLVER_LIST='' + export EXISTING='' + + rc=0 + PATH="$tmp:$PATH" sh "$tmp/hook.sh" > "$tmp/out" 2> "$tmp/err" || rc=$? + if [ "$rc" -ne 0 ]; then + echo "FAIL: hook exited $rc on an already-clean namespace" + cat "$tmp/out" "$tmp/err" + false + fi + if [ -e "$tmp/marker" ]; then + echo "FAIL: the substitution in the host was expanded" + false + fi + if ! grep -qF "dnsName=='harbor-test.example.org\$(touch $tmp/marker)'" "$tmp/calls"; then + echo "FAIL: the host did not reach the Challenge filter literally" + cat "$tmp/calls" + false + fi + if helm template harbor-test "$HARBOR_CHART" --namespace tenant-test \ + --set "host=example.org\$(touch $tmp/marker)" > /dev/null 2> "$tmp/schema"; then + echo "FAIL: the schema accepted a host that is not a DNS name" + false + fi + if ! grep -q "at '/host'" "$tmp/schema"; then + echo "FAIL: the host was refused for some other reason" + cat "$tmp/schema" + false + fi + rm -rf "$tmp" +} + @test "harbor hook exits 0 when every object is already gone" { # No in-flight ACME challenge and no solver Ingress is the ordinary case, and # the Certificate is usually collected with the release before the hook runs. diff --git a/hack/kafka-migration-hook.bats b/hack/kafka-migration-hook.bats index 8ba753e75..389796664 100644 --- a/hack/kafka-migration-hook.bats +++ b/hack/kafka-migration-hook.bats @@ -15,16 +15,24 @@ load test_helper CHART=packages/apps/kafka +# render_script [extra helm args…] +# The pool manifests reach the script through the Job's environment, so the +# script is preceded by an export of every literal env value of the container, +# as the Job runs it. render_script() { + out=$1 + shift helm template test-kafka "$CHART" \ --namespace tenant-test \ - --show-only templates/migration-hook.yaml 2>"$1.err" | - yq 'select(.kind == "Job") | .spec.template.spec.containers[0].args[0]' - > "$1" - if [ ! -s "$1" ]; then + --show-only templates/migration-hook.yaml "$@" > "$out.yaml" 2>"$out.err" + yq 'select(.kind == "Job") | .spec.template.spec.containers[0].args[0]' "$out.yaml" > "$out.script" + if [ ! -s "$out.script" ]; then echo "FAIL: the chart rendered no node-pool Job script" >&2 - grep -v 'found symbolic link in path' "$1.err" >&2 || true + grep -v 'found symbolic link in path' "$out.err" >&2 || true return 1 fi + yq 'select(.kind == "Job") | .spec.template.spec.containers[0].env[] | select(has("value")) | "export " + .name + "=" + (.value | @sh)' "$out.yaml" > "$out" + cat "$out.script" >> "$out" } make_bin() { @@ -46,7 +54,7 @@ STUB setup_case() { tmp=$(mktemp -d) || return 1 - render_script "$tmp/s.sh" || return 1 + render_script "$tmp/s.sh" "$@" || return 1 make_bin "$tmp/bin" || return 1 } @@ -80,6 +88,48 @@ run_hook() { rm -rf "$tmp" } +@test "a storage class holding shell syntax and a line break reaches both pools as one quoted value" { + # The schema refuses this storageClass. The render after that skips the + # schema to show that the hook carries the value as data on its own: the + # shell does not expand it and it does not split into a field of its own. + tmp=$(mktemp -d) + value="x\$(touch $tmp/marker)\`touch $tmp/marker\` +deleteClaim: true" + if helm template test-kafka "$CHART" --namespace tenant-test \ + --set-string "kafka.storageClass=$value" > /dev/null 2> "$tmp/schema"; then + echo "FAIL: the schema accepted a storageClass that is not a DNS name" + return 1 + fi + if ! grep -q "/kafka/storageClass" "$tmp/schema"; then + echo "FAIL: the storageClass was refused for some other reason" + cat "$tmp/schema" + return 1 + fi + + render_script "$tmp/s.sh" --skip-schema-validation --set-string "kafka.storageClass=$value" + make_bin "$tmp/bin" + run_hook + + [ "$rc" = 0 ] + if [ -e "$tmp/marker" ]; then + echo "FAIL: the substitution in the storageClass was expanded in the hook" + return 1 + fi + classes=$(grep -cF "class: \"x\$(touch $tmp/marker)\`touch $tmp/marker\`\\ndeleteClaim: true\"" "$tmp/kubectl.log") + if [ "$classes" != 2 ]; then + echo "FAIL: the storageClass did not reach both pools as one quoted value ($classes)" + cat "$tmp/kubectl.log" + return 1 + fi + if grep -qE '^ *deleteClaim: true' "$tmp/kubectl.log"; then + echo "FAIL: the storageClass added a field of its own to a pool" + cat "$tmp/kubectl.log" + return 1 + fi + + rm -rf "$tmp" +} + @test "a failed pool apply fails the hook" { setup_case STUB_APPLY_FAIL=1 run_hook diff --git a/hack/talos-reconcile-heredoc_test.bats b/hack/talos-reconcile-heredoc_test.bats index 09475c987..3b70cf87d 100644 --- a/hack/talos-reconcile-heredoc_test.bats +++ b/hack/talos-reconcile-heredoc_test.bats @@ -25,15 +25,19 @@ # # escaped the value reaches the heredoc and is escaped for backslash, # dollar and backtick. Assert it survives a real shell as a -# LITERAL. This covers talos.installerRepository and -# talos.registryMirrors and talos.sysctls (both keys and values). +# LITERAL. This covers talos.registryMirrors and talos.sysctls +# (both keys and values). # validated the value is refused at render before it can reach the heredoc. # Assert the refusal. This covers talos.schematicID and # talos.version, which also land in the worker DataVolume name and # the image URL, where an unquoted YAML scalar makes escaping the # wrong tool. templates/nodegroup.yaml pattern-checks them. It also # covers kernelModules, whose names and parameters -# templates/_helpers.tpl checks before rebuilding the list. +# templates/_helpers.tpl checks before rebuilding the list, and +# talos.installerRepository, which the schema and +# templates/_talosconfigtemplate.tpl both hold to an OCI +# repository; it is still escaped, and a legitimate repository +# is asserted to survive the shell literally. # Sysctl map/value types and UTF-8 are validated before escaping. # # A field that is in neither arm is the regression this file exists to catch. @@ -91,7 +95,7 @@ VALS rm -rf "$work" } -@test "kubernetes-nodes worker TalosConfigTemplate heredoc keeps a hostile installerRepository literal" { +@test "kubernetes-nodes refuses an installerRepository holding shell syntax and keeps a valid one literal" { work=$(mktemp -d) cat > "$work/vals.yaml" <<'VALS' cluster: myk8s @@ -106,11 +110,25 @@ storageClass: replicated roles: [ingress-nginx] resources: {cpu: "2", memory: 4Gi} VALS - # installerRepository is an OCI repository prefix and stays free-form: it is - # not part of the DataVolume name, so escaping is the right tool and this is - # the assertion that proves it still works. + # A substitution in installerRepository is refused by the schema, and again + # by the template when the schema is skipped, so neither layer alone + # carries it into the heredoc. + if helm template kubernetes-nodes-myk8s-md0 packages/apps/kubernetes-nodes -n tenant-test -f "$work/vals.yaml" \ + --set 'talos.installerRepository=reg$(id)`x`y/installer' >/dev/null 2>"$work/err"; then + echo "render accepted an installerRepository holding shell syntax" >&2; rm -rf "$work"; exit 1 + fi + grep -qF "at '/talos/installerRepository'" "$work/err" \ + || { echo "render failed on installerRepository for some other reason:" >&2; cat "$work/err" >&2; rm -rf "$work"; exit 1; } + if helm template kubernetes-nodes-myk8s-md0 packages/apps/kubernetes-nodes -n tenant-test -f "$work/vals.yaml" \ + --skip-schema-validation --set 'talos.installerRepository=reg$(id)`x`y/installer' >/dev/null 2>"$work/err"; then + echo "render without the schema accepted an installerRepository holding shell syntax" >&2; rm -rf "$work"; exit 1 + fi + grep -qF 'is not an OCI repository' "$work/err" \ + || { echo "render without the schema failed on installerRepository for some other reason:" >&2; cat "$work/err" >&2; rm -rf "$work"; exit 1; } + # A repository with a registry port and a digest-like '@' is what the + # pattern lets through, and it must still come out of the shell literally. helm template kubernetes-nodes-myk8s-md0 packages/apps/kubernetes-nodes -n tenant-test -f "$work/vals.yaml" \ - --set 'talos.installerRepository=reg$(id)`x`y/installer' \ + --set 'talos.installerRepository=registry.example.com:5000/talos@mirror/installer' \ --show-only templates/talos-reconcile-job.yaml \ | yq 'select(.kind == "Job") | .spec.template.spec.containers[0].command[2]' \ > "$work/cmd.sh" @@ -123,10 +141,27 @@ VALS grep -q '^cat <&2; rm -rf "$work"; exit 1; } out=$(sh "$work/heredoc.sh" 2>"$work/err") || { echo "kubernetes-nodes heredoc shell exited non-zero" >&2; cat "$work/err" >&2; rm -rf "$work"; exit 1; } [ -n "$out" ] || { echo "kubernetes-nodes heredoc emitted no output" >&2; rm -rf "$work"; exit 1; } - printf '%s' "$out" | grep -qF 'reg$(id)`x`y/installer' || { echo "kubernetes-nodes installerRepository was not preserved literally" >&2; rm -rf "$work"; exit 1; } + printf '%s' "$out" | grep -qF 'registry.example.com:5000/talos@mirror/installer' || { echo "kubernetes-nodes installerRepository was not preserved literally" >&2; rm -rf "$work"; exit 1; } # The default version still reaches both of its sites, so narrowing this test # to installerRepository did not quietly drop the two-site assertion. [ "$(printf '%s' "$out" | grep -cF 'v1.13.12')" -ge 2 ] || { echo "kubernetes-nodes talos.version did not reach both sites" >&2; printf '%s\n' "$out" | grep -iE 'talosVersion|image:' >&2; rm -rf "$work"; exit 1; } + # A registry given as a bracketed IPv6 address is accepted too, and the + # machine config still reads the installer image back as one string. + helm template kubernetes-nodes-myk8s-md0 packages/apps/kubernetes-nodes -n tenant-test -f "$work/vals.yaml" \ + --set 'talos.installerRepository=[fd00::1]:5000/talos/installer' \ + --show-only templates/talos-reconcile-job.yaml \ + | yq 'select(.kind == "Job") | .spec.template.spec.containers[0].command[2]' \ + > "$work/cmd.sh" + [ -s "$work/cmd.sh" ] || { echo "kubernetes-nodes render refused a bracketed IPv6 installerRepository" >&2; rm -rf "$work"; exit 1; } + awk ' + /(^|=\"?\$\()cat < "$work/heredoc.sh" + image=$(sh "$work/heredoc.sh" | yq '.spec.template.spec.data | from_yaml | .machine.install.image') \ + || { echo "kubernetes-nodes machine config with a bracketed IPv6 registry does not parse" >&2; rm -rf "$work"; exit 1; } + [ "$image" = "[fd00::1]:5000/talos/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.13.12" ] \ + || { echo "kubernetes-nodes installer image read back as: $image" >&2; rm -rf "$work"; exit 1; } rm -rf "$work" } diff --git a/hack/tenant-values-line-break_test.bats b/hack/tenant-values-line-break_test.bats new file mode 100644 index 000000000..9c2466cfc --- /dev/null +++ b/hack/tenant-values-line-break_test.bats @@ -0,0 +1,92 @@ +#!/usr/bin/env bats +# Charts that write values into a block scalar must keep each value inside its +# string, also one holding U+0085 (NEL), which YAML reads as a line break. These +# render such charts with a value holding it and check the object around it. +# +# helm-unittest cannot carry the character: it re-encodes the values it is +# given, and the round trip folds U+0085 into a space or refuses it, so these +# render with helm template instead. +# +# Run from the repo root through `make bats-unit-tests`. + +load test_helper + +@test "cozystack-values keeps its kind and keys for a scheduling class holding U+0085" { + tmp=$(mktemp -d) + cat > "$tmp/values.yaml" <<'VALS' +_cluster: {root-host: example.com} +allowedSchedulingClasses: ["gold\u0085kind: ConfigMap\u0085apiVersion: v1\u0085data: {key: value}\u0085z: #"] +VALS + helm template tenant-child packages/apps/tenant --namespace tenant-parent \ + --values "$tmp/values.yaml" --show-only templates/namespace.yaml > "$tmp/out.yaml" 2> "$tmp/err" + kinds=$(yq eval-all '[.kind] | join(",")' "$tmp/out.yaml") + if [ "$kinds" != "Namespace,Secret" ]; then + echo "FAIL: expected a Namespace and a Secret, got: $kinds" + cat "$tmp/out.yaml" + false + fi + if [ "$(yq 'select(.kind == "Secret") | has("data")' "$tmp/out.yaml")" != false ]; then + echo "FAIL: the class name added data to the Secret" + cat "$tmp/out.yaml" + false + fi + classes=$(yq 'select(.kind == "Secret") | .stringData["values.yaml"] | from_yaml | ._namespace.allowedSchedulingClasses | length' "$tmp/out.yaml") + if [ "$classes" != 1 ]; then + echo "FAIL: the class name did not stay one entry of the list ($classes)" + cat "$tmp/out.yaml" + false + fi + rm -rf "$tmp" +} + +@test "the mariadb and postgres regsecret keeps its kind for a registry secret holding U+0085" { + for chart in mariadb postgres; do + tmp=$(mktemp -d) + cat > "$tmp/values.yaml" <<'VALS' +registrySecret: + auths: + registry.example.com: + auth: "x\u0085kind: ConfigMap\u0085data: {key: value}\u0085z: #" +VALS + helm template "$chart-test" "packages/apps/$chart" --namespace tenant-test \ + --values hack/testdata/render-fixtures/configured.yaml --values "$tmp/values.yaml" \ + --show-only templates/regsecret.yaml > "$tmp/out.yaml" 2> "$tmp/err" + if [ "$(yq '.kind' "$tmp/out.yaml")" != Secret ]; then + echo "FAIL: $chart regsecret is no longer a Secret" + cat "$tmp/out.yaml" + false + fi + if [ "$(yq 'has("data")' "$tmp/out.yaml")" != false ]; then + echo "FAIL: the registry secret added data to the $chart regsecret" + cat "$tmp/out.yaml" + false + fi + auths=$(yq '.stringData[".dockerconfigjson"] | from_json | .auths | keys | join(",")' "$tmp/out.yaml") + if [ "$auths" != registry.example.com ]; then + echo "FAIL: the $chart regsecret does not hold the registry secret as given ($auths)" + cat "$tmp/out.yaml" + false + fi + rm -rf "$tmp" + done +} + +@test "the bucket release refuses a user name holding U+0085 rather than writing it into its child release" { + tmp=$(mktemp -d) + cat > "$tmp/values.yaml" <<'VALS' +_namespace: {seaweedfs: tenant-root} +users: {"a\u0085b": {}} +VALS + if helm template bucket-test packages/apps/bucket --namespace tenant-test \ + --values "$tmp/values.yaml" --show-only templates/helmrelease.yaml > "$tmp/out.yaml" 2> "$tmp/err"; then + echo "FAIL: the bucket release rendered a user name YAML cannot carry" + cat "$tmp/out.yaml" + false + fi + if ! grep -q 'users cannot be written as YAML' "$tmp/err"; then + echo "FAIL: the user name was refused for some other reason" + cat "$tmp/err" + false + fi + rm -rf "$tmp" +} diff --git a/packages/apps/bucket/templates/bucketclaim.yaml b/packages/apps/bucket/templates/bucketclaim.yaml index 7c06f51b3..3d0b37332 100644 --- a/packages/apps/bucket/templates/bucketclaim.yaml +++ b/packages/apps/bucket/templates/bucketclaim.yaml @@ -3,6 +3,13 @@ {{- fail "a bucket needs S3, and neither this tenant nor a tenant above it runs SeaweedFS" }} {{- end }} {{- $pool := .Values.storagePool }} +{{- /* A platform user's BucketAccess and Secret take the user name as given; + a tenant user's are named by bucket.accessName, which is always valid. */}} +{{- range $name, $user := .Values.users }} +{{- if and (default false $user.platform) (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" $name)) }} +{{- fail (printf "invalid bucket user name %q: use lowercase letters, digits, \"-\" and \".\", starting and ending with a letter or a digit" $name) }} +{{- end }} +{{- end }} {{- /* COSI classes are cluster-scoped and named after the namespace of the instance that owns them, so a class name built from a storagePool can also be the name @@ -41,7 +48,7 @@ metadata: labels: app.kubernetes.io/instance: {{ .Release.Name }} spec: - bucketClassName: {{ $seaweedfs }}{{- if $pool }}-{{ $pool }}{{- end }}{{- if .Values.locking }}-lock{{- if eq (toString .Values.lockingDefaultRetention) "false" }}-noretention{{- end }}{{- end }} + bucketClassName: {{ printf "%s%s%s" $seaweedfs (ternary (printf "-%s" $pool) "" (not (empty $pool))) (ternary (ternary "-lock-noretention" "-lock" (eq (toString .Values.lockingDefaultRetention) "false")) "" (not (not .Values.locking))) | quote }} protocols: - s3 {{- /* @@ -55,11 +62,11 @@ spec: apiVersion: objectstorage.k8s.io/v1alpha1 kind: BucketAccess metadata: - name: {{ $.Release.Name }}-{{ $name }} + name: {{ printf "%s-%s" $.Release.Name $name | quote }} spec: - bucketAccessClassName: {{ include "bucket.accessClass" (list $ $user) }} + bucketAccessClassName: {{ include "bucket.accessClass" (list $ $user) | quote }} bucketClaimName: {{ $.Release.Name }} - credentialsSecretName: {{ $.Release.Name }}-{{ $name }} + credentialsSecretName: {{ printf "%s-%s" $.Release.Name $name | quote }} protocol: s3 {{- end }} {{- end }} @@ -73,7 +80,7 @@ kind: BucketAccess metadata: name: {{ .Release.Name }}-public-read spec: - bucketAccessClassName: {{ $seaweedfs }}{{- if $pool }}-{{ $pool }}{{- end }}-public + bucketAccessClassName: {{ printf "%s%s-public" $seaweedfs (ternary (printf "-%s" $pool) "" (not (empty $pool))) | quote }} bucketClaimName: {{ .Release.Name }} credentialsSecretName: {{ .Release.Name }}-public-read protocol: s3 diff --git a/packages/apps/bucket/templates/helmrelease.yaml b/packages/apps/bucket/templates/helmrelease.yaml index 7efa17467..8827725eb 100644 --- a/packages/apps/bucket/templates/helmrelease.yaml +++ b/packages/apps/bucket/templates/helmrelease.yaml @@ -22,5 +22,5 @@ spec: name: cozystack-values values: bucketName: {{ .Release.Name }} - users: {{ .Values.users | toJson }} + users: {{- include "cozy-lib.yaml.toYaml" (list .Values.users "users") | nindent 6 }} ui: {{ .Values.ui }} diff --git a/packages/apps/bucket/tests/helmrelease_users_test.yaml b/packages/apps/bucket/tests/helmrelease_users_test.yaml new file mode 100644 index 000000000..63f9f7683 --- /dev/null +++ b/packages/apps/bucket/tests/helmrelease_users_test.yaml @@ -0,0 +1,28 @@ +suite: bucket users reach the bucket-system release +templates: + - templates/helmrelease.yaml + +release: + name: bucket-my-bucket + namespace: tenant-root + +tests: + - it: hands the users on as a map + set: + users: + alice: + readonly: true + Bob_1: {} + asserts: + - equal: + path: spec.values.users + value: + alice: + readonly: true + Bob_1: {} + + - it: hands on an empty map when there are no users + asserts: + - equal: + path: spec.values.users + value: {} diff --git a/packages/apps/bucket/values.schema.json b/packages/apps/bucket/values.schema.json index d7aa1d15d..88c44c6be 100644 --- a/packages/apps/bucket/values.schema.json +++ b/packages/apps/bucket/values.schema.json @@ -16,6 +16,8 @@ "description": "Selects a specific BucketClass by storage pool name.", "type": "string", "default": "", + "maxLength": 63, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$", "x-cozystack-options": { "source": "storagepool" } diff --git a/packages/apps/bucket/values.yaml b/packages/apps/bucket/values.yaml index 5aafb5945..e6927ad31 100644 --- a/packages/apps/bucket/values.yaml +++ b/packages/apps/bucket/values.yaml @@ -5,6 +5,8 @@ locking: false lockingDefaultRetention: true ## @param {string} [storagePool] - Selects a specific BucketClass by storage pool name. +## @maxLength 63 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$ ## @x-cozystack-options {source: storagepool} storagePool: "" diff --git a/packages/apps/clickhouse/templates/backup-cronjob.yaml b/packages/apps/clickhouse/templates/backup-cronjob.yaml index 2a0bbd0b2..fcd3a831f 100644 --- a/packages/apps/clickhouse/templates/backup-cronjob.yaml +++ b/packages/apps/clickhouse/templates/backup-cronjob.yaml @@ -32,7 +32,7 @@ kind: CronJob metadata: name: {{ $cronJobName }} spec: - schedule: "{{ .Values.backup.schedule }}" + schedule: {{ .Values.backup.schedule | quote }} concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 @@ -80,7 +80,7 @@ spec: name: {{ .Release.Name }}-backup key: s3SecretKey - name: AWS_DEFAULT_REGION - value: {{ .Values.backup.s3Region }} + value: {{ .Values.backup.s3Region | quote }} - name: RESTIC_PASSWORD valueFrom: secretKeyRef: diff --git a/packages/apps/clickhouse/templates/backup-secret.yaml b/packages/apps/clickhouse/templates/backup-secret.yaml index d1fd5649e..91a3902f7 100644 --- a/packages/apps/clickhouse/templates/backup-secret.yaml +++ b/packages/apps/clickhouse/templates/backup-secret.yaml @@ -12,7 +12,7 @@ kind: Secret metadata: name: {{ .Release.Name }}-backup stringData: - s3AccessKey: {{ required "s3AccessKey is not specified!" .Values.backup.s3AccessKey }} - s3SecretKey: {{ required "s3SecretKey is not specified!" .Values.backup.s3SecretKey }} - resticPassword: {{ required "resticPassword is not specified!" .Values.backup.resticPassword }} + s3AccessKey: {{ required "s3AccessKey is not specified!" .Values.backup.s3AccessKey | quote }} + s3SecretKey: {{ required "s3SecretKey is not specified!" .Values.backup.s3SecretKey | quote }} + resticPassword: {{ required "resticPassword is not specified!" .Values.backup.resticPassword | quote }} {{- end }} diff --git a/packages/apps/clickhouse/templates/chkeeper.yaml b/packages/apps/clickhouse/templates/chkeeper.yaml index 938581259..07431c54d 100644 --- a/packages/apps/clickhouse/templates/chkeeper.yaml +++ b/packages/apps/clickhouse/templates/chkeeper.yaml @@ -14,7 +14,7 @@ spec: clusters: - name: "cluster1" layout: - replicasCount: {{ .Values.clickhouseKeeper.replicas }} + replicasCount: {{ .Values.clickhouseKeeper.replicas | int }} settings: logger/level: "trace" logger/console: "true" @@ -72,7 +72,7 @@ spec: - ReadWriteOnce resources: requests: - storage: "{{ .Values.clickhouseKeeper.size }}" + storage: {{ .Values.clickhouseKeeper.size | quote }} --- apiVersion: operator.victoriametrics.com/v1beta1 kind: VMPodScrape diff --git a/packages/apps/clickhouse/templates/clickhouse.yaml b/packages/apps/clickhouse/templates/clickhouse.yaml index 05cb9e14c..e08446d12 100644 --- a/packages/apps/clickhouse/templates/clickhouse.yaml +++ b/packages/apps/clickhouse/templates/clickhouse.yaml @@ -17,6 +17,11 @@ {{- if not $backupPassword }} {{- $backupPassword = randAlphaNum 16 }} {{- end }} +{{- range $user, $_ := .Values.users }} + {{- if not (regexMatch "^[A-Za-z_][A-Za-z0-9_.-]*$" $user) }} + {{- fail (printf "invalid username %q: a username may contain only letters, digits and the characters _.- and must start with a letter or an underscore" $user) }} + {{- end }} +{{- end }} {{- $backupRotated := dig "metadata" "annotations" "credentials.cozystack.io/rotated" "" ($existingSecret | default dict) }} apiVersion: v1 @@ -50,9 +55,9 @@ spec: {{- 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"] + {{ printf "%s/password_sha256_hex" $name | quote }}: {{ $verifier | quote }} + {{ printf "%s/profile" $name | quote }}: {{ ternary "readonly" "default" (index $u "readonly" | default false) }} + {{ printf "%s/networks/ip" $name | quote }}: ["::/0"] {{- end }} {{- end }} backup/password_sha256_hex: {{ sha256sum $backupPassword | quote }} @@ -79,7 +84,7 @@ spec: query_log
ENGINE = MergeTree PARTITION BY (event_date) ORDER BY (event_time) - TTL event_date + INTERVAL {{ .Values.logTTL }} DAY DELETE + TTL event_date + INTERVAL {{ .Values.logTTL | int }} DAY DELETE 7500 @@ -88,7 +93,7 @@ spec: query_thread_log
ENGINE = MergeTree PARTITION BY (event_date) ORDER BY (event_time) - TTL event_date + INTERVAL {{ .Values.logTTL }} DAY DELETE + TTL event_date + INTERVAL {{ .Values.logTTL | int }} DAY DELETE 7500 @@ -98,8 +103,8 @@ spec: clusters: - name: "clickhouse" layout: - shardsCount: {{ .Values.shards }} - replicasCount: {{ .Values.replicas }} + shardsCount: {{ .Values.shards | int }} + replicasCount: {{ .Values.replicas | int }} {{- if .Values.clickhouseKeeper.enabled }} zookeeper: nodes: @@ -122,7 +127,7 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ .Values.size }} + storage: {{ .Values.size | quote }} - name: log-volume-template metadata: labels: @@ -132,7 +137,7 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ .Values.logStorageSize }} + storage: {{ .Values.logStorageSize | quote }} podTemplates: - name: clickhouse-per-host metadata: diff --git a/packages/apps/clickhouse/templates/workloadmonitor.yaml b/packages/apps/clickhouse/templates/workloadmonitor.yaml index 62c951c24..c38ca9dd6 100644 --- a/packages/apps/clickhouse/templates/workloadmonitor.yaml +++ b/packages/apps/clickhouse/templates/workloadmonitor.yaml @@ -6,7 +6,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} minReplicas: 1 kind: clickhouse type: clickhouse @@ -22,7 +22,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.clickhouseKeeper.resourcesPreset | quote }} spec: - replicas: {{ .Values.clickhouseKeeper.replicas }} + replicas: {{ .Values.clickhouseKeeper.replicas | int }} minReplicas: 1 kind: clickhouse type: clickhouse diff --git a/packages/apps/clickhouse/tests/backup_cleanup_strategy_test.yaml b/packages/apps/clickhouse/tests/backup_cleanup_strategy_test.yaml new file mode 100644 index 000000000..76c0e623a --- /dev/null +++ b/packages/apps/clickhouse/tests/backup_cleanup_strategy_test.yaml @@ -0,0 +1,75 @@ +suite: backup.cleanupStrategy +# The strategy is word-split into the arguments of `restic forget` in the +# backup script, so the schema holds it to restic's keep flags, long or short, +# each with a value. +release: + name: my-db + namespace: tenant-test +set: + _cluster: + cluster-domain: cozy.local + _namespace: + host: example.com + backup: + enabled: true + schedule: "0 2 * * *" + s3Bucket: s3.example.org/test +tests: + - it: accepts restic's short keep flags + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-l 3 -d 7 -w=4 -m12 -H 24 -y 1" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "-l 3 -d 7 -w=4 -m12 -H 24 -y 1" + + - it: accepts restic's long keep flags + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "--keep-last=3 --keep-daily 3 --keep-within-weekly=1m" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "--keep-last=3 --keep-daily 3 --keep-within-weekly=1m" + + - it: accepts a keep-tag value holding a slash + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "--keep-last=3 --keep-tag=nightly/weekly" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "--keep-last=3 --keep-tag=nightly/weekly" + + - it: refuses a short flag that is not a keep flag + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-r /tmp" + asserts: + - failedTemplate: + errorPattern: "at '/backup/cleanupStrategy'.*does not match pattern" + + - it: refuses a shell metacharacter + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-l 3; echo x" + asserts: + - failedTemplate: + errorPattern: "at '/backup/cleanupStrategy'.*does not match pattern" diff --git a/packages/apps/clickhouse/values.schema.json b/packages/apps/clickhouse/values.schema.json index 6fe521ed4..ba29cb0e8 100644 --- a/packages/apps/clickhouse/values.schema.json +++ b/packages/apps/clickhouse/values.schema.json @@ -181,7 +181,8 @@ "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" + "default": "--keep-last=3 --keep-daily=3 --keep-within-weekly=1m", + "pattern": "^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$" }, "enabled": { "description": "Enable backup integration. Materialises the chart-emitted `\u003crelease\u003e-backup-s3` Secret consumed by the Altinity backup strategy and, when `schedule` is non-empty, also renders the legacy chart-managed CronJob.", @@ -191,7 +192,8 @@ "endpoint": { "description": "DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "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.", @@ -201,12 +203,16 @@ "key": { "description": "Key inside the Secret holding the PEM CA bundle. Defaults to `ca.crt`.", "type": "string", - "default": "ca.crt" + "default": "ca.crt", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "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": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } }, @@ -223,7 +229,8 @@ "s3Bucket": { "description": "DEPRECATED. Optional; see `s3Region`.", "type": "string", - "default": "s3.example.org/clickhouse-backups" + "default": "s3.example.org/clickhouse-backups", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "s3CredentialsSecret": { "description": "DEPRECATED. Pre-existing Secret reference for the legacy chart-emitted sidecar. The platform flow projects `cozy-backups-creds` instead.", @@ -233,44 +240,58 @@ "accessKeyIDKey": { "description": "Key in the Secret holding the access key ID. Defaults to `accessKey`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "bucketKey": { "description": "Key in the Secret holding the bucket name. Defaults to `bucketName`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "endpointKey": { "description": "Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "name": { "description": "Name of the Secret in the application namespace. Empty means the chart materialises `\u003crelease\u003e-backup-s3` from the legacy `s3*` fields.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "regionKey": { "description": "Key in the Secret holding the S3 region. Defaults to `region`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "secretAccessKeyKey": { "description": "Key in the Secret holding the secret access key. Defaults to `secretKey`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" } } }, "s3PathOverride": { "description": "DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "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" + "default": "us-east-1", + "pattern": "^[A-Za-z0-9_.-]*$" }, "s3SecretKey": { "description": "DEPRECATED. Optional; see `s3AccessKey`.", @@ -280,7 +301,8 @@ "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": "" + "default": "", + "pattern": "^[-0-9A-Za-z*/,@? ]*$" }, "useSystemBucket": { "description": "Opt-in: when true, the chart-emitted `\u003crelease\u003e-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 `\u003cnamespace\u003e/\u003crelease\u003e` for cross-tenant isolation. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill any `s3*` field below.", diff --git a/packages/apps/clickhouse/values.yaml b/packages/apps/clickhouse/values.yaml index e4e749df9..09a16350a 100644 --- a/packages/apps/clickhouse/values.yaml +++ b/packages/apps/clickhouse/values.yaml @@ -111,25 +111,47 @@ users: {} ## @typedef {struct} S3CredentialsSecret - Reference to a pre-existing Secret with S3 credentials and bucket coordinates consumed by the chart-emitted `clickhouse-backup` sidecar (rendered into the ClickHouseInstallation Pod by `templates/clickhouse.yaml`). The strategy Pod itself is a curl/jq HTTP client and never reads this Secret. Setting `name` skips the chart-emitted `-backup-s3` Secret in favour of the referenced one. Use this to keep credentials out of the chart values. ## @field {string} [name] - Name of the Secret in the application namespace. Empty means the chart materialises `-backup-s3` from the legacy `s3*` fields. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [bucketKey] - Key in the Secret holding the bucket name. Defaults to `bucketName`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @field {string} [endpointKey] - Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @field {string} [regionKey] - Key in the Secret holding the S3 region. Defaults to `region`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @field {string} [accessKeyIDKey] - Key in the Secret holding the access key ID. Defaults to `accessKey`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @field {string} [secretAccessKeyKey] - Key in the Secret holding the secret access key. Defaults to `secretKey`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @typedef {struct} EndpointCA - Reference to a Secret holding a PEM-encoded CA bundle the `clickhouse-backup` sidecar should trust when reaching an S3 endpoint that serves a certificate signed by a private CA. Cozystack's in-cluster SeaweedFS (`seaweedfs-s3.:8333`) is the common case: it serves TLS signed by the self-signed "SeaweedFS CA", which no system trust store contains. Leave `name` empty for a publicly-trusted endpoint. The Secret must live in the application namespace; copy `ca.crt` out of the seaweedfs CA Secret (`seaweedfs-ca-cert` in the tenant that hosts seaweedfs) to populate it. The bundle is mounted into the sidecar and added to its trust store via `SSL_CERT_DIR`, which *adds* to the system CA set rather than replacing it, so a release configured this way still reaches publicly-trusted endpoints. ## @field {string} [name] - Name of the Secret in the application namespace. Empty (default) mounts nothing and leaves the sidecar on the system trust store only. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [key] - Key inside the Secret holding the PEM CA bundle. Defaults to `ca.crt`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @typedef {struct} Backup - Backup configuration. ## @field {bool} enabled - 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. ## @field {bool} [useSystemBucket] - 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. ## @field {string} [s3Region] - 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. +## @pattern ^[A-Za-z0-9_.-]*$ ## @field {string} [s3Bucket] - DEPRECATED. Optional; see `s3Region`. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [endpoint] - DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [s3PathOverride] - DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [schedule] - 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. +## @pattern ^[-0-9A-Za-z*/,@? ]*$ ## @field {string} [cleanupStrategy] - Legacy. Restic retention policy passed to the legacy CronJob (`restic forget …`). Unused by the Altinity strategy. +## @pattern ^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$ ## @field {string} [s3AccessKey] - 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. ## @field {string} [s3SecretKey] - DEPRECATED. Optional; see `s3AccessKey`. ## @field {string} [resticPassword] - Legacy. Password for Restic backup encryption used by the legacy CronJob. Unused by the Altinity strategy. diff --git a/packages/apps/foundationdb/templates/backup.yaml b/packages/apps/foundationdb/templates/backup.yaml index 129a7b2c7..f0e062dc4 100644 --- a/packages/apps/foundationdb/templates/backup.yaml +++ b/packages/apps/foundationdb/templates/backup.yaml @@ -48,10 +48,10 @@ spec: snapshotPeriodSeconds: 3600 blobStoreConfiguration: - accountName: {{ .Values.backup.s3.bucket }} - bucket: {{ .Values.backup.s3.bucket }} + accountName: {{ .Values.backup.s3.bucket | quote }} + bucket: {{ .Values.backup.s3.bucket | quote }} {{- if .Values.backup.s3.endpoint }} - endpoint: {{ .Values.backup.s3.endpoint }} + endpoint: {{ .Values.backup.s3.endpoint | quote }} {{- end }} credentials: AWS_ACCESS_KEY_ID: diff --git a/packages/apps/foundationdb/templates/cluster.yaml b/packages/apps/foundationdb/templates/cluster.yaml index 379984211..c61e67663 100644 --- a/packages/apps/foundationdb/templates/cluster.yaml +++ b/packages/apps/foundationdb/templates/cluster.yaml @@ -13,8 +13,8 @@ spec: version: {{ include "foundationdb.versionMap" . | quote }} databaseConfiguration: - redundancy_mode: {{ .Values.cluster.redundancyMode }} - storage_engine: {{ .Values.cluster.storageEngine }} + redundancy_mode: {{ .Values.cluster.redundancyMode | quote }} + storage_engine: {{ .Values.cluster.storageEngine | quote }} processCounts: {{- toYaml .Values.cluster.processCounts | nindent 4 }} @@ -32,12 +32,12 @@ spec: # "field not declared in schema". Move all four fields to where the # operator actually reads them. faultDomain: - key: {{ .Values.cluster.faultDomain.key }} + key: {{ .Values.cluster.faultDomain.key | quote }} {{- if .Values.cluster.faultDomain.valueFrom }} - valueFrom: {{ .Values.cluster.faultDomain.valueFrom }} + valueFrom: {{ .Values.cluster.faultDomain.valueFrom | quote }} {{- end }} - imageType: {{ .Values.imageType }} + imageType: {{ .Values.imageType | quote }} labels: filterOnOwnerReference: false @@ -55,7 +55,7 @@ spec: {{- if .Values.customParameters }} customParameters: {{- range .Values.customParameters }} - - {{ . }} + - {{ . | quote }} {{- end }} {{- end }} podTemplate: @@ -65,7 +65,7 @@ spec: spec: serviceAccountName: {{ .Release.Name }}-foundationdb securityContext: - fsGroup: {{ .Values.securityContext.runAsGroup }} + fsGroup: {{ int .Values.securityContext.runAsGroup }} containers: - name: foundationdb resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 16 }} @@ -95,14 +95,14 @@ spec: volumeClaimTemplate: spec: {{- if .Values.storage.storageClass }} - storageClassName: {{ .Values.storage.storageClass }} + storageClassName: {{ .Values.storage.storageClass | quote }} {{- end }} resources: requests: - storage: {{ .Values.storage.size }} + storage: {{ .Values.storage.size | toJson }} routing: - dnsDomain: {{ $clusterDomain }} + dnsDomain: {{ $clusterDomain | quote }} defineDNSLocalityFields: true sidecarContainer: diff --git a/packages/apps/foundationdb/values.schema.json b/packages/apps/foundationdb/values.schema.json index 9190647c4..1f8c93b8c 100644 --- a/packages/apps/foundationdb/values.schema.json +++ b/packages/apps/foundationdb/values.schema.json @@ -34,12 +34,16 @@ "key": { "description": "Fault domain key.", "type": "string", - "default": "kubernetes.io/hostname" + "default": "kubernetes.io/hostname", + "maxLength": 317, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" }, "valueFrom": { "description": "Fault domain value source.", "type": "string", - "default": "spec.nodeName" + "default": "spec.nodeName", + "maxLength": 317, + "pattern": "^[A-Za-z0-9_.$'\\[\\]/-]*$" } } }, @@ -109,6 +113,8 @@ "description": "Storage class (if not set, uses cluster default).", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", @@ -242,7 +248,9 @@ "bucket": { "description": "DEPRECATED S3 bucket name.", "type": "string", - "default": "" + "default": "", + "maxLength": 63, + "pattern": "^([a-z0-9][a-z0-9.-]*[a-z0-9])?$" }, "credentials": { "description": "DEPRECATED S3 credentials.", @@ -268,7 +276,8 @@ "endpoint": { "description": "DEPRECATED S3 endpoint URL.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "region": { "description": "DEPRECATED S3 region.", diff --git a/packages/apps/foundationdb/values.yaml b/packages/apps/foundationdb/values.yaml index 55c83dcce..80a2b5232 100644 --- a/packages/apps/foundationdb/values.yaml +++ b/packages/apps/foundationdb/values.yaml @@ -16,7 +16,11 @@ version: v7.3 ## @typedef {struct} ClusterFaultDomain - Fault domain configuration. ## @field {string} key - Fault domain key. +## @maxLength 317 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$ ## @field {string} valueFrom - Fault domain value source. +## @maxLength 317 +## @pattern ^[A-Za-z0-9_.$'\[\]/-]*$ ## @typedef {struct} Cluster - Cluster configuration. ## @field {ClusterProcessCounts} processCounts - Process counts for different roles. @@ -41,6 +45,8 @@ cluster: ## @typedef {struct} Storage - Storage configuration. ## @field {quantity} size - Size of persistent volumes for each instance. ## @field {string} storageClass - Storage class (if not set, uses cluster default). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} @@ -114,7 +120,10 @@ resourcesPreset: "c1.small" ## @typedef {struct} BackupS3 - DEPRECATED S3 configuration for backups. ## @field {string} bucket - DEPRECATED S3 bucket name. +## @maxLength 63 +## @pattern ^([a-z0-9][a-z0-9.-]*[a-z0-9])?$ ## @field {string} endpoint - DEPRECATED S3 endpoint URL. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} region - DEPRECATED S3 region. ## @field {BackupS3Credentials} credentials - DEPRECATED S3 credentials. diff --git a/packages/apps/harbor/templates/harbor.yaml b/packages/apps/harbor/templates/harbor.yaml index d5313047d..f909ecd48 100644 --- a/packages/apps/harbor/templates/harbor.yaml +++ b/packages/apps/harbor/templates/harbor.yaml @@ -110,7 +110,7 @@ metadata: stringData: admin-password: {{ $adminPassword | quote }} redis-password: {{ $redisPassword | quote }} - url: https://{{ $harborHost }} + url: {{ printf "https://%s" $harborHost | quote }} --- @@ -222,21 +222,21 @@ spec: valuesKey: BucketInfo values: db: - replicas: {{ .Values.database.replicas }} - size: {{ .Values.database.size }} + replicas: {{ .Values.database.replicas | toJson }} + size: {{ .Values.database.size | toJson }} {{- with .Values.storageClass }} - storageClass: {{ . }} + storageClass: {{ . | quote }} {{- end }} redis: - replicas: {{ .Values.redis.replicas }} - size: {{ .Values.redis.size }} + replicas: {{ .Values.redis.replicas | toJson }} + size: {{ .Values.redis.size | toJson }} {{- with .Values.storageClass }} - storageClass: {{ . }} + storageClass: {{ . | quote }} {{- end }} harbor: fullnameOverride: {{ .Release.Name }} harborAdminPassword: {{ $adminPassword | quote }} - externalURL: https://{{ $harborHost }} + externalURL: {{ printf "https://%s" $harborHost | quote }} expose: type: clusterIP clusterIP: @@ -263,7 +263,7 @@ spec: {{- end }} {{- if .Values.trivy.enabled }} trivy: - size: {{ .Values.trivy.size }} + size: {{ .Values.trivy.size | toJson }} {{- with $trivyStorageClass }} storageClass: {{ . | quote }} {{- end }} @@ -293,7 +293,7 @@ spec: jobservice: resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.jobservice.resourcesPreset .Values.jobservice.resources $) | nindent 10 }} trivy: - enabled: {{ .Values.trivy.enabled }} + enabled: {{ .Values.trivy.enabled | toJson }} {{- if .Values.trivy.enabled }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.trivy.resourcesPreset .Values.trivy.resources $) | nindent 10 }} {{- end }} diff --git a/packages/apps/harbor/templates/hooks/cleanup.yaml b/packages/apps/harbor/templates/hooks/cleanup.yaml index 444ece876..b587f6d67 100644 --- a/packages/apps/harbor/templates/hooks/cleanup.yaml +++ b/packages/apps/harbor/templates/hooks/cleanup.yaml @@ -63,6 +63,8 @@ spec: env: - name: HOME value: /tmp + - name: HOST + value: {{ $harborHost | quote }} command: - /bin/sh - -c @@ -138,7 +140,6 @@ spec: # challenge solvers. Filtering Challenges by .spec.dnsName and # solver Ingresses by .spec.rules[0].host keeps us to objects # issued for this release's single Harbor host only. - HOST="{{ $harborHost }}" echo "Sweeping orphaned ACME http01 solvers for host $HOST..." # Each listing is captured before it is iterated. Iterating # $(kubectl get ...) directly cannot distinguish a failed listing diff --git a/packages/apps/harbor/tests/cleanup_hook_test.yaml b/packages/apps/harbor/tests/cleanup_hook_test.yaml index 535380e5a..6e0e934f0 100644 --- a/packages/apps/harbor/tests/cleanup_hook_test.yaml +++ b/packages/apps/harbor/tests/cleanup_hook_test.yaml @@ -84,9 +84,11 @@ tests: # The solver sweep must be scoped to this release's host, not a # namespace-wide label sweep, so sibling apps' in-flight challenges in # the shared tenant namespace are never touched. - - matchRegex: - path: spec.template.spec.containers[0].command[2] - pattern: HOST="harbor-test\.example\.org" + - equal: + path: spec.template.spec.containers[0].env[1] + value: + name: HOST + value: harbor-test.example.org # Challenges are filtered by .spec.dnsName == $HOST. - matchRegex: path: spec.template.spec.containers[0].command[2] @@ -288,3 +290,24 @@ tests: - equal: path: subjects[0].name value: harbor-test-cleanup + + - it: refuses a host that is not a DNS name + set: + host: 'x"; $(id) #' + asserts: + - failedTemplate: + errorPattern: "at '/host'.*does not match pattern" + + - it: keeps the host out of the script text + set: + host: registry.example.com + documentSelector: + path: kind + value: Job + asserts: + - equal: + path: spec.template.spec.containers[0].env[1].value + value: registry.example.com + - notMatchRegex: + path: spec.template.spec.containers[0].command[2] + pattern: registry\.example\.com diff --git a/packages/apps/harbor/values.schema.json b/packages/apps/harbor/values.schema.json index 22a8acd4f..41c3cf0ae 100644 --- a/packages/apps/harbor/values.schema.json +++ b/packages/apps/harbor/values.schema.json @@ -5,7 +5,9 @@ "host": { "description": "Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host).", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "managementWhitelist": { "description": "IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API.", @@ -19,6 +21,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/harbor/values.yaml b/packages/apps/harbor/values.yaml index f0598cfad..83041b64b 100644 --- a/packages/apps/harbor/values.yaml +++ b/packages/apps/harbor/values.yaml @@ -3,12 +3,16 @@ ## ## @param {string} [host] - Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ host: "" ## @param {[]string} [managementWhitelist] - IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API. managementWhitelist: [] ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/kafka/templates/migration-hook.yaml b/packages/apps/kafka/templates/migration-hook.yaml index 3578c9dd8..fc55c4eb7 100644 --- a/packages/apps/kafka/templates/migration-hook.yaml +++ b/packages/apps/kafka/templates/migration-hook.yaml @@ -69,15 +69,18 @@ spec: containers: - name: kubectl image: {{ include "cozy-lib.image" (list "clastix/kubectl:v1.32@sha256:b9ef7d8dbe65bcc81a46c09b8dc7543103055021c4f43287bf59e92a8f4fe05c" $) }} + env: + - name: BROKER_POOL + value: {{ $brokerPool | quote }} + - name: BROKER_MANIFEST + value: {{ include "kafka.brokerPoolManifest" (list $brokerPool $) | quote }} + - name: CONTROLLER_MANIFEST + value: {{ include "kafka.controllerPoolManifest" (list $controllerReplicas $) | quote }} command: [sh, -ec] args: - | set -eu - ns={{ .Release.Namespace | quote }} - name={{ .Release.Name | quote }} - brokerPool={{ $brokerPool | quote }} - # Every apply here passes --openapi-patch=false. Without it, applying # an object that already exists makes kubectl download the cluster's # whole OpenAPI v2 document only to learn that a custom resource @@ -87,89 +90,78 @@ spec: # last-applied annotation. Not --server-side: fields that # "kubectl create" set on a pool stay co-owned by that manager, so # a server-side apply would never remove them. - broker_manifest=$(cat <-kafka-N brokers), "b-" otherwise. Resolved - # at render time by kafka.brokerPoolName. - name: ${brokerPool} - namespace: ${ns} - labels: - strimzi.io/cluster: ${name} - app.kubernetes.io/managed-by: Helm - # Flux puts these on everything it renders, and the lineage - # walk follows them to the application. A pool created here - # has neither them nor an ownerReference, so without them its - # broker and controller pods resolve to no application at all. - helm.toolkit.fluxcd.io/name: ${name} - helm.toolkit.fluxcd.io/namespace: ${ns} - annotations: - meta.helm.sh/release-name: ${name} - meta.helm.sh/release-namespace: ${ns} - spec: - replicas: {{ .Values.kafka.replicas }} - roles: - - broker - resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.kafka.resourcesPreset .Values.kafka.resources $) | nindent 18 }} - storage: - type: jbod - volumes: - - id: 0 - type: persistent-claim - {{- with .Values.kafka.size }} - size: {{ . }} - {{- end }} - {{- with .Values.kafka.storageClass }} - class: {{ . }} - {{- end }} - # Strimzi's PvcReconciler deletes a pool's PVCs when the pool - # is removed; deleteClaim:false leaves the tenant's data on a - # pool teardown. - deleteClaim: false - MANIFEST - ) - - controller_manifest=$(cat <" otherwise. The manifest references the shell var so both resolve here. + # "b-" otherwise. - it: creates the broker node pool under the resolved pool name release: name: test-kafka namespace: tenant-test asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'name: \$\{brokerPool\}' + path: spec.template.spec.containers[0].env[1].value + pattern: 'name: "b-[0-9a-f]{8}"' documentIndex: 3 - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[1].value pattern: "roles:\\n +- broker" documentIndex: 3 @@ -88,8 +88,8 @@ tests: namespace: tenant-test asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'brokerPool="b-[0-9a-f]{8}"' + path: spec.template.spec.containers[0].env[0].value + pattern: '^b-[0-9a-f]{8}$' documentIndex: 3 # The controller pool the hook creates must use the short hashed name @@ -100,11 +100,11 @@ tests: namespace: tenant-test asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'name: c-[0-9a-f]{8}\n' + path: spec.template.spec.containers[0].env[2].value + pattern: 'name: "c-[0-9a-f]{8}"\n' documentIndex: 3 - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[2].value pattern: "roles:\\n +- controller" documentIndex: 3 @@ -121,7 +121,7 @@ tests: replicas: 3 asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[2].value pattern: 'strimzi.io/next-node-ids: "\[3-999\]"' documentIndex: 3 @@ -170,11 +170,11 @@ tests: namespace: tenant-test asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[1].value pattern: "roles:\\s+- broker[\\s\\S]*?resources:\\s+limits:" documentIndex: 3 - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[2].value pattern: "roles:\\s+- controller[\\s\\S]*?resources:\\s+limits:" documentIndex: 3 @@ -191,7 +191,7 @@ tests: pattern: "kubectl[^|\\n]* apply (-f|--filename|--server-side)" - matchRegex: path: spec.template.spec.containers[0].args[0] - pattern: "echo \"\\$broker_manifest\" \\| kubectl apply --openapi-patch=false -f -\\n[\\s\\S]*echo \"\\$controller_manifest\" \\| kubectl apply --openapi-patch=false -f -\\n" + pattern: "printf '%s\\\\n' \"\\$BROKER_MANIFEST\" \\| kubectl apply --openapi-patch=false -f -\\n[\\s\\S]*printf '%s\\\\n' \"\\$CONTROLLER_MANIFEST\" \\| kubectl apply --openapi-patch=false -f -\\n" # The hook only applies the two pools; it needs nothing beyond that. - it: grants only what applying the node pools needs @@ -218,10 +218,16 @@ tests: value: Job asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: "apiVersion: kafka.strimzi.io/v1\\n *kind: KafkaNodePool[\\s\\S]*roles:\\n +- broker[\\s\\S]*apiVersion: kafka.strimzi.io/v1\\n *kind: KafkaNodePool[\\s\\S]*roles:\\n +- controller" + path: spec.template.spec.containers[0].env[1].value + pattern: "apiVersion: kafka.strimzi.io/v1\\nkind: KafkaNodePool[\\s\\S]*roles:\\n +- broker" + - matchRegex: + path: spec.template.spec.containers[0].env[2].value + pattern: "apiVersion: kafka.strimzi.io/v1\\nkind: KafkaNodePool[\\s\\S]*roles:\\n +- controller" - notMatchRegex: - path: spec.template.spec.containers[0].args[0] + path: spec.template.spec.containers[0].env[1].value + pattern: "v1beta2|strimzi.io/kraft|KafkaRebalance" + - notMatchRegex: + path: spec.template.spec.containers[0].env[2].value pattern: "v1beta2|strimzi.io/kraft|KafkaRebalance" - it: keeps the kafka broker pool of a cluster migrated from ZooKeeper @@ -248,9 +254,9 @@ tests: labels: strimzi.io/cluster: test-kafka asserts: - - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'brokerPool="kafka"' + - equal: + path: spec.template.spec.containers[0].env[0].value + value: kafka - it: does not take a kafka broker pool that belongs to another cluster release: @@ -277,8 +283,8 @@ tests: strimzi.io/cluster: other-kafka asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'brokerPool="b-[0-9a-f]{8}"' + path: spec.template.spec.containers[0].env[0].value + pattern: '^b-[0-9a-f]{8}$' # The pools are created by the hook, outside Flux, so they carry the # HelmRelease labels themselves: the lineage walk needs them to resolve @@ -287,16 +293,13 @@ tests: release: name: test-kafka namespace: tenant-test + documentSelector: + path: kind + value: Job asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'name: \$\{brokerPool\}\s+namespace: \$\{ns\}\s+labels:\s+strimzi\.io/cluster: \$\{name\}\s+app\.kubernetes\.io/managed-by: Helm\s+(#[^\n]*\s+)*helm\.toolkit\.fluxcd\.io/name: \$\{name\}\s+helm\.toolkit\.fluxcd\.io/namespace: \$\{ns\}\s+annotations:' - documentSelector: - path: kind - value: Job + path: spec.template.spec.containers[0].env[1].value + pattern: 'name: "b-[0-9a-f]{8}"\s+namespace: "tenant-test"\s+labels:\s+strimzi\.io/cluster: "test-kafka"\s+app\.kubernetes\.io/managed-by: Helm\s+helm\.toolkit\.fluxcd\.io/name: "test-kafka"\s+helm\.toolkit\.fluxcd\.io/namespace: "tenant-test"\s+annotations:\s+meta\.helm\.sh/release-name: "test-kafka"\s+meta\.helm\.sh/release-namespace: "tenant-test"\n' - matchRegex: - path: spec.template.spec.containers[0].args[0] - pattern: 'name: [-a-z0-9]+\s+namespace: \$\{ns\}\s+labels:\s+strimzi\.io/cluster: \$\{name\}\s+app\.kubernetes\.io/managed-by: Helm\s+helm\.toolkit\.fluxcd\.io/name: \$\{name\}\s+helm\.toolkit\.fluxcd\.io/namespace: \$\{ns\}\s+annotations:\s+meta\.helm\.sh/release-name: \$\{name\}\s+meta\.helm\.sh/release-namespace: \$\{ns\}\s+# Controller node IDs' - documentSelector: - path: kind - value: Job + path: spec.template.spec.containers[0].env[2].value + pattern: 'name: "c-[0-9a-f]{8}"\s+namespace: "tenant-test"\s+labels:\s+strimzi\.io/cluster: "test-kafka"\s+app\.kubernetes\.io/managed-by: Helm\s+helm\.toolkit\.fluxcd\.io/name: "test-kafka"\s+helm\.toolkit\.fluxcd\.io/namespace: "tenant-test"\s+annotations:\s+meta\.helm\.sh/release-name: "test-kafka"\s+meta\.helm\.sh/release-namespace: "tenant-test"\s+strimzi\.io/next-node-ids' diff --git a/packages/apps/kafka/tests/topics_test.yaml b/packages/apps/kafka/tests/topics_test.yaml index 74075180e..e58ef8aaa 100644 --- a/packages/apps/kafka/tests/topics_test.yaml +++ b/packages/apps/kafka/tests/topics_test.yaml @@ -100,6 +100,23 @@ tests: - notExists: path: spec.config + # The config map is written into the KafkaTopic as it is, so a key that is + # not a config name would reach it unchecked. + - it: refuses a config key that is not a Kafka topic config name + release: + name: test-kafka + namespace: tenant-test + set: + topics: + - name: orders + partitions: 3 + replicas: 1 + config: + $tplYaml: '{{ print "x" }}' + asserts: + - failedTemplate: + errorPattern: 'topic "orders" config key "\$tplYaml" is not a Kafka topic config name' + - it: refuses a topic config Kafka 4 removed release: name: test-kafka diff --git a/packages/apps/kafka/values.schema.json b/packages/apps/kafka/values.schema.json index 829c27a06..d4428ced3 100644 --- a/packages/apps/kafka/values.schema.json +++ b/packages/apps/kafka/values.schema.json @@ -59,7 +59,9 @@ }, "name": { "description": "Topic name.", - "type": "string" + "type": "string", + "maxLength": 249, + "pattern": "^[a-zA-Z0-9._-]+$" }, "partitions": { "description": "Number of partitions.", @@ -207,6 +209,8 @@ "description": "StorageClass used to store the Kafka data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/kafka/values.yaml b/packages/apps/kafka/values.yaml index 1f600ee59..0045f1a7b 100644 --- a/packages/apps/kafka/values.yaml +++ b/packages/apps/kafka/values.yaml @@ -27,6 +27,8 @@ version: "v4.3" ## @typedef {struct} Topic - Topic configuration. ## @field {string} name - Topic name. +## @maxLength 249 +## @pattern ^[a-zA-Z0-9._-]+$ ## @field {int} partitions - Number of partitions. ## @field {int} replicas - Number of replicas. ## @field {*object} [config] - Topic configuration. @@ -121,6 +123,8 @@ topics: [] ## @field {ResourcesPreset} resourcesPreset - Default sizing preset used when `resources` is omitted. ## @field {quantity} size - Persistent Volume size for Kafka. ## @field {string} storageClass - StorageClass used to store the Kafka data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} ## @field {quantity} [controllerStorageSize] - Persistent Volume size for KRaft controller metadata. diff --git a/packages/apps/kubernetes-nodes/templates/_talosconfigtemplate.tpl b/packages/apps/kubernetes-nodes/templates/_talosconfigtemplate.tpl index d4439c0a3..78c3cce46 100644 --- a/packages/apps/kubernetes-nodes/templates/_talosconfigtemplate.tpl +++ b/packages/apps/kubernetes-nodes/templates/_talosconfigtemplate.tpl @@ -60,6 +60,14 @@ {{- end }} {{- end }} {{- end }} +{{- if not (regexMatch "^([A-Za-z0-9]|\\[[0-9A-Fa-f:.]+\\])[-A-Za-z0-9._:/@]*$" (toString $root.Values.talos.installerRepository)) }} +{{- fail (printf "talos.installerRepository %q is not an OCI repository such as factory.talos.dev/installer" (toString $root.Values.talos.installerRepository)) }} +{{- end }} +{{- with $root.Values.talos.registryMirrors }} +{{- if regexMatch `[\r\x{85}\x{2028}\x{2029}]` (toYaml .) }} +{{- fail "talos.registryMirrors must not contain carriage returns or Unicode line separators" }} +{{- end }} +{{- end }} {{- $kubeletVersion := include "kubernetes.versionMap" $root | trim }} {{- /* Resolve this pool's worker image (schematicID, version) from .Values.osImage — the same selection templates/nodegroup.yaml uses for the boot disk — so the @@ -278,7 +286,13 @@ spec: memory.available: "256Mi" install: disk: /dev/vda - image: {{ $root.Values.talos.installerRepository | trimSuffix "/" | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`" }}/{{ $talosSchematicID | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`" }}:{{ $talosVersion | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`" }} + {{- $installerImage := printf "%s/%s:%s" ($root.Values.talos.installerRepository | trimSuffix "/" | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`") ($talosSchematicID | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`") ($talosVersion | replace "\\" "\\\\" | replace "$" "\\$" | replace "`" "\\`") }} + {{- /* A plain scalar that opens with "[" is a YAML flow sequence, so a + registry given as a bracketed IPv6 address is quoted. Every + other image stays unquoted: this spec is hashed into the + TalosConfigTemplate name, and requoting it would roll every + pool. */}} + image: {{ if hasPrefix "[" $installerImage }}"{{ $installerImage }}"{{ else }}{{ $installerImage }}{{ end }} wipe: false features: rbac: true diff --git a/packages/apps/kubernetes-nodes/templates/nodegroup.yaml b/packages/apps/kubernetes-nodes/templates/nodegroup.yaml index f24efd72f..f9750387b 100644 --- a/packages/apps/kubernetes-nodes/templates/nodegroup.yaml +++ b/packages/apps/kubernetes-nodes/templates/nodegroup.yaml @@ -28,6 +28,16 @@ {{- include "kubernetes-nodes.assertParentVersion" . }} {{- include "kubernetes-nodes.assertSubstrateMatches" . }} {{- $kubevirtmachinetemplateNames := list }} +{{- range $i, $role := .Values.roles | default list }} +{{- if not (and (le (len (toString $role)) 63) (regexMatch "^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" (toString $role))) }} +{{- fail (printf "roles[%d] is %q: a role becomes the label node-role.kubernetes.io/, so it must be at most 63 letters, digits, '-', '_' or '.', starting and ending with a letter or digit" $i (toString $role)) }} +{{- end }} +{{- end }} +{{- range $i, $gpu := .Values.gpus | default list }} +{{- if not (regexMatch "^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" (toString (dig "name" "" $gpu))) }} +{{- fail (printf "gpus[%d].name is %q: it must be a resource name such as nvidia.com/AD102GL_L40S" $i (toString (dig "name" "" $gpu))) }} +{{- end }} +{{- end }} {{- /* Substrate selects which infrastructure provider renders this pool's machine template. Everything downstream of the template — autoscaler capacity annotations, kubelet reservations, MachineDeployment, @@ -1181,7 +1191,7 @@ spec: {{- else }} {{- fail (printf "maxUnhealthy must be a bare integer (e.g. 0, 1) or an integer percentage (e.g. 50%%), got %q" $maxUnhealthy) }} {{- end }} - nodeStartupTimeout: {{ $.Values.nodeStartupTimeout }} + nodeStartupTimeout: {{ $.Values.nodeStartupTimeout | quote }} selector: matchLabels: cluster.x-k8s.io/cluster-name: {{ $clusterName }} diff --git a/packages/apps/kubernetes-nodes/values.schema.json b/packages/apps/kubernetes-nodes/values.schema.json index 22855a41d..352a292fd 100644 --- a/packages/apps/kubernetes-nodes/values.schema.json +++ b/packages/apps/kubernetes-nodes/values.schema.json @@ -159,6 +159,8 @@ "name": { "description": "Name of GPU, such as \"nvidia.com/AD102GL_L40S\".", "type": "string", + "maxLength": 317, + "pattern": "^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$", "x-cozystack-options": { "source": "gpu" } @@ -241,7 +243,8 @@ "nodeStartupTimeout": { "description": "Maximum time a Machine is allowed to spend reaching the Ready condition before it is remediated. Raise for slow first boots (the Talos image import from the Image Factory, or a storage class slow to provision or clone the worker disk). The MachineHealthCheck measures it from the later of the Machine's creation and its InfrastructureReady transition, so the clock restarts when the infrastructure reports ready: a worker gets this long for the disk image import and the VM to come up, and then this long again for the guest to boot and its kubelet to register with the tenant apiserver. Either leg stretches on a host under load, and a Machine remediated here is deleted before it ever joins, so its replacement starts the same sequence from the beginning.", "type": "string", - "default": "20m" + "default": "20m", + "pattern": "^(0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+)$" }, "readyUnknownTimeout": { "description": "How long a worker Node may report `Ready=Unknown` before the MachineHealthCheck remediates the Machine, which for a KubeVirt worker means deleting the VM. `Ready=Unknown` is what the node lifecycle controller writes once it stops hearing from a kubelet, on a grace period of its own, so the wall clock from a guest going quiet to a deleted worker is this value plus that grace period. A guest starved of CPU stops answering long before it is dead, so a value of a few tens of seconds deletes workers that would have come back on their own. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips.", @@ -335,7 +338,8 @@ "installerRepository": { "description": "OCI repository prefix for the Talos installer image, written into the worker machine config as `machine.install.image`. Resolved as `\u003cinstallerRepository\u003e/\u003cschematicID\u003e:\u003cversion\u003e` against whatever this pool's `osImage` pins, falling back to `talos.schematicID` and `talos.version` — so the installer matches the OS the pool actually booted. The prefix itself has no `osImage.*` override, so an air-gapped pool needs it pointed at a reachable registry as well. Defaults to the public factory's installer path. Override for air-gapped or mirrored registries. No trailing slash.", "type": "string", - "default": "factory.talos.dev/installer" + "default": "factory.talos.dev/installer", + "pattern": "^([A-Za-z0-9]|\\[[0-9A-Fa-f:.]+\\])[-A-Za-z0-9._:/@]*$" }, "registryMirrors": { "description": "Talos `machine.registries.mirrors` passthrough for worker nodes: a map of upstream registry host to `{ endpoints: [ ... ] }`. Empty by default, so workers pull container images (the Talos `kubelet` image included) directly from the upstream registry. Point a host such as `ghcr.io` at an in-cluster pull-through mirror for air-gapped, rate-limited, or flaky-egress environments so a worker's boot does not depend on live public egress. Talos still falls back to the upstream registry unless a host also sets `skipFallback: true`, so a mirror alone does not enforce air-gap. This value is part of the worker machine config, whose content hash names the TalosConfigTemplate, so changing it rolls every existing worker in the pool rather than only affecting nodes created later.", diff --git a/packages/apps/kubernetes-nodes/values.yaml b/packages/apps/kubernetes-nodes/values.yaml index a53eb8138..a9531855c 100644 --- a/packages/apps/kubernetes-nodes/values.yaml +++ b/packages/apps/kubernetes-nodes/values.yaml @@ -50,6 +50,8 @@ storageClass: replicated ## @typedef {struct} GPU - GPU configuration. ## @field {string} name - Name of GPU, such as "nvidia.com/AD102GL_L40S". +## @maxLength 317 +## @pattern ^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$ ## @x-cozystack-options {source: gpu} ## @typedef {struct} KernelModule - Kernel module loaded on the worker at boot. @@ -106,6 +108,7 @@ logSerialConsole: false maxUnhealthy: "50%" ## @param {string} nodeStartupTimeout="20m" - Maximum time a Machine is allowed to spend reaching the Ready condition before it is remediated. Raise for slow first boots (the Talos image import from the Image Factory, or a storage class slow to provision or clone the worker disk). The MachineHealthCheck measures it from the later of the Machine's creation and its InfrastructureReady transition, so the clock restarts when the infrastructure reports ready: a worker gets this long for the disk image import and the VM to come up, and then this long again for the guest to boot and its kubelet to register with the tenant apiserver. Either leg stretches on a host under load, and a Machine remediated here is deleted before it ever joins, so its replacement starts the same sequence from the beginning. +## @pattern ^(0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+)$ nodeStartupTimeout: "20m" ## @param {string} readyUnknownTimeout="5m" - How long a worker Node may report `Ready=Unknown` before the MachineHealthCheck remediates the Machine, which for a KubeVirt worker means deleting the VM. `Ready=Unknown` is what the node lifecycle controller writes once it stops hearing from a kubelet, on a grace period of its own, so the wall clock from a guest going quiet to a deleted worker is this value plus that grace period. A guest starved of CPU stops answering long before it is dead, so a value of a few tens of seconds deletes workers that would have come back on their own. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips. @@ -157,6 +160,7 @@ osImage: {} ## @field {string} schematicID - Talos image-factory schematic ID. Defaults to the cozystack-tested vanilla schematic. Operators using custom schematics (system extensions, kernel args) override here. The pool can pin its own via `osImage.builtin.schematicID` or `osImage.factory.schematicID`; when `osImage` omits it, this value applies. Whichever of the two applies is interpolated into an image URL and a DataVolume name, so it must be a plain lowercase alphanumeric identifier -- the render refuses anything else. A custom schematic on `osImage.builtin` also needs its own catalog entry, since the golden is named from the schematic ID. ## @field {string} imageFactoryURL - Default base URL of the Talos Image Factory that serves the worker OS disk image (the `openstack-amd64.raw.xz` raw artifact streamed in by CDI over HTTP). Applies only when this pool imports over HTTP — the default and `osImage.factory`, which overrides it via `osImage.factory.imageFactoryURL`. A pool on `osImage.builtin` clones a golden image from the worker image catalog and does not use this field at all. Defaults to the public factory. Point at a self-hosted Image Factory, a caching mirror, or an internal HTTP file server for air-gapped, rate-limited, or flaky-egress environments. No trailing slash. It is interpolated into the worker DataVolume source URL, so on those HTTP paths it must be a plain `http(s)` URL and the render refuses anything else; a pool on `osImage.builtin` builds no such URL and is not held to it, so blanking this field there is legal. On `substrate: proxmox` the workers clone a VM template that already carries the OS, so this field has no effect there beyond that format check. ## @field {string} installerRepository - OCI repository prefix for the Talos installer image, written into the worker machine config as `machine.install.image`. Resolved as `/:` against whatever this pool's `osImage` pins, falling back to `talos.schematicID` and `talos.version` — so the installer matches the OS the pool actually booted. The prefix itself has no `osImage.*` override, so an air-gapped pool needs it pointed at a reachable registry as well. Defaults to the public factory's installer path. Override for air-gapped or mirrored registries. No trailing slash. +## @pattern ^([A-Za-z0-9]|\[[0-9A-Fa-f:.]+\])[-A-Za-z0-9._:/@]*$ ## @field {object} registryMirrors - Talos `machine.registries.mirrors` passthrough for worker nodes: a map of upstream registry host to `{ endpoints: [ ... ] }`. Empty by default, so workers pull container images (the Talos `kubelet` image included) directly from the upstream registry. Point a host such as `ghcr.io` at an in-cluster pull-through mirror for air-gapped, rate-limited, or flaky-egress environments so a worker's boot does not depend on live public egress. Talos still falls back to the upstream registry unless a host also sets `skipFallback: true`, so a mirror alone does not enforce air-gap. This value is part of the worker machine config, whose content hash names the TalosConfigTemplate, so changing it rolls every existing worker in the pool rather than only affecting nodes created later. ## @field {map[string]string} sysctls - Sysctl overrides rendered into Talos `machine.sysctls` on this pool's guest workers only. Values must be strings (quote numeric values); for example, `user.max_user_namespaces: "11255"` enables the user namespaces required by the Talos gVisor extension. An empty map preserves Talos defaults and the existing bootstrap hash. Adding, changing or removing an override changes the content-hashed TalosConfigTemplate and rolls the pool's workers. Supported names and values depend on the worker's Talos release and kernel; unsafe settings can weaken guest isolation or prevent workers from booting. This does not install gVisor or configure a RuntimeClass, and does not change the management hosts, control plane or other pools. ## @field {string} [imageFactoryCA] - Complete PEM certificate block(s) CDI must trust when importing this pool's worker OS disk image over HTTPS — the no-osImage default and `osImage.factory` path. Empty by default, so the importer uses only its system trust store, which is what the public factory needs. Set this when the factory in use (`imageFactoryURL` or `osImage.factory.imageFactoryURL`) is a self-hosted factory or mirror served by an internal CA, which the importer otherwise rejects with `x509: certificate signed by unknown authority`. The chart renders it into a ConfigMap in the release namespace — CDI requires certConfigMap to sit alongside the DataVolume — and references that from the worker DataVolume's `source.http.certConfigMap`; CDI appends it to the system pool rather than replacing it, so a publicly-trusted endpoint verifies either way. A pool on `osImage.builtin` clones a golden image and builds no HTTP source, so this field has no effect there. On `substrate: proxmox` it has no effect on the workers either: the ConfigMap is still rendered, but nothing references it. diff --git a/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml b/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml index 65345fead..dd74c9e68 100644 --- a/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml +++ b/packages/apps/kubernetes/templates/ccm-proxmox/controller.yaml @@ -71,7 +71,7 @@ spec: { echo "clusters:" echo " - url: $(cat /proxmox-credentials/url)" - echo " insecure: {{ .Values.proxmox.insecure }}" + echo " insecure: {{ eq (toString .Values.proxmox.insecure) "true" }}" echo " token_id: $(cat /proxmox-credentials/token_id)" echo " token_secret: $(cat /proxmox-credentials/token_secret)" echo " region: $(cat /proxmox-credentials/region)" diff --git a/packages/apps/kubernetes/templates/cluster.yaml b/packages/apps/kubernetes/templates/cluster.yaml index df0d2bccd..0f68bb578 100644 --- a/packages/apps/kubernetes/templates/cluster.yaml +++ b/packages/apps/kubernetes/templates/cluster.yaml @@ -179,6 +179,18 @@ {{- if not (has $mountName $userVolumeNames) }} {{- fail (printf "controlPlane.apiServer.extraVolumeMounts: mount %q references no volume declared in controlPlane.apiServer.extraVolumes — the chart-managed talos volumes cannot be mounted" $mountName) }} {{- end }} +{{- range $field, $_ := $mount }} +{{- if not (has $field (list "name" "mountPath" "mountPropagation" "readOnly" "recursiveReadOnly" "subPath" "subPathExpr")) }} +{{- fail (printf "controlPlane.apiServer.extraVolumeMounts: mount %q sets %q, which is not a field of a volume mount" $mountName $field) }} +{{- end }} +{{- end }} +{{- end }} +{{- /* Every addon's valuesOverride becomes the values of another chart, and + some charts render the value under a "$tplYaml" key with tpl. */}} +{{- range $addon, $settings := .Values.addons }} +{{- if kindIs "map" $settings }} +{{- include "cozy-lib.yaml.assertNoTemplateKeys" (list (printf "addons.%s.valuesOverride" $addon) (get $settings "valuesOverride")) }} +{{- end }} {{- end }} {{- /* Mirrors the `managed` map of buildKubeAPIServerCommand in Kamaji's @@ -690,7 +702,7 @@ spec: {{- if not (or $keptExtraArgs $oidcEnabled) }} []{{ end }} extraVolumeMounts: {{- with .Values.controlPlane.apiServer.extraVolumeMounts }} - {{- toYaml . | nindent 6 }} + {{- include "cozy-lib.yaml.toYaml" (list . "controlPlane.apiServer.extraVolumeMounts") | nindent 6 }} {{- end }} {{- if $oidcEnabled }} - name: authentication-config @@ -743,7 +755,7 @@ spec: ingress: extraAnnotations: nginx.ingress.kubernetes.io/ssl-passthrough: "true" - hostname: {{ .Values.host | default (printf "%s.%s" .Release.Name (include "cozy-lib.ns-host-required" .)) }}:443 + hostname: {{ printf "%s:443" (.Values.host | default (printf "%s.%s" .Release.Name (include "cozy-lib.ns-host-required" .))) | quote }} className: "{{ $ingress }}" additionalServicePorts: - name: talos-trustd @@ -821,12 +833,12 @@ spec: secret: secretName: {{ .Release.Name }}-talos-tls-cert {{- with .Values.controlPlane.apiServer.extraVolumes }} - {{- toYaml . | nindent 6 }} + {{- include "cozy-lib.yaml.toYaml" (list . "controlPlane.apiServer.extraVolumes") | nindent 6 }} {{- end }} {{- if $oidcEnabled }} - name: authentication-config secret: - secretName: {{ $oidcAuthnSecret }} + secretName: {{ $oidcAuthnSecret | quote }} items: - key: config.yaml path: config.yaml diff --git a/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml b/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml index 9c05981cb..8cf5c3bb0 100644 --- a/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml +++ b/packages/apps/kubernetes/templates/csi-proxmox/controller.yaml @@ -84,7 +84,7 @@ spec: { echo "clusters:" echo " - url: $(cat /proxmox-credentials/url)" - echo " insecure: {{ .Values.proxmox.insecure }}" + echo " insecure: {{ eq (toString .Values.proxmox.insecure) "true" }}" echo " token_id: $(cat /proxmox-credentials/token_id)" echo " token_secret: $(cat /proxmox-credentials/token_secret)" echo " region: $(cat /proxmox-credentials/region)" diff --git a/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml b/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml index df6caae17..66cbc4fd0 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cert-manager-crds.yaml @@ -42,7 +42,6 @@ kind: Secret metadata: name: {{ .Release.Name }}-cert-manager-crds-values-override stringData: - values: | - {{- toYaml .Values.addons.certManager.valuesOverride | nindent 4 }} + values: {{ printf "%s\n" (include "cozy-lib.yaml.toYaml" (list .Values.addons.certManager.valuesOverride "addons.certManager.valuesOverride")) | quote }} {{- end }} {{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml b/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml index 94e6c28e0..2358251f1 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cert-manager.yaml @@ -39,7 +39,7 @@ spec: remediation: retries: -1 values: - {{- toYaml (deepCopy .Values.addons.certManager.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCertManagerValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.certManager.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCertManagerValues" .))) "addons.certManager.valuesOverride") | nindent 4 }} dependsOn: - name: {{ .Release.Name }}-cilium namespace: {{ .Release.Namespace }} diff --git a/packages/apps/kubernetes/templates/helmreleases/cilium.yaml b/packages/apps/kubernetes/templates/helmreleases/cilium.yaml index 9fd234209..d012bc4e2 100644 --- a/packages/apps/kubernetes/templates/helmreleases/cilium.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/cilium.yaml @@ -78,7 +78,7 @@ spec: remediation: retries: -1 values: - {{- toYaml (deepCopy .Values.addons.cilium.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCiliumValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.cilium.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCiliumValues" .))) "addons.cilium.valuesOverride") | nindent 4 }} {{- if $.Values.addons.gatewayAPI.enabled }} dependsOn: - name: {{ .Release.Name }}-gateway-api-crds diff --git a/packages/apps/kubernetes/templates/helmreleases/coredns.yaml b/packages/apps/kubernetes/templates/helmreleases/coredns.yaml index b9da38a26..c2d263ad3 100644 --- a/packages/apps/kubernetes/templates/helmreleases/coredns.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/coredns.yaml @@ -33,4 +33,4 @@ spec: remediation: retries: -1 values: - {{- toYaml (deepCopy .Values.addons.coredns.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCoreDNSValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.coredns.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultCoreDNSValues" .))) "addons.coredns.valuesOverride") | nindent 4 }} diff --git a/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml b/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml index ffb08671b..6f02270f5 100644 --- a/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/csi-proxmox.yaml @@ -14,6 +14,29 @@ byte-for-byte what it rendered before Proxmox existed. */}} {{- if eq (.Values.substrate | default "kubevirt") "proxmox" }} {{- if .Values.proxmox.csi.enabled }} +{{- /* The vendored chart writes each storage class field into its StorageClass + unquoted, so every one is held to what Kubernetes and Proxmox accept + there before it is handed on. */}} +{{- range $i, $sc := .Values.proxmox.csi.storageClasses }} +{{- $name := toString (dig "name" "" $sc) }} +{{- if not (and (le (len $name) 253) (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" $name)) }} +{{- fail (printf "proxmox.csi.storageClasses[%d].name is %q: a StorageClass name must be a DNS subdomain such as fast-ssd" $i $name) }} +{{- end }} +{{- $storage := toString (dig "storage" "" $sc) }} +{{- if not (regexMatch "^[A-Za-z]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" $storage) }} +{{- fail (printf "proxmox.csi.storageClasses[%d].storage is %q: a Proxmox storage id starts with a letter and holds letters, digits, '-', '_' and '.'" $i $storage) }} +{{- end }} +{{- with dig "fstype" "" $sc }} +{{- if not (has (toString .) (list "ext4" "xfs")) }} +{{- fail (printf "proxmox.csi.storageClasses[%d].fstype is %q: use ext4 or xfs" $i (toString .)) }} +{{- end }} +{{- end }} +{{- with dig "reclaimPolicy" "" $sc }} +{{- if not (has (toString .) (list "Delete" "Retain")) }} +{{- fail (printf "proxmox.csi.storageClasses[%d].reclaimPolicy is %q: use Delete or Retain" $i (toString .)) }} +{{- end }} +{{- end }} +{{- end }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml b/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml index 6fa71353a..1256de470 100644 --- a/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/gpu-operator.yaml @@ -100,7 +100,7 @@ spec: {{- $merged := mergeOverwrite (default (dict) $defaults) $overrides }} {{- if $merged }} values: - {{- toYaml $merged | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list $merged "addons.gpuOperator.valuesOverride") | nindent 4 }} {{- end }} dependsOn: diff --git a/packages/apps/kubernetes/templates/helmreleases/hami.yaml b/packages/apps/kubernetes/templates/helmreleases/hami.yaml index aabbdf3f0..6581a2fa2 100644 --- a/packages/apps/kubernetes/templates/helmreleases/hami.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/hami.yaml @@ -33,7 +33,7 @@ spec: retries: -1 {{- with .Values.addons.hami.valuesOverride }} values: - {{- toYaml . | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list . "addons.hami.valuesOverride") | nindent 4 }} {{- end }} dependsOn: diff --git a/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml b/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml index 16aa2d163..12743f9aa 100644 --- a/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/ingress-nginx.yaml @@ -58,7 +58,7 @@ spec: remediation: retries: -1 values: - {{- toYaml (deepCopy .Values.addons.ingressNginx.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultIngressValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.ingressNginx.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultIngressValues" .))) "addons.ingressNginx.valuesOverride") | nindent 4 }} dependsOn: - name: {{ .Release.Name }}-cilium namespace: {{ .Release.Namespace }} diff --git a/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml b/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml index 76037f10a..501972a00 100644 --- a/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml @@ -116,5 +116,5 @@ spec: - name: {{ .Release.Name }}-metrics-server namespace: {{ .Release.Namespace }} values: - {{- toYaml $values | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list $values "addons.monitoringAgents.valuesOverride") | nindent 4 }} {{- end }} diff --git a/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml b/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml index a94b0ad1f..8f52af311 100644 --- a/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/ouroboros.yaml @@ -157,7 +157,7 @@ spec: addons.gatewayAPI.enabled=false CrashLoops the controller on WaitForCacheSync against missing GVRs. Both are documented on the OuroborosAddon field. */ -}} - {{- toYaml (deepCopy .Values.addons.ouroboros.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultOuroborosValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.ouroboros.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultOuroborosValues" .))) "addons.ouroboros.valuesOverride") | nindent 4 }} dependsOn: - name: {{ .Release.Name }}-cilium namespace: {{ .Release.Namespace }} diff --git a/packages/apps/kubernetes/templates/helmreleases/velero.yaml b/packages/apps/kubernetes/templates/helmreleases/velero.yaml index 86a6a224f..5bd4a5e44 100644 --- a/packages/apps/kubernetes/templates/helmreleases/velero.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/velero.yaml @@ -30,7 +30,7 @@ spec: retries: -1 {{- with .Values.addons.velero.valuesOverride }} values: - {{- toYaml . | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list . "addons.velero.valuesOverride") | nindent 4 }} {{- end }} dependsOn: diff --git a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml index 3735f392f..1a63a813e 100644 --- a/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml +++ b/packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml @@ -55,7 +55,7 @@ spec: remediation: retries: -1 values: - {{- toYaml (deepCopy .Values.addons.verticalPodAutoscaler.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultVPAValues" .))) | nindent 4 }} + {{- include "cozy-lib.yaml.toYaml" (list (deepCopy .Values.addons.verticalPodAutoscaler.valuesOverride | mergeOverwrite (fromYaml (include "cozystack.defaultVPAValues" .))) "addons.verticalPodAutoscaler.valuesOverride") | nindent 4 }} dependsOn: - name: {{ .Release.Name }}-monitoring-agents namespace: {{ .Release.Namespace }} diff --git a/packages/apps/kubernetes/templates/oidc-authn-config.yaml b/packages/apps/kubernetes/templates/oidc-authn-config.yaml index 8fe2e93b2..814327875 100644 --- a/packages/apps/kubernetes/templates/oidc-authn-config.yaml +++ b/packages/apps/kubernetes/templates/oidc-authn-config.yaml @@ -102,7 +102,6 @@ metadata: {{- include "kubernetes.labels" . | nindent 4 }} type: Opaque stringData: - config.yaml: | -{{ $inlineCfg | indent 4 }} + config.yaml: {{ printf "%s\n" (regexReplaceAll "\n+$" $inlineCfg "") | quote }} {{- end }} {{- end }} diff --git a/packages/apps/kubernetes/templates/oidc-rbac-job.yaml b/packages/apps/kubernetes/templates/oidc-rbac-job.yaml index 8556d092b..db318f49b 100644 --- a/packages/apps/kubernetes/templates/oidc-rbac-job.yaml +++ b/packages/apps/kubernetes/templates/oidc-rbac-job.yaml @@ -159,9 +159,9 @@ spec: - name: KUBECONFIG_TENANT value: /etc/kubernetes/kubeconfig/super-admin.svc - name: RELEASE - value: {{ .Release.Name }} + value: {{ .Release.Name | quote }} - name: RELEASE_NAMESPACE - value: {{ .Release.Namespace }} + value: {{ .Release.Namespace | quote }} - name: OIDC_MODE value: {{ .Values.oidc.mode | quote }} - name: OIDC_CLIENT_ID @@ -172,6 +172,8 @@ spec: value: {{ printf "https://%s:443" $externalHost | quote }} - name: OIDC_BINDINGS_DIR value: /etc/oidc-bindings + - name: KCP_PATCH + value: {{ dict "spec" (dict "apiServer" (dict "extraArgs" (include "kubernetes.apiServer.keptExtraArgs" . | fromJsonArray) "extraVolumeMounts" (default (list) .Values.controlPlane.apiServer.extraVolumeMounts)) "deployment" (dict "extraVolumes" (concat (list (dict "name" "talos-ca" "secret" (dict "secretName" (printf "%s-talos-ca" .Release.Name))) (dict "name" "talos-tls-cert" "secret" (dict "secretName" (printf "%s-talos-tls-cert" .Release.Name)))) (default (list) .Values.controlPlane.apiServer.extraVolumes)))) | toJson | quote }} resources: requests: cpu: 10m @@ -200,11 +202,7 @@ spec: # SSA field-owner refuses to release) are stripped. kubectl --namespace "$RELEASE_NAMESPACE" patch kamajicontrolplane "$RELEASE" \ --type=merge \ - --patch {{ printf "{\"spec\":{\"apiServer\":{\"extraArgs\":%s,\"extraVolumeMounts\":%s},\"deployment\":{\"extraVolumes\":%s}}}" - (include "kubernetes.apiServer.keptExtraArgs" .) - (default (list) .Values.controlPlane.apiServer.extraVolumeMounts | toJson) - (concat (list (dict "name" "talos-ca" "secret" (dict "secretName" (printf "%s-talos-ca" .Release.Name))) (dict "name" "talos-tls-cert" "secret" (dict "secretName" (printf "%s-talos-tls-cert" .Release.Name)))) (default (list) .Values.controlPlane.apiServer.extraVolumes) | toJson) - | quote }} + --patch "$KCP_PATCH" # 2. Chart-owned OIDC Secrets — Helm's SSA-based delete-on-absence # also fails here (same field-ownership pattern). Explicit diff --git a/packages/apps/kubernetes/tests/addons_values_override_keys_test.yaml b/packages/apps/kubernetes/tests/addons_values_override_keys_test.yaml new file mode 100644 index 000000000..abfa667f8 --- /dev/null +++ b/packages/apps/kubernetes/tests/addons_values_override_keys_test.yaml @@ -0,0 +1,45 @@ +suite: addons valuesOverride keys + +templates: + - templates/cluster.yaml + +values: + - values/common.yaml + +release: + name: test-k8s + namespace: tenant-test + +# Every addon's valuesOverride becomes the values of another chart, and charts +# that follow the NATS chart's convention render the value under a "$tplYaml" +# key with tpl, so such a key is refused. + +tests: + - it: lets an override through that holds no $tplYaml key + set: + addons.cilium.valuesOverride: + cilium: + podAnnotations: + example.com/tplYaml: "x" + asserts: + - isKind: + of: KamajiControlPlane + documentIndex: 1 + + - it: rejects a $tplYaml key at the top of an override + set: + addons.coredns.valuesOverride: + $tplYaml: '{{ print "x" }}' + asserts: + - failedTemplate: + errorMessage: 'addons.coredns.valuesOverride: key "$tplYaml" is not allowed, as charts that follow the NATS chart''s convention run its value as a template' + + - it: rejects a $tplYaml key nested inside an override + set: + addons.cilium.valuesOverride: + cilium: + hubble: + - $tplYamlSpread: '{{ print "x" }}' + asserts: + - failedTemplate: + errorMessage: 'addons.cilium.valuesOverride.cilium.hubble[0]: key "$tplYamlSpread" is not allowed, as charts that follow the NATS chart''s convention run its value as a template' diff --git a/packages/apps/kubernetes/tests/apiserver_authentication_test.yaml b/packages/apps/kubernetes/tests/apiserver_authentication_test.yaml index 7d642435f..895573727 100644 --- a/packages/apps/kubernetes/tests/apiserver_authentication_test.yaml +++ b/packages/apps/kubernetes/tests/apiserver_authentication_test.yaml @@ -378,3 +378,22 @@ tests: asserts: - failedTemplate: errorMessage: 'controlPlane.apiServer.extraVolumeMounts[0]: every mount must set a non-empty name' + + - it: rejects a mount field that a volume mount does not have + # The mount is handed to the KamajiControlPlane as written, so a key the + # VolumeMount shape lacks would reach it unchecked. + release: + name: test-k8s + namespace: tenant-test + set: + controlPlane.apiServer.extraVolumes: + - name: authn + configMap: + name: authn + controlPlane.apiServer.extraVolumeMounts: + - name: authn + mountPath: /etc/kubernetes/authn + $tplYaml: '{{ print "x" }}' + asserts: + - failedTemplate: + errorMessage: 'controlPlane.apiServer.extraVolumeMounts: mount "authn" sets "$tplYaml", which is not a field of a volume mount' diff --git a/packages/apps/kubernetes/tests/csi_proxmox_storage_class_input_test.yaml b/packages/apps/kubernetes/tests/csi_proxmox_storage_class_input_test.yaml new file mode 100644 index 000000000..c2b9aa7d1 --- /dev/null +++ b/packages/apps/kubernetes/tests/csi_proxmox_storage_class_input_test.yaml @@ -0,0 +1,90 @@ +suite: csi-proxmox.yaml storage class input + +# The vendored proxmox-csi chart writes name, storage, fstype and reclaimPolicy +# into its StorageClass without quoting them, so each is refused here unless it +# is what Kubernetes or Proxmox accepts in its place, which keeps it one YAML +# scalar. + +templates: + - templates/helmreleases/csi-proxmox.yaml + +values: + - values/common.yaml + +release: + name: kubernetes-test + namespace: tenant-test + +set: + _namespace: + etcd: etcd-test + substrate: proxmox + proxmox: + dnsServers: ["192.0.2.53"] + allowedNodes: [pve-1] + ipv4Config: + addresses: ["192.0.2.10-192.0.2.20"] + gateway: "192.0.2.1" + prefix: 24 + csi: + enabled: true + credentialsSecretName: proxmox-csi-creds + ccm: + credentialsSecretName: proxmox-ccm-creds + +tests: + - it: hands on a storage class whose fields are all valid + set: + proxmox.csi.storageClasses: + - name: fast.ssd + storage: local-lvm_1 + fstype: xfs + reclaimPolicy: Retain + ssd: true + asserts: + - equal: + path: spec.values.proxmox-csi-plugin.storageClass + value: + - name: fast.ssd + storage: local-lvm_1 + fstype: xfs + reclaimPolicy: Retain + ssd: true + + - it: refuses a name that is not a DNS subdomain + set: + proxmox.csi.storageClasses: + - name: "fast\n---\nkind: ConfigMap" + storage: local-lvm + asserts: + - failedTemplate: + errorPattern: 'proxmox.csi.storageClasses\[0\].name is .*: a StorageClass name must be a DNS subdomain' + + - it: refuses a storage id with characters Proxmox does not allow + set: + proxmox.csi.storageClasses: + - name: fast + storage: "local-lvm\nmountOptions: [nosuid]" + asserts: + - failedTemplate: + errorPattern: 'proxmox.csi.storageClasses\[0\].storage is .*: a Proxmox storage id' + + - it: refuses a filesystem other than ext4 or xfs + set: + proxmox.csi.storageClasses: + - name: fast + storage: local-lvm + fstype: "ext4\ncache: unsafe" + asserts: + - failedTemplate: + errorPattern: 'proxmox.csi.storageClasses\[0\].fstype is .*: use ext4 or xfs' + + - it: refuses a reclaim policy other than Delete or Retain + set: + proxmox.csi.storageClasses: + - name: fast + storage: local-lvm + reclaimPolicy: "Delete\n---\nkind: Namespace" + asserts: + - failedTemplate: + errorPattern: 'proxmox.csi.storageClasses\[0\].reclaimPolicy is .*: use Delete or Retain' diff --git a/packages/apps/kubernetes/tests/kamaji_managed_args_job_test.yaml b/packages/apps/kubernetes/tests/kamaji_managed_args_job_test.yaml index af36fe3c8..532d254dc 100644 --- a/packages/apps/kubernetes/tests/kamaji_managed_args_job_test.yaml +++ b/packages/apps/kubernetes/tests/kamaji_managed_args_job_test.yaml @@ -20,10 +20,10 @@ tests: - --enable-admission-plugins=NodeRestriction asserts: - matchRegex: - path: spec.template.spec.containers[0].command[2] - pattern: '\\"extraArgs\\":\[\\"--profiling=false\\"\]' + path: 'spec.template.spec.containers[0].env[?(@.name == "KCP_PATCH")].value' + pattern: '"extraArgs":\["--profiling=false"\]' documentIndex: 3 - notMatchRegex: - path: spec.template.spec.containers[0].command[2] + path: 'spec.template.spec.containers[0].env[?(@.name == "KCP_PATCH")].value' pattern: 'enable-admission-plugins' documentIndex: 3 diff --git a/packages/apps/kubernetes/values.schema.json b/packages/apps/kubernetes/values.schema.json index 4556975db..1eb743aaa 100644 --- a/packages/apps/kubernetes/values.schema.json +++ b/packages/apps/kubernetes/values.schema.json @@ -11,6 +11,8 @@ "description": "Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name.", "type": "string", "default": "replicated", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", @@ -36,7 +38,9 @@ "host": { "description": "External hostname for Kubernetes cluster. Defaults to `kubernetes-\u003ccluster-name\u003e.\u003ctenant-host\u003e` if empty.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "substrate": { "description": "Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one.", @@ -89,7 +93,9 @@ "credentialsSecretName": { "description": "Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } }, @@ -105,7 +111,9 @@ "credentialsSecretName": { "description": "Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "enabled": { "description": "Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all.", @@ -1009,7 +1017,9 @@ "name": { "description": "Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } diff --git a/packages/apps/kubernetes/values.yaml b/packages/apps/kubernetes/values.yaml index c93bd5ac7..f52b78b1d 100644 --- a/packages/apps/kubernetes/values.yaml +++ b/packages/apps/kubernetes/values.yaml @@ -6,6 +6,8 @@ ## ## @param {string} storageClass - Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: replicated @@ -80,6 +82,8 @@ version: "v1.35" ## @param {string} host - External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ host: "" ## @@ -111,10 +115,14 @@ network: {} ## @typedef {struct} ProxmoxCCM - Proxmox cloud-controller-manager. It runs in the management cluster, in this namespace, and writes on the tenant's Nodes over the tenant's admin kubeconfig, so the hypervisor token never enters the tenant. Not optional on this substrate: the worker kubelet runs with `--cloud-provider=external`, so every node carries the `uninitialized` taint until this controller clears it, and the CSI node plugin needs the topology labels it applies. ## @field {string} credentialsSecretName - Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @typedef {struct} ProxmoxCSI - Proxmox CSI driver. The tenant gets the node plugin, the CSIDriver object and the storage classes; the controller, the only half that holds the hypervisor token, runs in the management cluster, in this namespace. ## @field {bool} enabled - Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all. ## @field {string} credentialsSecretName - Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {[]ProxmoxStorageClass} storageClasses - StorageClasses to create in the tenant. ## @typedef {struct} Proxmox - Proxmox substrate settings. Ignored unless `substrate` is `proxmox`. @@ -378,6 +386,8 @@ etcd: ## @typedef {struct} OIDCSecretRef - Reference to a Secret carrying an inline AuthenticationConfiguration. ## @field {string} [name] - Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @typedef {struct} OIDCCustomConfig - Tenant-provided AuthenticationConfiguration; consumed only when `mode: CustomConfig`. Exactly one of `config` or `secretRef.name` must be set. ## @field {string} [config] - Inline AuthenticationConfiguration YAML (`apiserver.config.k8s.io/v1beta1`). The chart writes the value verbatim into a Secret mounted at `/etc/kubernetes/authentication-config/config.yaml` on the kube-apiserver. Mutually exclusive with `secretRef.name`. diff --git a/packages/apps/mariadb/templates/backup-cronjob.yaml b/packages/apps/mariadb/templates/backup-cronjob.yaml index 1072a7c85..10e0c0ccb 100644 --- a/packages/apps/mariadb/templates/backup-cronjob.yaml +++ b/packages/apps/mariadb/templates/backup-cronjob.yaml @@ -14,7 +14,7 @@ kind: CronJob metadata: name: {{ $cronJobName }} spec: - schedule: "{{ .Values.backup.schedule }}" + schedule: {{ .Values.backup.schedule | quote }} concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 @@ -65,7 +65,7 @@ spec: name: {{ .Release.Name }}-backup key: s3SecretKey - name: AWS_DEFAULT_REGION - value: {{ .Values.backup.s3Region }} + value: {{ .Values.backup.s3Region | quote }} - name: RESTIC_PASSWORD valueFrom: secretKeyRef: diff --git a/packages/apps/mariadb/templates/backup-secret.yaml b/packages/apps/mariadb/templates/backup-secret.yaml index be221e2f4..9efaf9356 100644 --- a/packages/apps/mariadb/templates/backup-secret.yaml +++ b/packages/apps/mariadb/templates/backup-secret.yaml @@ -5,7 +5,7 @@ kind: Secret metadata: name: {{ .Release.Name }}-backup stringData: - s3AccessKey: {{ required "s3AccessKey is not specified!" .Values.backup.s3AccessKey }} - s3SecretKey: {{ required "s3SecretKey is not specified!" .Values.backup.s3SecretKey }} - resticPassword: {{ required "resticPassword is not specified!" .Values.backup.resticPassword }} + s3AccessKey: {{ required "s3AccessKey is not specified!" .Values.backup.s3AccessKey | quote }} + s3SecretKey: {{ required "s3SecretKey is not specified!" .Values.backup.s3SecretKey | quote }} + resticPassword: {{ required "resticPassword is not specified!" .Values.backup.resticPassword | quote }} {{- end }} diff --git a/packages/apps/mariadb/templates/mariadb.yaml b/packages/apps/mariadb/templates/mariadb.yaml index 4cc8b3cf4..3282a4025 100644 --- a/packages/apps/mariadb/templates/mariadb.yaml +++ b/packages/apps/mariadb/templates/mariadb.yaml @@ -35,7 +35,7 @@ spec: startupProbe: failureThreshold: 30 - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} replicasAllowEvenNumber: true affinity: podAntiAffinity: @@ -100,11 +100,11 @@ spec: type: LoadBalancer {{- end }} storage: - size: {{ .Values.size }} + size: {{ .Values.size | quote }} resizeInUseVolumes: true waitForVolumeResize: true {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} {{- if and .Values.external (gt (int .Values.replicas) 1) }} diff --git a/packages/apps/mariadb/templates/regsecret.yaml b/packages/apps/mariadb/templates/regsecret.yaml index a76dd9460..941bcfd70 100644 --- a/packages/apps/mariadb/templates/regsecret.yaml +++ b/packages/apps/mariadb/templates/regsecret.yaml @@ -5,6 +5,7 @@ metadata: name: {{ .Release.Name }}-regsecret type: kubernetes.io/dockerconfigjson stringData: - .dockerconfigjson: | - {{- toJson .Values.registrySecret | nindent 4 }} + {{- /* Quoted rather than a block scalar, so the value stays one YAML scalar + whatever characters it holds. */}} + .dockerconfigjson: {{ toJson .Values.registrySecret | quote }} {{- end }} diff --git a/packages/apps/mariadb/templates/workloadmonitor.yaml b/packages/apps/mariadb/templates/workloadmonitor.yaml index 36cb59f01..7153c7182 100644 --- a/packages/apps/mariadb/templates/workloadmonitor.yaml +++ b/packages/apps/mariadb/templates/workloadmonitor.yaml @@ -6,7 +6,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} minReplicas: 1 kind: mariadb type: mariadb diff --git a/packages/apps/mariadb/tests/backup_cleanup_strategy_test.yaml b/packages/apps/mariadb/tests/backup_cleanup_strategy_test.yaml new file mode 100644 index 000000000..76c0e623a --- /dev/null +++ b/packages/apps/mariadb/tests/backup_cleanup_strategy_test.yaml @@ -0,0 +1,75 @@ +suite: backup.cleanupStrategy +# The strategy is word-split into the arguments of `restic forget` in the +# backup script, so the schema holds it to restic's keep flags, long or short, +# each with a value. +release: + name: my-db + namespace: tenant-test +set: + _cluster: + cluster-domain: cozy.local + _namespace: + host: example.com + backup: + enabled: true + schedule: "0 2 * * *" + s3Bucket: s3.example.org/test +tests: + - it: accepts restic's short keep flags + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-l 3 -d 7 -w=4 -m12 -H 24 -y 1" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "-l 3 -d 7 -w=4 -m12 -H 24 -y 1" + + - it: accepts restic's long keep flags + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "--keep-last=3 --keep-daily 3 --keep-within-weekly=1m" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "--keep-last=3 --keep-daily 3 --keep-within-weekly=1m" + + - it: accepts a keep-tag value holding a slash + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "--keep-last=3 --keep-tag=nightly/weekly" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: CLEANUP_STRATEGY + value: "--keep-last=3 --keep-tag=nightly/weekly" + + - it: refuses a short flag that is not a keep flag + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-r /tmp" + asserts: + - failedTemplate: + errorPattern: "at '/backup/cleanupStrategy'.*does not match pattern" + + - it: refuses a shell metacharacter + templates: + - templates/backup-cronjob.yaml + set: + backup: + cleanupStrategy: "-l 3; echo x" + asserts: + - failedTemplate: + errorPattern: "at '/backup/cleanupStrategy'.*does not match pattern" diff --git a/packages/apps/mariadb/values.schema.json b/packages/apps/mariadb/values.schema.json index c588bd8ac..ec8e03457 100644 --- a/packages/apps/mariadb/values.schema.json +++ b/packages/apps/mariadb/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", @@ -223,7 +225,8 @@ "cleanupStrategy": { "description": "DEPRECATED: Retention strategy for cleaning up old backups.", "type": "string", - "default": "--keep-last=3 --keep-daily=3 --keep-within-weekly=1m" + "default": "--keep-last=3 --keep-daily=3 --keep-within-weekly=1m", + "pattern": "^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$" }, "enabled": { "description": "DEPRECATED: Enable regular backups (default: false).", @@ -243,12 +246,14 @@ "s3Bucket": { "description": "DEPRECATED: S3 bucket used for storing backups.", "type": "string", - "default": "s3.example.org/mariadb-backups" + "default": "s3.example.org/mariadb-backups", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "s3Region": { "description": "DEPRECATED: AWS S3 region where backups are stored.", "type": "string", - "default": "us-east-1" + "default": "us-east-1", + "pattern": "^[A-Za-z0-9_.-]*$" }, "s3SecretKey": { "description": "DEPRECATED: Secret key for S3 authentication.", @@ -258,7 +263,8 @@ "schedule": { "description": "DEPRECATED: Cron schedule for automated backups.", "type": "string", - "default": "0 2 * * *" + "default": "0 2 * * *", + "pattern": "^[-0-9A-Za-z*/,@? ]*$" } } }, diff --git a/packages/apps/mariadb/values.yaml b/packages/apps/mariadb/values.yaml index 35db033d4..d11a568c4 100644 --- a/packages/apps/mariadb/values.yaml +++ b/packages/apps/mariadb/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.nano" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" @@ -153,9 +155,13 @@ databases: {} ## @typedef {struct} Backup - DEPRECATED: Backup configuration. ## @field {bool} enabled - DEPRECATED: Enable regular backups (default: false). ## @field {string} s3Region - DEPRECATED: AWS S3 region where backups are stored. +## @pattern ^[A-Za-z0-9_.-]*$ ## @field {string} s3Bucket - DEPRECATED: S3 bucket used for storing backups. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} schedule - DEPRECATED: Cron schedule for automated backups. +## @pattern ^[-0-9A-Za-z*/,@? ]*$ ## @field {string} cleanupStrategy - DEPRECATED: Retention strategy for cleaning up old backups. +## @pattern ^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$ ## @field {string} s3AccessKey - DEPRECATED: Access key for S3 authentication. ## @field {string} s3SecretKey - DEPRECATED: Secret key for S3 authentication. ## @field {string} resticPassword - DEPRECATED: Password for Restic backup encryption. diff --git a/packages/apps/mongodb/templates/mongodb.yaml b/packages/apps/mongodb/templates/mongodb.yaml index f541f0501..02e62228e 100644 --- a/packages/apps/mongodb/templates/mongodb.yaml +++ b/packages/apps/mongodb/templates/mongodb.yaml @@ -91,24 +91,24 @@ spec: enabled: true {{- if .Values.sharding }} configsvrReplSet: - size: {{ .Values.shardingConfig.configServers }} + size: {{ .Values.shardingConfig.configServers | int }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 8 }} volumeSpec: persistentVolumeClaim: {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} accessModes: - ReadWriteOnce resources: requests: - storage: {{ .Values.shardingConfig.configServerSize }} + storage: {{ .Values.shardingConfig.configServerSize | quote }} affinity: antiAffinityTopologyKey: kubernetes.io/hostname podDisruptionBudget: maxUnavailable: 1 mongos: - size: {{ .Values.shardingConfig.mongos }} + size: {{ .Values.shardingConfig.mongos | int }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 8 }} affinity: antiAffinityTopologyKey: kubernetes.io/hostname @@ -121,19 +121,19 @@ spec: replsets: {{- if .Values.sharding }} {{- range .Values.shardingConfig.shards }} - - name: {{ .name }} - size: {{ .replicas }} + - name: {{ .name | quote }} + size: {{ .replicas | int }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $.Values.resourcesPreset $.Values.resources $) | nindent 8 }} volumeSpec: persistentVolumeClaim: {{- with $.Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} accessModes: - ReadWriteOnce resources: requests: - storage: {{ .size }} + storage: {{ .size | quote }} affinity: antiAffinityTopologyKey: kubernetes.io/hostname podDisruptionBudget: @@ -141,18 +141,18 @@ spec: {{- end }} {{- else }} - name: rs0 - size: {{ .Values.replicas }} + size: {{ .Values.replicas | int }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 8 }} volumeSpec: persistentVolumeClaim: {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} accessModes: - ReadWriteOnce resources: requests: - storage: {{ .Values.size }} + storage: {{ .Values.size | quote }} affinity: antiAffinityTopologyKey: kubernetes.io/hostname podDisruptionBudget: @@ -191,6 +191,13 @@ spec: {{- end }} {{- end }} + {{- /* MongoDB's own rule for a database name: none of / \ . " $, no space, + NUL or other control character, fewer than 64 characters. */}} + {{- range $dbname, $_ := .Values.databases }} + {{- if not (regexMatch `^[^/\\. "$\p{Cc}]{1,63}$` $dbname) }} + {{- fail (printf "invalid database name %q: a database name must be 1 to 63 characters and must not contain /, \\, ., \", $, a space or a control character" $dbname) }} + {{- end }} + {{- end }} {{- if .Values.users }} {{- /* Build a map of username -> list of roles from databases config */}} {{- $userRoles := dict }} @@ -226,8 +233,8 @@ spec: key: password roles: {{- range $roles }} - - name: {{ .name }} - db: {{ .db }} + - name: {{ .name | quote }} + db: {{ .db | quote }} {{- end }} - name: {{ include "mongodb.managedRole" $ }} db: admin @@ -269,7 +276,7 @@ spec: {{- with include "mongodb.backup.prefix" . }} prefix: {{ . | quote }} {{- end }} - endpointUrl: {{ .Values.backup.endpointURL }} + endpointUrl: {{ .Values.backup.endpointURL | quote }} credentialsSecret: {{ .Release.Name }}-s3-creds insecureSkipTLSVerify: {{ .Values.backup.insecureSkipTLSVerify | default false }} forcePathStyle: true @@ -301,7 +308,7 @@ spec: {{- end }} replicas: {{ $totalReplicas }} {{- else }} - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} {{- end }} minReplicas: 1 kind: mongodb diff --git a/packages/apps/mongodb/templates/restore.yaml b/packages/apps/mongodb/templates/restore.yaml index 067739e9c..dad436d2a 100644 --- a/packages/apps/mongodb/templates/restore.yaml +++ b/packages/apps/mongodb/templates/restore.yaml @@ -34,12 +34,12 @@ spec: {{- end }} backupSource: type: logical - destination: {{ .Values.backup.destinationPath | trimSuffix "/" }}/{{ .Values.bootstrap.backupName }} + destination: {{ printf "%s/%s" (.Values.backup.destinationPath | trimSuffix "/") .Values.bootstrap.backupName | quote }} s3: bucket: {{ include "mongodb.backup.bucket" . | quote }} prefix: {{ include "mongodb.backup.prefix" . | quote }} credentialsSecret: {{ .Release.Name }}-s3-creds - endpointUrl: {{ .Values.backup.endpointURL }} + endpointUrl: {{ .Values.backup.endpointURL | quote }} insecureSkipTLSVerify: {{ .Values.backup.insecureSkipTLSVerify | default false }} forcePathStyle: true {{- end }} diff --git a/packages/apps/mongodb/tests/database_name_test.yaml b/packages/apps/mongodb/tests/database_name_test.yaml new file mode 100644 index 000000000..d82bf7ea3 --- /dev/null +++ b/packages/apps/mongodb/tests/database_name_test.yaml @@ -0,0 +1,59 @@ +suite: mongodb database names +# A database name reaches the PerconaServerMongoDB user roles quoted, and is +# held to MongoDB's own rule for one, no narrower. +templates: + - templates/mongodb.yaml +release: + name: test-mongodb + namespace: tenant-test +set: + _cluster: + cluster-domain: cozy.local + users: + app: {} +tests: + - it: accepts a name with + and @ + set: + databases: + orders+eu@prod: + roles: + admin: [app] + documentSelector: + path: kind + value: PerconaServerMongoDB + asserts: + - contains: + path: spec.users[0].roles + content: + name: readWrite + db: orders+eu@prod + + - it: refuses a name with a character MongoDB does not allow + set: + databases: + "orders.eu": + roles: + admin: [app] + asserts: + - failedTemplate: + errorPattern: 'invalid database name "orders.eu": a database name must be 1 to 63 characters and must not contain' + + - it: refuses a name with a line break + set: + databases: + "orders\n- name: x": + roles: + admin: [app] + asserts: + - failedTemplate: + errorPattern: 'invalid database name .*: a database name must be 1 to 63 characters' + + - it: refuses a name of 64 characters + set: + databases: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: + roles: + admin: [app] + asserts: + - failedTemplate: + errorPattern: 'a database name must be 1 to 63 characters' diff --git a/packages/apps/mongodb/tests/mongodb_test.yaml b/packages/apps/mongodb/tests/mongodb_test.yaml index 3a66ae43a..f2e28a922 100644 --- a/packages/apps/mongodb/tests/mongodb_test.yaml +++ b/packages/apps/mongodb/tests/mongodb_test.yaml @@ -785,6 +785,69 @@ tests: value: "0 4 * * *" documentIndex: 0 + # The Percona scheduler reads the schedule, which may carry a time zone or an + # interval; the schema refuses only characters a schedule never holds. + - it: sets a backup schedule with a time zone or an interval + release: + name: test-mongodb + namespace: tenant-test + set: + _cluster: + cluster-domain: cozy.local + backup: + enabled: true + schedule: "CRON_TZ=Europe/Berlin 0 4 * * *" + retentionPolicy: 7d + destinationPath: "s3://bucket/path/" + endpointURL: "http://minio:9000" + s3AccessKey: "access" + s3SecretKey: "secret" + asserts: + - equal: + path: spec.backup.tasks[0].schedule + value: "CRON_TZ=Europe/Berlin 0 4 * * *" + documentIndex: 0 + + - it: sets a backup schedule given as an interval + release: + name: test-mongodb + namespace: tenant-test + set: + _cluster: + cluster-domain: cozy.local + backup: + enabled: true + schedule: "@every 1.5h" + retentionPolicy: 7d + destinationPath: "s3://bucket/path/" + endpointURL: "http://minio:9000" + s3AccessKey: "access" + s3SecretKey: "secret" + asserts: + - equal: + path: spec.backup.tasks[0].schedule + value: "@every 1.5h" + documentIndex: 0 + + - it: refuses a backup schedule with a line break + release: + name: test-mongodb + namespace: tenant-test + set: + _cluster: + cluster-domain: cozy.local + backup: + enabled: true + schedule: "0 4 * * *\n - name: x" + retentionPolicy: 7d + destinationPath: "s3://bucket/path/" + endpointURL: "http://minio:9000" + s3AccessKey: "access" + s3SecretKey: "secret" + asserts: + - failedTemplate: + errorPattern: "at '/backup/schedule'.*does not match pattern" + - it: enables PITR when backup enabled release: name: test-mongodb diff --git a/packages/apps/mongodb/values.schema.json b/packages/apps/mongodb/values.schema.json index a8f698fe7..cbe649ad0 100644 --- a/packages/apps/mongodb/values.schema.json +++ b/packages/apps/mongodb/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", @@ -196,7 +198,9 @@ "properties": { "name": { "description": "Shard name.", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, "replicas": { "description": "Number of replicas in this shard.", @@ -269,7 +273,8 @@ "destinationPath": { "description": "Destination path for backups (e.g. s3://bucket/path/). Ignored when useSystemBucket is true (the driver injects the platform bucket).", "type": "string", - "default": "s3://bucket/path/to/folder/" + "default": "s3://bucket/path/to/folder/", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "enabled": { "description": "Enable regular backups.", @@ -279,7 +284,8 @@ "endpointURL": { "description": "S3 endpoint URL for uploads. Ignored when useSystemBucket is true (the strategy supplies the platform endpoint).", "type": "string", - "default": "http://minio-gateway-service:9000" + "default": "http://minio-gateway-service:9000", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "insecureSkipTLSVerify": { "description": "Skip TLS verification for the S3 endpoint (self-signed, e.g. in-cluster seaweedfs). Ignored when useSystemBucket is true (the platform backupStorage knob applies instead).", @@ -304,7 +310,8 @@ "schedule": { "description": "Cron schedule for automated backups. Ignored when useSystemBucket is true (scheduling moves to the BackupClass Plan).", "type": "string", - "default": "0 2 * * *" + "default": "0 2 * * *", + "pattern": "^[-0-9A-Za-z*/,@? ._=]*$" }, "useSystemBucket": { "description": "Opt-in: back up to the platform system bucket without supplying S3 credentials. The cozy-default MongoDB BackupClass injects the storage at BackupJob time; tenants do not set s3AccessKey/s3SecretKey/destinationPath/endpointURL, and backups scope to `\u003cnamespace\u003e/\u003capplication\u003e`. Scheduling moves to a BackupClass Plan; `schedule`, `retentionPolicy` and PITR are ignored while this is on, and this flow has no retention yet (see https://cozystack.io/docs/v1/operations/services/backup-classes/). Requires `backup.enabled: true` (the pbm agents run on that flag); the chart refuses the combination with `enabled: false` at render time; the schema carries the same rule as a marker for the UI and for the day the apiserver enforces CEL on application schemas (cozystack/cozystack#2657), which it does not yet. A release that has not yet rendered this flag (its cluster still carries the chart's scheduled tasks and PITR) holds a BackupJob until it does, so the tenant's own storage is never injected over.", @@ -331,7 +338,8 @@ "backupName": { "description": "Name of backup to restore from.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "enabled": { "description": "Whether to restore from a backup.", @@ -341,7 +349,8 @@ "recoveryTime": { "description": "Timestamp for point-in-time recovery; empty means latest.", "type": "string", - "default": "" + "default": "", + "pattern": "^[0-9TZtz:.+ -]*$" } } }, diff --git a/packages/apps/mongodb/values.yaml b/packages/apps/mongodb/values.yaml index 956831ac9..94536ab22 100644 --- a/packages/apps/mongodb/values.yaml +++ b/packages/apps/mongodb/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.small" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" @@ -99,6 +101,8 @@ sharding: false ## @typedef {struct} Shard - Individual shard configuration. ## @field {string} name - Shard name. +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @field {int} replicas - Number of replicas in this shard. ## @field {quantity} size - PVC size for this shard. @@ -155,9 +159,12 @@ databases: {} ## @field {bool} enabled - Enable regular backups. ## @field {bool} [useSystemBucket] - Opt-in: back up to the platform system bucket without supplying S3 credentials. The cozy-default MongoDB BackupClass injects the storage at BackupJob time; tenants do not set s3AccessKey/s3SecretKey/destinationPath/endpointURL, and backups scope to `/`. Scheduling moves to a BackupClass Plan; `schedule`, `retentionPolicy` and PITR are ignored while this is on, and this flow has no retention yet (see https://cozystack.io/docs/v1/operations/services/backup-classes/). Requires `backup.enabled: true` (the pbm agents run on that flag); the chart refuses the combination with `enabled: false` at render time; the schema carries the same rule as a marker for the UI and for the day the apiserver enforces CEL on application schemas (cozystack/cozystack#2657), which it does not yet. A release that has not yet rendered this flag (its cluster still carries the chart's scheduled tasks and PITR) holds a BackupJob until it does, so the tenant's own storage is never injected over. ## @field {string} [schedule] - Cron schedule for automated backups. Ignored when useSystemBucket is true (scheduling moves to the BackupClass Plan). +## @pattern ^[-0-9A-Za-z*/,@? ._=]*$ ## @field {string} [retentionPolicy] - Retention policy (e.g. "30d"). Ignored when useSystemBucket is true (no engine-side retention on that flow). ## @field {string} [destinationPath] - Destination path for backups (e.g. s3://bucket/path/). Ignored when useSystemBucket is true (the driver injects the platform bucket). +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [endpointURL] - S3 endpoint URL for uploads. Ignored when useSystemBucket is true (the strategy supplies the platform endpoint). +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {bool} [insecureSkipTLSVerify] - Skip TLS verification for the S3 endpoint (self-signed, e.g. in-cluster seaweedfs). Ignored when useSystemBucket is true (the platform backupStorage knob applies instead). ## @field {string} [s3AccessKey] - Access key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds). ## @field {string} [s3SecretKey] - Secret key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds). @@ -182,7 +189,9 @@ backup: ## @typedef {struct} Bootstrap - Bootstrap configuration for restoring a database cluster from a backup. ## @field {bool} enabled - Whether to restore from a backup. ## @field {string} [recoveryTime] - Timestamp for point-in-time recovery; empty means latest. +## @pattern ^[0-9TZtz:.+ -]*$ ## @field {string} backupName - Name of backup to restore from. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @param {Bootstrap} bootstrap - Bootstrap configuration. bootstrap: diff --git a/packages/apps/nats/templates/_config.tpl b/packages/apps/nats/templates/_config.tpl new file mode 100644 index 000000000..5af60b1a6 --- /dev/null +++ b/packages/apps/nats/templates/_config.tpl @@ -0,0 +1,65 @@ +{{- define "nats.assertPlainConfig" }} +{{- $path := index . 0 }} +{{- $value := index . 1 }} +{{- if kindIs "map" $value }} +{{- range $k, $v := $value }} +{{- if or (hasPrefix "$tplYaml" $k) (hasSuffix "$include" $k) (contains "<<" $k) }} +{{- fail (printf "%s: key %q is not allowed in NATS configuration" $path $k) }} +{{- end }} +{{- include "nats.assertPlainConfig" (list (printf "%s.%s" $path $k) $v) }} +{{- end }} +{{- else if kindIs "slice" $value }} +{{- range $i, $v := $value }} +{{- include "nats.assertPlainConfig" (list (printf "%s[%d]" $path $i) $v) }} +{{- end }} +{{- /* The chart writes a value of the form "<< x >>" into nats.conf + unquoted. A number with a unit is the documented use and is accepted; + anything else in that form, a variable included, is refused. */}} +{{- else if and (kindIs "string" $value) (contains "<<" $value) (not (regexMatch "^<< +[0-9]+(\\.[0-9]+)?[A-Za-z]* +>>$" $value)) }} +{{- fail (printf "%s: \"<<\" is allowed in NATS configuration values only around a number with a unit, such as << 2MB >>" $path) }} +{{- end }} +{{- end }} + +{{- define "nats.resolver" }} +{{- $in := . }} +{{- $out := dict }} +{{- range $k := list "enabled" "dir" "merge" "patch" }} +{{- if hasKey $in $k }} +{{- $_ := set $out $k (index $in $k) }} +{{- end }} +{{- end }} +{{- with $in.pvc }} +{{- if not (kindIs "map" .) }} +{{- fail "config.resolver.pvc must be an object" }} +{{- end }} +{{- $pvc := dict }} +{{- range $k := list "enabled" "size" "storageClassName" "name" }} +{{- if hasKey $in.pvc $k }} +{{- $_ := set $pvc $k (index $in.pvc $k) }} +{{- end }} +{{- end }} +{{- $_ := set $out "pvc" $pvc }} +{{- end }} +{{- if and (hasKey $out "dir") (not (regexMatch "^/[A-Za-z0-9._/-]*$" (toString $out.dir))) }} +{{- fail (printf "config.resolver.dir %q must be an absolute path of letters, digits, '.', '_', '-' and '/'" (toString $out.dir)) }} +{{- end }} +{{- if and (hasKey $out "enabled") (not (kindIs "bool" $out.enabled)) }} +{{- fail "config.resolver.enabled must be a boolean" }} +{{- end }} +{{- with $out.pvc }} +{{- if and (hasKey . "storageClassName") .storageClassName (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" (toString .storageClassName))) }} +{{- fail "config.resolver.pvc.storageClassName must be a DNS-1123 subdomain" }} +{{- end }} +{{- if and (hasKey . "size") .size (not (regexMatch "^[0-9]+(\\.[0-9]+)?([KMGTPE]i?)?$" (toString .size))) }} +{{- fail "config.resolver.pvc.size must be a storage quantity such as 1Gi" }} +{{- end }} +{{- if and (hasKey . "enabled") (not (kindIs "bool" .enabled)) }} +{{- fail "config.resolver.pvc.enabled must be a boolean" }} +{{- end }} +{{- if and (hasKey . "name") .name (not (and (le (len (toString .name)) 63) (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" (toString .name)))) }} +{{- fail "config.resolver.pvc.name must be a DNS-1123 label: it names the volume and its claim template" }} +{{- end }} +{{- end }} +{{- include "nats.assertPlainConfig" (list "config.resolver" $out) }} +{{- toJson $out }} +{{- end }} diff --git a/packages/apps/nats/templates/nats.yaml b/packages/apps/nats/templates/nats.yaml index 061830d53..316da3742 100644 --- a/packages/apps/nats/templates/nats.yaml +++ b/packages/apps/nats/templates/nats.yaml @@ -41,6 +41,8 @@ {{- $merge = mergeOverwrite $merge (dict "accounts" (dict "A" $account)) }} {{- end }} +{{- include "nats.assertPlainConfig" (list "config.merge" $merge) }} + {{- if .Values.users }} apiVersion: v1 kind: Secret @@ -90,9 +92,9 @@ spec: config: {{- with $merge }} merge: - {{- toYaml . | nindent 10 }} + {{- include "cozy-lib.yaml.toYaml" (list . "config.merge") | nindent 10 }} {{- end }} - {{- with .Values.config.resolver }} + {{- with include "nats.resolver" (.Values.config.resolver | default dict) | fromJson }} resolver: {{- toYaml . | nindent 10 }} {{- end }} @@ -105,11 +107,11 @@ spec: cluster: enabled: true routeURLs: - k8sClusterDomain: {{ $clusterDomain }} + k8sClusterDomain: {{ $clusterDomain | quote }} {{- if $tlsEnabled }} useFQDN: true {{- end }} - replicas: {{ .Values.replicas }} + replicas: {{ int .Values.replicas }} {{- if $tlsEnabled }} tls: enabled: true @@ -123,9 +125,9 @@ spec: enabled: {{ .Values.jetstream.enabled }} pvc: enabled: true - size: {{ .Values.jetstream.size }} + size: {{ .Values.jetstream.size | toJson }} {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} {{- if .Values.external }} service: diff --git a/packages/apps/nats/tests/config_merge_test.yaml b/packages/apps/nats/tests/config_merge_test.yaml index b8763b5d5..1e43dd55b 100644 --- a/packages/apps/nats/tests/config_merge_test.yaml +++ b/packages/apps/nats/tests/config_merge_test.yaml @@ -129,3 +129,78 @@ tests: asserts: - notExists: path: spec.values.nats.config.merge + + # The chart writes "<< x >>" into nats.conf unquoted. A number with a unit is + # the documented use and is accepted; a variable or anything else in that + # form is refused. + - it: passes a number with a unit wrapped in << >> through + set: + config: + merge: + max_payload: "<< 2MB >>" + jetstream: + max_file_store: "<< 1.5GB >>" + documentSelector: + path: kind + value: HelmRelease + asserts: + - equal: + path: spec.values.nats.config.merge.max_payload + value: "<< 2MB >>" + - equal: + path: spec.values.nats.config.merge.jetstream.max_file_store + value: "<< 1.5GB >>" + + - it: refuses a variable wrapped in << >> + set: + config: + merge: + authorization: + token: "<< $TOKEN >>" + asserts: + - failedTemplate: + errorPattern: 'config.merge.authorization.token: "<<" is allowed in NATS configuration values only around a number with a unit' + + - it: refuses any other << in a value + set: + config: + merge: + max_payload: "<< 2MB >> }\ninclude other.conf\n{ x: << 1 >>" + asserts: + - failedTemplate: + errorPattern: 'config.merge.max_payload: "<<" is allowed in NATS configuration values only around a number with a unit' + + - it: hands the resolver PVC name on and drops its merge and patch + set: + config: + resolver: + pvc: + name: my-resolver + size: 2Gi + merge: + metadata: + labels: + x: y + patch: + - op: add + path: /x + value: y + documentSelector: + path: kind + value: HelmRelease + asserts: + - equal: + path: spec.values.nats.config.resolver.pvc + value: + name: my-resolver + size: 2Gi + + - it: refuses a resolver PVC name that is not a DNS-1123 label + set: + config: + resolver: + pvc: + name: "my-resolver\n- name: x" + asserts: + - failedTemplate: + errorPattern: 'config.resolver.pvc.name must be a DNS-1123 label' diff --git a/packages/apps/nats/values.schema.json b/packages/apps/nats/values.schema.json index c43067dda..243c365ec 100644 --- a/packages/apps/nats/values.schema.json +++ b/packages/apps/nats/values.schema.json @@ -98,6 +98,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/nats/values.yaml b/packages/apps/nats/values.yaml index cb90ac346..83c86fb06 100644 --- a/packages/apps/nats/values.yaml +++ b/packages/apps/nats/values.yaml @@ -65,6 +65,8 @@ resources: {} resourcesPreset: "t1.nano" ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/openbao/templates/openbao.yaml b/packages/apps/openbao/templates/openbao.yaml index d3236be84..4cf8db9e9 100644 --- a/packages/apps/openbao/templates/openbao.yaml +++ b/packages/apps/openbao/templates/openbao.yaml @@ -91,9 +91,9 @@ spec: whenScaled: Retain dataStorage: enabled: true - size: {{ .Values.size }} + size: {{ .Values.size | quote }} {{- with .Values.storageClass }} - storageClass: {{ . }} + storageClass: {{ . | quote }} {{- end }} {{- if $static }} # The upstream chart mounts each Secret at /openbao/userconfig//. @@ -110,7 +110,7 @@ spec: enabled: false ha: enabled: true - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} raft: enabled: true setNodeId: true @@ -135,10 +135,10 @@ spec: seal "static" { current_key_id = {{ $seal.keyId | quote }} - current_key = "file:///openbao/userconfig/{{ $seal.secretName }}/key" + current_key = {{ printf "file:///openbao/userconfig/%s/key" $seal.secretName | quote }} {{- if $seal.previousSecretName }} previous_key_id = {{ $seal.previousKeyId | quote }} - previous_key = "file:///openbao/userconfig/{{ $seal.previousSecretName }}/key" + previous_key = {{ printf "file:///openbao/userconfig/%s/key" $seal.previousSecretName | quote }} {{- end }} } {{- end }} @@ -163,10 +163,10 @@ spec: seal "static" { current_key_id = {{ $seal.keyId | quote }} - current_key = "file:///openbao/userconfig/{{ $seal.secretName }}/key" + current_key = {{ printf "file:///openbao/userconfig/%s/key" $seal.secretName | quote }} {{- if $seal.previousSecretName }} previous_key_id = {{ $seal.previousKeyId | quote }} - previous_key = "file:///openbao/userconfig/{{ $seal.previousSecretName }}/key" + previous_key = {{ printf "file:///openbao/userconfig/%s/key" $seal.previousSecretName | quote }} {{- end }} } {{- end }} diff --git a/packages/apps/openbao/templates/workloadmonitor.yaml b/packages/apps/openbao/templates/workloadmonitor.yaml index 56f9ec8e3..28d45911c 100644 --- a/packages/apps/openbao/templates/workloadmonitor.yaml +++ b/packages/apps/openbao/templates/workloadmonitor.yaml @@ -6,7 +6,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} minReplicas: 1 kind: openbao type: openbao diff --git a/packages/apps/openbao/values.schema.json b/packages/apps/openbao/values.schema.json index 7db02d768..1ee5d123c 100644 --- a/packages/apps/openbao/values.schema.json +++ b/packages/apps/openbao/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/openbao/values.yaml b/packages/apps/openbao/values.yaml index ae6b8def5..fdc9f9154 100644 --- a/packages/apps/openbao/values.yaml +++ b/packages/apps/openbao/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.small" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/opensearch/templates/opensearch.yaml b/packages/apps/opensearch/templates/opensearch.yaml index 2f7cdbfef..a17ba721c 100644 --- a/packages/apps/opensearch/templates/opensearch.yaml +++ b/packages/apps/opensearch/templates/opensearch.yaml @@ -116,7 +116,7 @@ spec: dashboards: enable: true version: {{ include "opensearch.versionMap" $ }} - replicas: {{ .Values.dashboards.replicas | default 1 }} + replicas: {{ .Values.dashboards.replicas | default 1 | int }} tls: enable: true {{- if $certManagerIssued }} @@ -133,14 +133,14 @@ spec: {{- end }} nodePools: - component: nodes - replicas: {{ .Values.replicas }} - diskSize: {{ .Values.size }} + replicas: {{ .Values.replicas | int }} + diskSize: {{ .Values.size | quote }} persistence: pvc: accessModes: - ReadWriteOnce {{- if .Values.storageClass }} - storageClass: {{ .Values.storageClass }} + storageClass: {{ .Values.storageClass | quote }} {{- else if eq (int .Values.replicas) 1 }} storageClass: replicated {{- else }} @@ -185,7 +185,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} minReplicas: 1 kind: opensearch type: opensearch diff --git a/packages/apps/opensearch/templates/users.yaml b/packages/apps/opensearch/templates/users.yaml index 1d3262066..944226024 100644 --- a/packages/apps/opensearch/templates/users.yaml +++ b/packages/apps/opensearch/templates/users.yaml @@ -1,10 +1,14 @@ {{- range $username, $user := .Values.users }} +{{- $secretName := printf "%s-user-%s" $.Release.Name $username }} +{{- if or (gt (len $secretName) 253) (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" $secretName)) }} +{{- fail (printf "invalid username %q: it also names the Secret %q, which Kubernetes requires to be a DNS-1123 subdomain (lowercase letters, digits, \"-\" and \".\", starting and ending with a letter or digit)" $username $secretName) }} +{{- end }} {{- $existingSecret := lookup "v1" "Secret" $.Release.Namespace (printf "%s-user-%s" $.Release.Name $username) }} --- apiVersion: v1 kind: Secret metadata: - name: {{ $.Release.Name }}-user-{{ $username }} + name: {{ $secretName | quote }} labels: opensearch.opster.io/credentials: "true" type: kubernetes.io/basic-auth diff --git a/packages/apps/opensearch/values.schema.json b/packages/apps/opensearch/values.schema.json index 1209e5d93..9bcebb9cf 100644 --- a/packages/apps/opensearch/values.schema.json +++ b/packages/apps/opensearch/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/opensearch/values.yaml b/packages/apps/opensearch/values.yaml index 322004ea3..3c29ae9e3 100644 --- a/packages/apps/opensearch/values.yaml +++ b/packages/apps/opensearch/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "c1.medium" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/postgres/templates/db.yaml b/packages/apps/postgres/templates/db.yaml index 3fb0fbc91..212aec85f 100644 --- a/packages/apps/postgres/templates/db.yaml +++ b/packages/apps/postgres/templates/db.yaml @@ -58,7 +58,7 @@ spec: {{- if le (int .Values.replicas) (int .Values.quorum.maxSyncReplicas) }} {{- fail (printf "postgres: replicas (%d) must be greater than quorum.maxSyncReplicas (%d) - CNPG rejects a Cluster whose maxSyncReplicas is not lower than its instance count. Raise replicas above maxSyncReplicas. (If you are disabling autoscaling on a synchronous-quorum cluster, first set replicas to at least the live instance count: kubectl scale cluster.postgresql.cnpg.io/%s --replicas=, with the HelmRelease suspended.)" (int .Values.replicas) (int .Values.quorum.maxSyncReplicas) .Release.Name) }} {{- end }} - instances: {{ .Values.replicas }} + instances: {{ .Values.replicas | int }} {{- end }} {{- if and $tlsEnabled .Values.external }} # Operator-managed TLS. CNPG auto-generates its own self-signed CA and signs @@ -193,7 +193,7 @@ spec: # to the Cluster name anyway); the driver preserves it on a live cluster. # On restore bootstrap.newServerName overrides it with a fresh prefix, so # the re-bootstrapped cluster does not archive onto the recovery source. - serverName: {{ .Values.bootstrap.newServerName | default .Release.Name }} + serverName: {{ .Values.bootstrap.newServerName | default .Release.Name | quote }} {{- end }} {{/* @@ -234,18 +234,18 @@ spec: {{- if .Values.bootstrap.enabled }} bootstrap: recovery: - source: {{ .Values.bootstrap.oldName }} + source: {{ .Values.bootstrap.oldName | quote }} {{- if or .Values.bootstrap.recoveryTime .Values.bootstrap.backupID }} recoveryTarget: {{- with .Values.bootstrap.backupID }} backupID: {{ . | quote }} {{- end }} {{- with .Values.bootstrap.recoveryTime }} - targetTime: {{ . }} + targetTime: {{ . | quote }} {{- end }} {{- end }} externalClusters: - - name: {{ .Values.bootstrap.oldName }} + - name: {{ .Values.bootstrap.oldName | quote }} plugin: name: barman-cloud.cloudnative-pg.io parameters: @@ -257,7 +257,7 @@ spec: # cluster's NAME (= oldName), but the plugin defaults it to the NEW # cluster's name — which would read the wrong S3 prefix on restore. barmanObjectName: {{ .Release.Name }}-recovery - serverName: {{ .Values.bootstrap.serverName | default .Values.bootstrap.oldName }} + serverName: {{ .Values.bootstrap.serverName | default .Values.bootstrap.oldName | quote }} {{- else if hasKey (.Values.users | default dict) "app" }} {{- /* "app" is the owner CNPG bootstraps, and users.app adopts that role. CNPG's @@ -456,23 +456,26 @@ spec: {{- /* Security: Block parameters that enable arbitrary code execution (shell commands or .so loading) */ -}} {{- $dangerousParams := list "archive_command" "restore_command" "ssl_passphrase_command" "archive_cleanup_command" "recovery_end_command" "dynamic_library_path" "local_preload_libraries" "session_preload_libraries" "shared_preload_libraries" }} {{- range $key, $value := $params }} + {{- if not (regexMatch "^[A-Za-z_][A-Za-z0-9_.]*$" $key) }} + {{- fail (printf "postgresql.parameters: %q is not a PostgreSQL parameter name; a name may contain only letters, digits, underscores and dots, and must start with a letter or an underscore" $key) }} + {{- end }} {{- $normalizedKey := lower $key }} {{- if has $normalizedKey $dangerousParams }} {{- fail (printf "SECURITY: Parameter '%s' is blocked. This parameter can enable arbitrary code execution and must not be set by tenants." $key) }} {{- end }} - {{ $key }}: {{ $value | toString | quote }} + {{ $key | quote }}: {{ $value | toString | quote }} {{- end }} - minSyncReplicas: {{ .Values.quorum.minSyncReplicas }} - maxSyncReplicas: {{ .Values.quorum.maxSyncReplicas }} + minSyncReplicas: {{ .Values.quorum.minSyncReplicas | int }} + maxSyncReplicas: {{ .Values.quorum.maxSyncReplicas | int }} monitoring: enablePodMonitor: true storage: - size: {{ required ".Values.size is required" .Values.size }} + size: {{ required ".Values.size is required" .Values.size | quote }} {{- with .Values.storageClass }} - storageClass: {{ . }} + storageClass: {{ . | quote }} {{- end }} inheritedMetadata: @@ -501,7 +504,7 @@ spec: below, so should a future reconciler compare desired vs observed it still holds actual >= desired, rather than false-flagging every idle-to-floor as the live count (or the >floor seed) would. */}} - replicas: {{ if $autoscaling }}{{ include "postgres.autoscaling.effectiveMin" . }}{{ else }}{{ .Values.replicas }}{{ end }} + replicas: {{ if $autoscaling }}{{ include "postgres.autoscaling.effectiveMin" . }}{{ else }}{{ .Values.replicas | int }}{{ end }} minReplicas: 1 kind: postgres type: postgres @@ -529,20 +532,20 @@ spec: # cozy-lib.barman.sidecarConfiguration). {{- include "cozy-lib.barman.sidecarConfiguration" . | nindent 2 }} configuration: - destinationPath: {{ $destinationPath }} - endpointURL: {{ $endpointURL }} + destinationPath: {{ $destinationPath | quote }} + endpointURL: {{ $endpointURL | quote }} {{- if $caCfg.name }} endpointCA: - name: {{ $caCfg.name }} - key: {{ $caKey }} + name: {{ $caCfg.name | quote }} + key: {{ $caKey | quote }} {{- end }} s3Credentials: accessKeyId: - name: {{ $credSecretName }} - key: {{ $credAccessKey }} + name: {{ $credSecretName | quote }} + key: {{ $credAccessKey | quote }} secretAccessKey: - name: {{ $credSecretName }} - key: {{ $credSecretKey }} + name: {{ $credSecretName | quote }} + key: {{ $credSecretKey | quote }} {{- end }} {{- if .Values.bootstrap.enabled }} --- @@ -557,18 +560,18 @@ spec: # Same sidecar configuration as the backup ObjectStore above. {{- include "cozy-lib.barman.sidecarConfiguration" . | nindent 2 }} configuration: - destinationPath: {{ $destinationPath }} - endpointURL: {{ $endpointURL }} + destinationPath: {{ $destinationPath | quote }} + endpointURL: {{ $endpointURL | quote }} {{- if $caCfg.name }} endpointCA: - name: {{ $caCfg.name }} - key: {{ $caKey }} + name: {{ $caCfg.name | quote }} + key: {{ $caKey | quote }} {{- end }} s3Credentials: accessKeyId: - name: {{ $credSecretName }} - key: {{ $credAccessKey }} + name: {{ $credSecretName | quote }} + key: {{ $credAccessKey | quote }} secretAccessKey: - name: {{ $credSecretName }} - key: {{ $credSecretKey }} + name: {{ $credSecretName | quote }} + key: {{ $credSecretKey | quote }} {{- end }} diff --git a/packages/apps/postgres/templates/regsecret.yaml b/packages/apps/postgres/templates/regsecret.yaml index a76dd9460..941bcfd70 100644 --- a/packages/apps/postgres/templates/regsecret.yaml +++ b/packages/apps/postgres/templates/regsecret.yaml @@ -5,6 +5,7 @@ metadata: name: {{ .Release.Name }}-regsecret type: kubernetes.io/dockerconfigjson stringData: - .dockerconfigjson: | - {{- toJson .Values.registrySecret | nindent 4 }} + {{- /* Quoted rather than a block scalar, so the value stays one YAML scalar + whatever characters it holds. */}} + .dockerconfigjson: {{ toJson .Values.registrySecret | quote }} {{- end }} diff --git a/packages/apps/postgres/tests/backup_storage_test.yaml b/packages/apps/postgres/tests/backup_storage_test.yaml index 1a4312133..937380693 100644 --- a/packages/apps/postgres/tests/backup_storage_test.yaml +++ b/packages/apps/postgres/tests/backup_storage_test.yaml @@ -348,10 +348,9 @@ tests: - equal: path: spec.bootstrap.recovery.recoveryTarget.backupID value: "20260921T062713" - # targetTime renders unquoted, so both sides read as a YAML timestamp. - equal: path: spec.bootstrap.recovery.recoveryTarget.targetTime - value: 2026-09-22T10:00:00Z + value: "2026-09-22T10:00:00Z" - it: "bootstrap recovery with backupID only: recovery starts from it and replays to the end of the log" template: templates/db.yaml diff --git a/packages/apps/postgres/tests/restore_adoption_test.yaml b/packages/apps/postgres/tests/restore_adoption_test.yaml index 13863c1cb..a8eaca33d 100644 --- a/packages/apps/postgres/tests/restore_adoption_test.yaml +++ b/packages/apps/postgres/tests/restore_adoption_test.yaml @@ -72,17 +72,17 @@ tests: - it: never renders the restore mark into the script verbatim set: bootstrap: - newServerName: "x'; DROP DATABASE orders; --" + newServerName: pg-test-restore-0123456789abcdef documentSelector: path: metadata.name value: pg-test-init-script asserts: - notMatchRegex: path: stringData["init.sh"] - pattern: 'DROP DATABASE orders' + pattern: 'pg-test-restore-0123456789abcdef' - matchRegex: path: stringData["init.sh"] - pattern: 'RESTORE_MARK=\$\(echo eCc7IERST1AgREFUQUJBU0Ugb3JkZXJzOyAtLQ== \| base64 -d\)' + pattern: 'RESTORE_MARK=\$\(echo cGctdGVzdC1yZXN0b3JlLTAxMjM0NTY3ODlhYmNkZWY= \| base64 -d\)' - it: keeps the plain drop and records nothing when no restore is in play documentSelector: diff --git a/packages/apps/postgres/values.schema.json b/packages/apps/postgres/values.schema.json index 14b7bdeed..103245916 100644 --- a/packages/apps/postgres/values.schema.json +++ b/packages/apps/postgres/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", @@ -389,7 +391,8 @@ "destinationPath": { "description": "DEPRECATED. Per-tenant S3 configuration is superseded by the platform-managed `cozy-default` BackupClass and the `cozy-backups` system bucket. Leave empty for new installations; the BackupClass driver picks up the system-managed coordinates. Kept for in-place upgrade compatibility.", "type": "string", - "default": "s3://bucket/path/to/folder/" + "default": "s3://bucket/path/to/folder/", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "enabled": { "description": "Enable regular backups.", @@ -404,24 +407,30 @@ "key": { "description": "Key within the Secret containing the CA bundle. Defaults to `ca.crt`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "name": { "description": "Name of the Secret in the application namespace. Empty means no endpointCA is emitted (the plugin uses the system trust store).", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } }, "endpointURL": { "description": "DEPRECATED. See `destinationPath`.", "type": "string", - "default": "http://minio-gateway-service:9000" + "default": "http://minio-gateway-service:9000", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "retentionPolicy": { "description": "Retention policy (e.g. \"30d\").", "type": "string", - "default": "30d" + "default": "30d", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "s3AccessKey": { "description": "DEPRECATED. Tenants no longer supply S3 keys; the system Bucket Secret is projected into the tenant namespace by the backup controller. Ignored when `s3CredentialsSecret.name` is set or `useSystemBucket` is true. The chart skips materialising `\u003crelease\u003e-s3-creds` whenever this field is empty so a default install does not leak placeholder credentials into the tenant namespace.", @@ -436,17 +445,23 @@ "accessKeyIDKey": { "description": "Key in the Secret holding the access key ID. Defaults to `AWS_ACCESS_KEY_ID`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" }, "name": { "description": "Name of the Secret in the application namespace. Empty means the chart materialises `\u003crelease\u003e-s3-creds` from `s3AccessKey`/`s3SecretKey`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "secretAccessKeyKey": { "description": "Key in the Secret holding the secret access key. Defaults to `AWS_SECRET_ACCESS_KEY`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^[-._a-zA-Z0-9]*$" } } }, @@ -479,7 +494,8 @@ "backupID": { "description": "Barman ID of the base backup to recover from, passed as `recoveryTarget.backupID`. Empty lets the barman-cloud plugin pick one: the newest backup when `recoveryTime` is empty, otherwise the newest one ending at or before it, on any timeline. The CNPG backup driver sets this on restore.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "enabled": { "description": "Whether to restore from a backup.", @@ -489,22 +505,27 @@ "newServerName": { "description": "WAL-archive server name (S3 path prefix) the RESTORED cluster writes to. Must differ from `serverName` (the recovery source) so a restored cluster archives to a fresh, empty prefix and barman-cloud-check-wal-archive passes while it recovers from the source's prefix. The CNPG backup driver sets this on restore; empty means the cluster archives under its own name.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "oldName": { "description": "Previous cluster name before deletion.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "recoveryTime": { "description": "Timestamp (RFC3339) for point-in-time recovery; empty means latest.", "type": "string", - "default": "" + "default": "", + "pattern": "^[0-9TZtz:.+ -]*$" }, "serverName": { "description": "Server name (S3 path prefix) used by the original cluster when writing backups; passed to the barman-cloud plugin via `externalClusters[].plugin.parameters.serverName`. Defaults to `bootstrap.oldName`. Set this only when the original cluster wrote backups under an explicit server name that differed from its Kubernetes resource name.", "type": "string", - "default": "" + "default": "", + "pattern": "^[^\\s\"'$`\\x5c;\u0026|\u003c\u003e(){}]*$" }, "sourceImageName": { "description": "Image of the cluster the backup was taken from. A restore of a backup taken on one of the bare Debian bullseye tags the chart used before standard-trixie comes back on that image (see `allowCollationChange`); any other value is ignored. The CNPG backup driver sets this on restore and clears it with `enabled`.", diff --git a/packages/apps/postgres/values.yaml b/packages/apps/postgres/values.yaml index 675470075..4084fe2c5 100644 --- a/packages/apps/postgres/values.yaml +++ b/packages/apps/postgres/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.micro" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" @@ -331,20 +333,33 @@ databases: {} ## @typedef {struct} S3CredentialsSecret - Reference to a pre-existing Secret with S3 credentials. Setting `name` makes the chart bind the barman-cloud ObjectStore's `spec.configuration.s3Credentials` directly to that Secret instead of materialising `-s3-creds` from `s3AccessKey`/`s3SecretKey`. Use this to keep credentials out of the Postgres CR's `.spec`. ## @field {string} [name] - Name of the Secret in the application namespace. Empty means the chart materialises `-s3-creds` from `s3AccessKey`/`s3SecretKey`. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [accessKeyIDKey] - Key in the Secret holding the access key ID. Defaults to `AWS_ACCESS_KEY_ID`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @field {string} [secretAccessKeyKey] - Key in the Secret holding the secret access key. Defaults to `AWS_SECRET_ACCESS_KEY`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @typedef {struct} EndpointCA - Reference to a Secret holding a PEM-encoded CA bundle the barman-cloud plugin should trust when reaching a self-signed S3 endpoint. Required when the cluster's S3 (e.g. cozystack's seaweedfs-s3) presents a certificate not signed by a publicly-trusted CA. Used by both the backup ObjectStore's spec.configuration.endpointCA and the recovery ObjectStore's spec.configuration.endpointCA (referenced from externalClusters[].plugin) so backup *and* recovery can verify TLS. ## @field {string} [name] - Name of the Secret in the application namespace. Empty means no endpointCA is emitted (the plugin uses the system trust store). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [key] - Key within the Secret containing the CA bundle. Defaults to `ca.crt`. +## @maxLength 253 +## @pattern ^[-._a-zA-Z0-9]*$ ## @typedef {struct} Backup - Backup configuration. ## @field {bool} enabled - Enable regular backups. ## @field {bool} [useSystemBucket] - Opt-in: when true, the chart-emitted `-s3-creds` Secret is skipped AND `spec.plugins` (plus the barman-cloud ObjectStore) is left UNSET in the chart-rendered Cluster — the cozy-default BackupClass driver SSA-applies an ObjectStore (carrying destinationPath/endpointURL/credentials) and patches `spec.plugins` on the live Cluster when the first BackupJob runs. Consequence: plugin WAL archiving is NOT active until that first BackupJob fires; WAL accumulates on the PVC in the meantime, so fire an ad-hoc BackupJob immediately after enabling the flag on existing releases. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill `s3AccessKey`/`s3SecretKey` or `destinationPath`/`endpointURL`. The destination path automatically scopes to `s3://cozy-backups///`. ## @field {string} [schedule] - Legacy. Cron schedule for the chart-emitted ScheduledBackup, either a standard five-field cron such as `0 2 * * *` for every day at 02:00, or six fields with leading seconds such as `0 0 2 * * *` for the same time. Empty means no chart-managed schedule, which is the recommended setup when a `BackupClass` from `backups.cozystack.io` already drives backup orchestration. In the legacy chart-managed flow `spec.plugins` plus the barman-cloud ObjectStore is rendered when `backup.enabled=true` AND `useSystemBucket=false` AND `destinationPath` is non-empty AND inline-or-external creds are supplied; in the platform `useSystemBucket=true` flow the chart skips emitting `spec.plugins` and the CNPG driver SSA-applies the ObjectStore and patches `spec.plugins` onto the live Cluster at first BackupJob time. ## @field {string} [retentionPolicy] - Retention policy (e.g. "30d"). +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [destinationPath] - DEPRECATED. Per-tenant S3 configuration is superseded by the platform-managed `cozy-default` BackupClass and the `cozy-backups` system bucket. Leave empty for new installations; the BackupClass driver picks up the system-managed coordinates. Kept for in-place upgrade compatibility. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [endpointURL] - DEPRECATED. See `destinationPath`. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [s3AccessKey] - DEPRECATED. Tenants no longer supply S3 keys; the system Bucket Secret is projected into the tenant namespace by the backup controller. Ignored when `s3CredentialsSecret.name` is set or `useSystemBucket` is true. The chart skips materialising `-s3-creds` whenever this field is empty so a default install does not leak placeholder credentials into the tenant namespace. ## @field {string} [s3SecretKey] - DEPRECATED. See `s3AccessKey`. ## @field {S3CredentialsSecret} [s3CredentialsSecret] - DEPRECATED. Pre-existing Secret with S3 credentials. Use the platform-managed `cozy-default` BackupClass instead. When set, the chart references this Secret directly (legacy chart-managed flow). The CNPG backup driver writes this field on restore so credentials never land in the CR `.spec`. @@ -398,10 +413,16 @@ backup: ## @typedef {struct} Bootstrap - Bootstrap configuration for restoring a database cluster from a backup. ## @field {bool} enabled - Whether to restore from a backup. ## @field {string} [recoveryTime] - Timestamp (RFC3339) for point-in-time recovery; empty means latest. +## @pattern ^[0-9TZtz:.+ -]*$ ## @field {string} [backupID] - Barman ID of the base backup to recover from, passed as `recoveryTarget.backupID`. Empty lets the barman-cloud plugin pick one: the newest backup when `recoveryTime` is empty, otherwise the newest one ending at or before it, on any timeline. The CNPG backup driver sets this on restore. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} oldName - Previous cluster name before deletion. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [serverName] - Server name (S3 path prefix) used by the original cluster when writing backups; passed to the barman-cloud plugin via `externalClusters[].plugin.parameters.serverName`. Defaults to `bootstrap.oldName`. Set this only when the original cluster wrote backups under an explicit server name that differed from its Kubernetes resource name. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [newServerName] - WAL-archive server name (S3 path prefix) the RESTORED cluster writes to. Must differ from `serverName` (the recovery source) so a restored cluster archives to a fresh, empty prefix and barman-cloud-check-wal-archive passes while it recovers from the source's prefix. The CNPG backup driver sets this on restore; empty means the cluster archives under its own name. +## @pattern ^[^\s"'$`\x5c;&|<>(){}]*$ ## @field {string} [sourceImageName] - Image of the cluster the backup was taken from. A restore of a backup taken on one of the bare Debian bullseye tags the chart used before standard-trixie comes back on that image (see `allowCollationChange`); any other value is ignored. The CNPG backup driver sets this on restore and clears it with `enabled`. ## @param {Bootstrap} bootstrap - Bootstrap configuration. diff --git a/packages/apps/qdrant/templates/qdrant.yaml b/packages/apps/qdrant/templates/qdrant.yaml index 4caf04403..b1594c625 100644 --- a/packages/apps/qdrant/templates/qdrant.yaml +++ b/packages/apps/qdrant/templates/qdrant.yaml @@ -46,15 +46,15 @@ spec: values: qdrant: fullnameOverride: {{ .Release.Name }} - replicaCount: {{ .Values.replicas }} + replicaCount: {{ .Values.replicas | int }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 8 }} apiKey: true livenessProbe: enabled: true persistence: - size: {{ .Values.size }} + size: {{ .Values.size | quote }} {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} metrics: serviceMonitor: diff --git a/packages/apps/qdrant/templates/workloadmonitor.yaml b/packages/apps/qdrant/templates/workloadmonitor.yaml index 09038d5a0..a352a8839 100644 --- a/packages/apps/qdrant/templates/workloadmonitor.yaml +++ b/packages/apps/qdrant/templates/workloadmonitor.yaml @@ -6,7 +6,7 @@ metadata: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: minReplicas: 1 - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} kind: qdrant type: qdrant selector: diff --git a/packages/apps/qdrant/values.schema.json b/packages/apps/qdrant/values.schema.json index ba76fb49e..361763304 100644 --- a/packages/apps/qdrant/values.schema.json +++ b/packages/apps/qdrant/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/qdrant/values.yaml b/packages/apps/qdrant/values.yaml index c9d1d891a..6a93dacbe 100644 --- a/packages/apps/qdrant/values.yaml +++ b/packages/apps/qdrant/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.small" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/rabbitmq/templates/rabbitmq.yaml b/packages/apps/rabbitmq/templates/rabbitmq.yaml index 24d983e24..f97d1a544 100644 --- a/packages/apps/rabbitmq/templates/rabbitmq.yaml +++ b/packages/apps/rabbitmq/templates/rabbitmq.yaml @@ -79,7 +79,7 @@ metadata: rabbitmq.com/operator-connection-uri: "http://{{ .Release.Name }}.{{ .Release.Namespace }}.svc.{{ include "rabbitmq.clusterDomain" . }}:15672" {{- end }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} image: 'rabbitmq:{{ include "rabbitmq.versionMap" $ }}-management' {{- if .Values.external }} service: @@ -87,7 +87,7 @@ spec: {{- end }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 4 }} {{- with .Values.affinity }} - affinity: {{- toYaml . | nindent 4 }} + affinity: {{- include "cozy-lib.affinity.toYaml" (list . "affinity") | nindent 4 }} {{- end }} {{- if $tlsEnabled }} {{- /* secretName is the whole of it: the operator's defaultTLSConf then supplies @@ -125,9 +125,9 @@ spec: persistence: {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} - storage: {{ .Values.size }} + storage: {{ .Values.size | quote }} {{- /* The User object keeps its pre-conversion name: renaming it would make the operator delete the broker user and create it again. Its password @@ -141,7 +141,7 @@ spec: apiVersion: rabbitmq.com/v1beta1 kind: User metadata: - name: {{ $.Release.Name }}-{{ kebabcase $user }} + name: {{ printf "%s-%s" $.Release.Name (kebabcase $user) | quote }} spec: importCredentialsSecret: name: {{ include "rabbitmq.accountSecret" (list $ $user) | quote }} @@ -154,9 +154,9 @@ spec: apiVersion: rabbitmq.com/v1beta1 kind: Vhost metadata: - name: {{ $.Release.Name }}-{{ kebabcase $host }} + name: {{ printf "%s-%s" $.Release.Name (kebabcase $host) | quote }} spec: - name: {{ $host }} + name: {{ $host | quote }} rabbitmqClusterReference: name: {{ $.Release.Name }} {{- range $user := $h.roles.admin }} @@ -164,10 +164,10 @@ spec: apiVersion: rabbitmq.com/v1beta1 kind: Permission metadata: - name: {{ $.Release.Name }}-{{ kebabcase $host }}-{{ kebabcase $user }} + name: {{ printf "%s-%s-%s" $.Release.Name (kebabcase $host) (kebabcase $user) | quote }} spec: - vhost: "{{ $host }}" - user: "{{ $user }}" + vhost: {{ $host | quote }} + user: {{ $user | quote }} permissions: write: ".*" configure: ".*" @@ -180,10 +180,10 @@ spec: apiVersion: rabbitmq.com/v1beta1 kind: Permission metadata: - name: {{ $.Release.Name }}-{{ kebabcase $host }}-{{ kebabcase $user }} + name: {{ printf "%s-%s-%s" $.Release.Name (kebabcase $host) (kebabcase $user) | quote }} spec: - vhost: "{{ $host }}" - user: "{{ $user }}" + vhost: {{ $host | quote }} + user: {{ $user | quote }} permissions: read: ".*" rabbitmqClusterReference: diff --git a/packages/apps/rabbitmq/templates/workloadmonitor.yaml b/packages/apps/rabbitmq/templates/workloadmonitor.yaml index 66941153d..2abea2160 100644 --- a/packages/apps/rabbitmq/templates/workloadmonitor.yaml +++ b/packages/apps/rabbitmq/templates/workloadmonitor.yaml @@ -6,7 +6,7 @@ metadata: labels: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} minReplicas: 1 kind: rabbitmq type: rabbitmq diff --git a/packages/apps/rabbitmq/values.schema.json b/packages/apps/rabbitmq/values.schema.json index 0f9fb5acc..d809ec982 100644 --- a/packages/apps/rabbitmq/values.schema.json +++ b/packages/apps/rabbitmq/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/rabbitmq/values.yaml b/packages/apps/rabbitmq/values.yaml index e2125af2c..25c621674 100644 --- a/packages/apps/rabbitmq/values.yaml +++ b/packages/apps/rabbitmq/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "s1.nano" size: 10Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/redis/templates/redisfailover.yaml b/packages/apps/redis/templates/redisfailover.yaml index fa409dd8f..9f0c4546d 100644 --- a/packages/apps/redis/templates/redisfailover.yaml +++ b/packages/apps/redis/templates/redisfailover.yaml @@ -91,15 +91,15 @@ spec: {{- end }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $sentinelPreset $sentinelResources $) | nindent 6 }} {{- with (.Values.affinity).sentinel }} - affinity: {{- toYaml . | nindent 6 }} + affinity: {{- include "cozy-lib.affinity.toYaml" (list . "affinity.sentinel") | nindent 6 }} {{- end }} redis: image: {{ $redisImage | quote }} resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 6 }} {{- with (.Values.affinity).redis }} - affinity: {{- toYaml . | nindent 6 }} + affinity: {{- include "cozy-lib.affinity.toYaml" (list . "affinity.redis") | nindent 6 }} {{- end }} - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} {{- if $spreadConstraints }} topologySpreadConstraints: {{- range $spreadConstraints }} @@ -129,9 +129,9 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ . }} + storage: {{ . | quote }} {{- with $.Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} {{- end }} exporter: @@ -219,7 +219,7 @@ metadata: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: minReplicas: 1 - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} kind: redis type: redis selector: diff --git a/packages/apps/redis/values.schema.json b/packages/apps/redis/values.schema.json index a3696cc07..e6d2eab8a 100644 --- a/packages/apps/redis/values.schema.json +++ b/packages/apps/redis/values.schema.json @@ -131,6 +131,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/redis/values.yaml b/packages/apps/redis/values.yaml index 21622a10a..393e5d3b8 100644 --- a/packages/apps/redis/values.yaml +++ b/packages/apps/redis/values.yaml @@ -77,6 +77,8 @@ affinity: size: 1Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/tcp-balancer/templates/configmap.yaml b/packages/apps/tcp-balancer/templates/configmap.yaml index 327b8200e..d61ed73fe 100644 --- a/packages/apps/tcp-balancer/templates/configmap.yaml +++ b/packages/apps/tcp-balancer/templates/configmap.yaml @@ -11,6 +11,18 @@ default-server observe layer4 error-limit 10 on-error mark-down check send-proxy {{- fail (printf "mode %s is not supported" .) }} {{- end }} {{- end }} +{{- range $i, $net := .Values.whitelist }} +{{- if not (regexMatch "^[0-9A-Fa-f.:]+(/([0-9]+|[0-9]{1,3}(\\.[0-9]{1,3}){3}))?$" (toString $net)) }} +{{- fail (printf "whitelist[%d] is %q: entries must be IPv4 or IPv6 addresses or networks, with a prefix length or an IPv4 netmask" $i (toString $net)) }} +{{- end }} +{{- end }} +{{- range $section := list "httpAndHttps" "kubernetesAndTalos" }} +{{- range $i, $ep := (dig "endpoints" list (get $.Values $section | default dict)) }} +{{- if not (regexMatch "^[A-Za-z0-9]([-A-Za-z0-9_.:]*[A-Za-z0-9])?$|^\\[[0-9A-Fa-f:.]+\\]$" (toString $ep)) }} +{{- fail (printf "%s.endpoints[%d] is %q: entries must be IP addresses or host names" $section $i (toString $ep)) }} +{{- end }} +{{- end }} +{{- end }} {{- $resources := include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | fromYaml }} {{- $memoryMi := div (include "cozy-lib.resources.toFloat" $resources.limits.memory | float64 | int64) 1048576 }} {{- $cpu := include "cozy-lib.resources.toFloat" $resources.limits.cpu | float64 }} diff --git a/packages/apps/tcp-balancer/tests/haproxy-config_test.yaml b/packages/apps/tcp-balancer/tests/haproxy-config_test.yaml index d1abbee44..84d9f6e1f 100644 --- a/packages/apps/tcp-balancer/tests/haproxy-config_test.yaml +++ b/packages/apps/tcp-balancer/tests/haproxy-config_test.yaml @@ -62,6 +62,28 @@ tests: path: data["haproxy.cfg"] pattern: '(?m)^frontend https$\n(?:[ \t]+.*\n)*?[ \t]+acl whitelist src 10\.0\.0\.0/8 192\.168\.1\.1\n[ \t]+acl all src 0\.0\.0\.0\n[ \t]+tcp-request content accept if whitelist\n[ \t]+tcp-request content reject$' + # Each entry is written into a haproxy acl line as is, so it is held to an + # address or a network, which haproxy also takes with an IPv4 netmask. + - it: accepts a network written with an IPv4 netmask + set: + whitelistHTTP: true + whitelist: + - 192.168.0.0/255.255.0.0 + - 2001:db8::/32 + asserts: + - matchRegex: + path: data["haproxy.cfg"] + pattern: 'acl whitelist src 192\.168\.0\.0/255\.255\.0\.0 2001:db8::/32\n' + + - it: refuses a whitelist entry that is not an address or a network + set: + whitelistHTTP: true + whitelist: + - "10.0.0.0/8\n tcp-request content accept" + asserts: + - failedTemplate: + errorPattern: 'whitelist\[0\] is .*: entries must be IPv4 or IPv6 addresses or networks' + - it: renames kubernetes and talos backends set: kubernetesAndTalos: diff --git a/packages/apps/tenant/templates/namespace.yaml b/packages/apps/tenant/templates/namespace.yaml index 9a752bf88..5f33df350 100644 --- a/packages/apps/tenant/templates/namespace.yaml +++ b/packages/apps/tenant/templates/namespace.yaml @@ -145,7 +145,9 @@ stringData: {{- with $schedulingClass }} schedulingClass: {{ . | quote }} {{- end }} + {{- /* Each name is quoted rather than JSON-encoded, so it stays one YAML + scalar inside this block whatever characters it holds. */}} {{- with $allowedSchedulingClasses }} - allowedSchedulingClasses: {{ toJson . }} + allowedSchedulingClasses: [{{ range $i, $class := . }}{{ if $i }},{{ end }}{{ quote $class }}{{ end }}] {{- end }} {{- end }} diff --git a/packages/apps/tenant/values.schema.json b/packages/apps/tenant/values.schema.json index 75923f50b..3978a3286 100644 --- a/packages/apps/tenant/values.schema.json +++ b/packages/apps/tenant/values.schema.json @@ -5,7 +5,9 @@ "host": { "description": "The hostname used to access tenant services (defaults to using the tenant name as a subdomain for its parent tenant host).", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "etcd": { "description": "Deploy own Etcd cluster.", @@ -50,7 +52,9 @@ "schedulingClass": { "description": "The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads.", "type": "string", - "default": "" + "default": "", + "maxLength": 63, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "allowedSchedulingClasses": { "description": "SchedulingClasses an application in this tenant may select through its own `schedulingClass`, in place of the tenant's. Empty allows none, so every application runs under the tenant's class. Inherited from the parent tenant, and not settable here, when the parent has a `schedulingClass` or a non-empty list.", diff --git a/packages/apps/tenant/values.yaml b/packages/apps/tenant/values.yaml index 7160eb5ed..8563b1c5f 100644 --- a/packages/apps/tenant/values.yaml +++ b/packages/apps/tenant/values.yaml @@ -3,6 +3,8 @@ ## ## @param {string} [host] - The hostname used to access tenant services (defaults to using the tenant name as a subdomain for its parent tenant host). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ host: "" ## @param {bool} etcd - Deploy own Etcd cluster. @@ -30,6 +32,8 @@ seaweedfs: false computeplane: false ## @param {string} [schedulingClass] - The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads. +## @maxLength 63 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ schedulingClass: "" ## @param {[]string} allowedSchedulingClasses - SchedulingClasses an application in this tenant may select through its own `schedulingClass`, in place of the tenant's. Empty allows none, so every application runs under the tenant's class. Inherited from the parent tenant, and not settable here, when the parent has a `schedulingClass` or a non-empty list. diff --git a/packages/apps/valkey/templates/valkeyfailover.yaml b/packages/apps/valkey/templates/valkeyfailover.yaml index 972779fcd..a066cb5ad 100644 --- a/packages/apps/valkey/templates/valkeyfailover.yaml +++ b/packages/apps/valkey/templates/valkeyfailover.yaml @@ -45,7 +45,7 @@ spec: redis: image: "valkey/valkey:{{ include "valkey.versionMap" $ }}" resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 6 }} - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} {{- if $spreadConstraints }} topologySpreadConstraints: {{- range $spreadConstraints }} @@ -75,9 +75,9 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ . }} + storage: {{ . | quote }} {{- with $.Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} {{- end }} exporter: @@ -116,7 +116,7 @@ metadata: workloads.cozystack.io/resource-preset: {{ .Values.resourcesPreset | quote }} spec: minReplicas: 1 - replicas: {{ .Values.replicas }} + replicas: {{ .Values.replicas | int }} kind: valkey type: valkey selector: diff --git a/packages/apps/valkey/values.schema.json b/packages/apps/valkey/values.schema.json index 22644d4b8..fdd706dec 100644 --- a/packages/apps/valkey/values.schema.json +++ b/packages/apps/valkey/values.schema.json @@ -112,6 +112,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/valkey/values.yaml b/packages/apps/valkey/values.yaml index c39cf49fe..483404c16 100644 --- a/packages/apps/valkey/values.yaml +++ b/packages/apps/valkey/values.yaml @@ -68,6 +68,8 @@ resourcesPreset: "t1.nano" size: 1Gi ## @param {string} storageClass - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @immutable ## @x-cozystack-options {source: storageclass} storageClass: "" diff --git a/packages/apps/vm-disk/templates/dv.yaml b/packages/apps/vm-disk/templates/dv.yaml index ece50fa0a..21515c43f 100644 --- a/packages/apps/vm-disk/templates/dv.yaml +++ b/packages/apps/vm-disk/templates/dv.yaml @@ -311,8 +311,8 @@ spec: storage: resources: requests: - storage: {{ .Values.storage }} + storage: {{ .Values.storage | quote }} {{- with .Values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} {{- end }} diff --git a/packages/apps/vm-disk/templates/pvc-resize-hook.yaml b/packages/apps/vm-disk/templates/pvc-resize-hook.yaml index 224da33ba..5231c4f64 100644 --- a/packages/apps/vm-disk/templates/pvc-resize-hook.yaml +++ b/packages/apps/vm-disk/templates/pvc-resize-hook.yaml @@ -41,11 +41,18 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + env: + - name: PVC_NAME + value: {{ .Release.Name | quote }} + - name: STORAGE + value: {{ .Values.storage | toString | quote }} + - name: PATCH + value: {{ dict "spec" (dict "resources" (dict "requests" (dict "storage" (.Values.storage | toString)))) | toJson | quote }} command: ["sh", "-xec"] args: - | - echo "Resizing PVC to {{ .Values.storage }}..." - kubectl patch pvc {{ .Release.Name }} -p '{"spec":{"resources":{"requests":{"storage":"{{ .Values.storage }}"}}}}' + echo "Resizing PVC to $STORAGE..." + kubectl patch pvc "$PVC_NAME" -p "$PATCH" --- apiVersion: v1 kind: ServiceAccount diff --git a/packages/apps/vm-disk/values.schema.json b/packages/apps/vm-disk/values.schema.json index b43beecf0..d8a9d0f9f 100644 --- a/packages/apps/vm-disk/values.schema.json +++ b/packages/apps/vm-disk/values.schema.json @@ -16,7 +16,9 @@ "properties": { "name": { "description": "Name of the vm-disk to clone.", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" } } }, @@ -43,6 +45,8 @@ "name": { "description": "Name of the image to use.", "type": "string", + "maxLength": 235, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$", "x-cozystack-options": { "source": "image" } @@ -85,6 +89,8 @@ "description": "StorageClass used to store the data.", "type": "string", "default": "replicated", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-kubernetes-validations": [ { "rule": "self == oldSelf", diff --git a/packages/apps/vm-disk/values.yaml b/packages/apps/vm-disk/values.yaml index 616349c9e..b89d51bf4 100644 --- a/packages/apps/vm-disk/values.yaml +++ b/packages/apps/vm-disk/values.yaml @@ -4,6 +4,8 @@ ## @typedef {struct} SourceImage - Use image by name. ## @field {string} name - Name of the image to use. +## @maxLength 235 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ ## @x-cozystack-options {source: image} ## @typedef {struct} SourceUpload - Upload local image. @@ -13,6 +15,8 @@ ## @typedef {struct} SourceDisk - Clone an existing vm-disk. ## @field {string} name - Name of the vm-disk to clone. +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @typedef {struct} Source - The source image location used to create a disk. ## @field {*SourceImage} [image] - Use image by name from default collection. @@ -33,6 +37,8 @@ storage: 5Gi ## @param {string} storageClass - StorageClass used to store the data. ## @immutable +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @x-cozystack-options {source: storageclass} storageClass: replicated diff --git a/packages/apps/vm-instance/templates/secret.yaml b/packages/apps/vm-instance/templates/secret.yaml index 73cd92bf9..2d24319b9 100644 --- a/packages/apps/vm-instance/templates/secret.yaml +++ b/packages/apps/vm-instance/templates/secret.yaml @@ -16,10 +16,10 @@ kind: Secret metadata: name: {{ include "virtual-machine.fullname" . }}-cloud-init stringData: + {{- if .Values.cloudInit }} + userdata: {{ printf "%s\n" (regexReplaceAll "\n+$" .Values.cloudInit "") | quote }} + {{- else }} userdata: | - {{- if .Values.cloudInit }} - {{- .Values.cloudInit | nindent 4 }} - {{- else if and (.Values.sshKeys) (not .Values.cloudInit) }} {{- /* We usually provide ssh keys in cloud-init metadata, because userdata it not typed and can be used for any purpose. However, if user provides ssh keys but not cloud-init, we still need to provide a minimal cloud-init config to avoid errors. diff --git a/packages/apps/vm-instance/templates/vm-update-hook.yaml b/packages/apps/vm-instance/templates/vm-update-hook.yaml index ab77f21b1..5da1a0921 100644 --- a/packages/apps/vm-instance/templates/vm-update-hook.yaml +++ b/packages/apps/vm-instance/templates/vm-update-hook.yaml @@ -82,40 +82,57 @@ spec: limits: memory: "128Mi" cpu: "100m" + env: + - name: VM_NAME + value: {{ $vmName | quote }} + - name: NAMESPACE + value: {{ $namespace | quote }} + {{- if $needUpdateType }} + - name: PATCH_INSTANCETYPE + value: {{ dict "spec" (dict "instancetype" (dict "name" $instanceType "revisionName" nil)) | toJson | quote }} + {{- end }} + {{- if $needUpdateProfile }} + - name: PATCH_PREFERENCE + value: {{ dict "spec" (dict "preference" (dict "name" $instanceProfile "revisionName" nil)) | toJson | quote }} + {{- end }} + {{- if $needRemoveInstanceType }} + {{- $spec := dict "instancetype" nil "template" (dict "spec" (dict "domain" (include "virtual-machine.domainResources" . | fromJson))) }} + {{- if not $instanceProfile }} + {{- $_ := set $spec "preference" nil }} + {{- end }} + - name: PATCH_REMOVE_INSTANCETYPE + value: {{ dict "spec" $spec | toJson | quote }} + {{- end }} + {{- if $needRemoveCustomResources }} + - name: PATCH_REMOVE_RESOURCES + value: {{ dict "spec" (dict "instancetype" (dict "name" $instanceType "revisionName" nil) "template" (dict "spec" (dict "domain" (dict "cpu" nil "resources" nil)))) | toJson | quote }} + {{- end }} command: ["sh", "-exc"] args: - | {{- if $needUpdateType }} echo "Patching VirtualMachine for instancetype update..." - kubectl patch virtualmachines.kubevirt.io {{ $vmName }} -n {{ $namespace }} \ - --type merge \ - -p '{"spec":{"instancetype":{"name": "{{ $instanceType }}", "revisionName": null}}}' + kubectl patch virtualmachines.kubevirt.io "$VM_NAME" -n "$NAMESPACE" --type merge -p "$PATCH_INSTANCETYPE" {{- end }} {{- if $needUpdateProfile }} echo "Patching VirtualMachine for preference update..." - kubectl patch virtualmachines.kubevirt.io {{ $vmName }} -n {{ $namespace }} \ - --type merge \ - -p '{"spec":{"preference":{"name": "{{ $instanceProfile }}", "revisionName": null}}}' + kubectl patch virtualmachines.kubevirt.io "$VM_NAME" -n "$NAMESPACE" --type merge -p "$PATCH_PREFERENCE" {{- end }} {{- if $needRemoveInstanceType }} echo "Removing instancetype from VM (switching to custom resources)..." - kubectl patch virtualmachines.kubevirt.io {{ $vmName }} -n {{ $namespace }} \ - --type merge \ - -p '{"spec":{"instancetype":null{{- if not $instanceProfile }},"preference":null{{- end }},"template":{"spec":{"domain":{{ include "virtual-machine.domainResources" . }}}}}}' + kubectl patch virtualmachines.kubevirt.io "$VM_NAME" -n "$NAMESPACE" --type merge -p "$PATCH_REMOVE_INSTANCETYPE" {{- end }} {{- if $needRemoveCustomResources }} echo "Removing custom CPU/memory from domain (switching to instancetype)..." - kubectl patch virtualmachines.kubevirt.io {{ $vmName }} -n {{ $namespace }} \ - --type merge \ - -p '{"spec":{"instancetype":{"name":"{{ $instanceType }}","revisionName":null},"template":{"spec":{"domain":{"cpu":null,"resources":null}}}}}' + kubectl patch virtualmachines.kubevirt.io "$VM_NAME" -n "$NAMESPACE" --type merge -p "$PATCH_REMOVE_RESOURCES" {{- end }} {{- if $needRecreateService }} echo "Removing Service..." - kubectl delete service --cascade=orphan -n {{ $namespace }} {{ $vmName }} + kubectl delete service --cascade=orphan -n "$NAMESPACE" "$VM_NAME" {{- end }} --- apiVersion: v1 @@ -141,7 +158,7 @@ rules: verbs: ["patch", "get", "list", "watch"] - apiGroups: [""] resources: ["services"] - resourceNames: ["{{ $vmName }}"] + resourceNames: [{{ $vmName | quote }}] verbs: ["delete"] --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/packages/apps/vm-instance/templates/vm.yaml b/packages/apps/vm-instance/templates/vm.yaml index d7288a61e..c0617b4b2 100644 --- a/packages/apps/vm-instance/templates/vm.yaml +++ b/packages/apps/vm-instance/templates/vm.yaml @@ -45,19 +45,19 @@ metadata: {{- include "virtual-machine.labels" . | nindent 4 }} spec: {{- if hasKey .Values "runStrategy" }} - runStrategy: {{ .Values.runStrategy }} + runStrategy: {{ .Values.runStrategy | quote }} {{- else }} runStrategy: {{ ternary "Always" "Halted" (.Values.running | default true) }} {{- end }} {{- with $instanceType }} instancetype: kind: VirtualMachineClusterInstancetype - name: {{ . }} + name: {{ . | quote }} {{- end }} {{- with .Values.instanceProfile }} preference: kind: VirtualMachineClusterPreference - name: {{ . }} + name: {{ . | quote }} {{- end }} template: metadata: @@ -113,7 +113,7 @@ spec: gpus: {{- range $i, $gpu := .Values.gpus }} - name: gpu{{ add $i 1 }} - deviceName: {{ $gpu.name }} + deviceName: {{ $gpu.name | quote }} {{- end }} {{- end }} disks: @@ -127,14 +127,14 @@ spec: {{- fail (printf "disks %q and %q both have bootOrder %d; boot orders must be unique" . $disk.name $bootOrder) }} {{- end }} {{- $_ := set $bootOrderOwners (toString $bootOrder) $disk.name }} - - name: disk-{{ $disk.name }} + - name: {{ printf "disk-%s" $disk.name | quote }} {{- $dv := lookup "cdi.kubevirt.io/v1beta1" "DataVolume" $.Release.Namespace (printf "vm-disk-%s" $disk.name) }} {{- if $dv }} {{- $isOptical := and (hasKey $dv.metadata.annotations "vm-disk.cozystack.io/optical") (eq (index $dv.metadata.annotations "vm-disk.cozystack.io/optical") "true") }} {{- $deviceKey := ternary "cdrom" "disk" $isOptical }} {{- if $disk.bus }} {{ $deviceKey }}: - bus: {{ $disk.bus }} + bus: {{ $disk.bus | quote }} {{- else }} {{ $deviceKey }}: {} {{- end }} @@ -152,7 +152,7 @@ spec: bridge: {} {{- if not $cozyplaneSDN }} {{- range $i, $net := $networks }} - - name: {{ $net.name }} + - name: {{ $net.name | quote }} bridge: {} {{- end }} {{- end }} @@ -174,9 +174,9 @@ spec: volumes: {{- range .Values.disks }} - - name: disk-{{ .name }} + - name: {{ printf "disk-%s" .name | quote }} dataVolume: - name: vm-disk-{{ .name }} + name: {{ printf "vm-disk-%s" .name | quote }} {{- end }} {{- if or .Values.cloudInit .Values.sshKeys .Values.netplanDhcp }} - name: cloudinitdisk @@ -195,8 +195,8 @@ spec: pod: {} {{- if not $cozyplaneSDN }} {{- range $i, $net := $networks }} - - name: {{ $net.name }} + - name: {{ $net.name | quote }} multus: - networkName: {{ $.Release.Namespace }}/{{ $net.name }} + networkName: {{ printf "%s/%s" $.Release.Namespace $net.name | quote }} {{- end }} {{- end }} diff --git a/packages/apps/vm-instance/tests/instancetype_resources_test.yaml b/packages/apps/vm-instance/tests/instancetype_resources_test.yaml index 6543a8982..c047b379c 100644 --- a/packages/apps/vm-instance/tests/instancetype_resources_test.yaml +++ b/packages/apps/vm-instance/tests/instancetype_resources_test.yaml @@ -390,13 +390,13 @@ tests: value: Job asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_REMOVE_INSTANCETYPE")].value' pattern: '"instancetype":null' - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_REMOVE_INSTANCETYPE")].value' pattern: '"cores":4' - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_REMOVE_INSTANCETYPE")].value' pattern: '"memory":"8Gi"' # The third branch of the hook's selector, and the upgrade path for any VM @@ -455,10 +455,10 @@ tests: value: Job asserts: - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_REMOVE_RESOURCES")].value' pattern: '"instancetype":\{"name":"u1.medium"' - matchRegex: - path: spec.template.spec.containers[0].args[0] + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_REMOVE_RESOURCES")].value' pattern: '"cpu":null,"resources":null' - it: renames the instance type on a live VM that already carries a different one @@ -486,7 +486,10 @@ tests: pattern: 'Patching VirtualMachine for instancetype update' - matchRegex: path: spec.template.spec.containers[0].args[0] - pattern: '"name": "u1.medium", "revisionName": null' + pattern: '"\$PATCH_INSTANCETYPE"' + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name == "PATCH_INSTANCETYPE")].value' + value: '{"spec":{"instancetype":{"name":"u1.medium","revisionName":null}}}' - it: leaves a live VM alone when its instance type still sizes it templates: diff --git a/packages/apps/vm-instance/tests/portclaim_test.yaml b/packages/apps/vm-instance/tests/portclaim_test.yaml index 425268507..94e882db0 100644 --- a/packages/apps/vm-instance/tests/portclaim_test.yaml +++ b/packages/apps/vm-instance/tests/portclaim_test.yaml @@ -82,7 +82,7 @@ tests: path: spec.template.metadata.annotations["sdn.cozystack.io/port-claim"] template: templates/vm.yaml - - it: keeps a network name with a newline inside the claim's VPC reference + - it: refuses a network name with a newline template: templates/portclaim.yaml capabilities: apiVersions: @@ -91,8 +91,5 @@ tests: networks: - name: "mynet\n---\nkind: ClusterRoleBinding" asserts: - - hasDocuments: - count: 1 - - equal: - path: spec.vpcRef.name - value: "virtualprivatecloud-mynet\n---\nkind: ClusterRoleBinding" + - failedTemplate: + errorPattern: 'networks/0/name' diff --git a/packages/apps/vm-instance/tests/vpc_cozyplane_test.yaml b/packages/apps/vm-instance/tests/vpc_cozyplane_test.yaml index 2622f4f60..e02ff6f9f 100644 --- a/packages/apps/vm-instance/tests/vpc_cozyplane_test.yaml +++ b/packages/apps/vm-instance/tests/vpc_cozyplane_test.yaml @@ -142,9 +142,7 @@ tests: - failedTemplate: errorPattern: 'routeTable.*does not match pattern' - # networks[].name has no pattern (the kube-ovn path shares it), so the - # annotation is quoted: a newline stays inside the value. - - it: keeps a network name with a newline inside the VPC annotation + - it: refuses a network name with a newline capabilities: apiVersions: - sdn.cozystack.io/v1alpha1/VPC @@ -152,8 +150,5 @@ tests: networks: - name: "mynet\n---\nkind: ClusterRoleBinding" asserts: - - hasDocuments: - count: 1 - - equal: - path: spec.template.metadata.annotations["sdn.cozystack.io/vpc"] - value: "virtualprivatecloud-mynet\n---\nkind: ClusterRoleBinding" + - failedTemplate: + errorPattern: 'networks/0/name' diff --git a/packages/apps/vm-instance/values.schema.json b/packages/apps/vm-instance/values.schema.json index 2ab3da028..ef0c9da37 100644 --- a/packages/apps/vm-instance/values.schema.json +++ b/packages/apps/vm-instance/values.schema.json @@ -47,6 +47,8 @@ "description": "Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.", "type": "string", "default": "u1.medium", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-cozystack-options": { "source": "instancetype" } @@ -55,6 +57,8 @@ "description": "Virtual Machine preferences profile.", "type": "string", "default": "ubuntu", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-cozystack-options": { "source": "instanceprofile" } @@ -76,11 +80,15 @@ }, "bus": { "description": "Disk bus type (e.g. \"sata\").", - "type": "string" + "type": "string", + "maxLength": 16, + "pattern": "^[a-z0-9]*$" }, "name": { "description": "Disk name.", "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", "x-cozystack-options": { "source": "vmdisk" } @@ -98,6 +106,8 @@ "name": { "description": "Network attachment name.", "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-cozystack-options": { "source": "network" } @@ -115,6 +125,8 @@ "name": { "description": "Network attachment name.", "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$", "x-cozystack-options": { "source": "network" } @@ -142,6 +154,8 @@ "name": { "description": "The name of the GPU resource to attach.", "type": "string", + "maxLength": 317, + "pattern": "^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$", "x-cozystack-options": { "source": "gpu" } @@ -152,7 +166,9 @@ "cpuModel": { "description": "Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map", "type": "string", - "default": "" + "default": "", + "maxLength": 128, + "pattern": "^([A-Za-z0-9][-A-Za-z0-9_.+]*)?$" }, "firmware": { "description": "Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).", diff --git a/packages/apps/vm-instance/values.yaml b/packages/apps/vm-instance/values.yaml index 043f454c8..4c910c06a 100644 --- a/packages/apps/vm-instance/values.yaml +++ b/packages/apps/vm-instance/values.yaml @@ -8,17 +8,25 @@ ## @typedef {struct} Disk - Disk configuration. ## @field {string} name - Disk name. +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @x-cozystack-options {source: vmdisk} ## @field {string} [bus] - Disk bus type (e.g. "sata"). +## @maxLength 16 +## @pattern ^[a-z0-9]*$ ## @field {*int} [bootOrder] - Boot priority of the disk, 1 being tried first. Unset falls back to the disk's position in `disks` (the first disk gets 1), so set it to boot from a disk other than the first, such as an attached installer or rescue ISO, without reordering the list. Effective boot orders must be unique across disks: when one disk is given a value that another takes from its position, set both. ## @minimum 1 ## @typedef {struct} Network - Network to attach the VM to. ## @field {string} [name] - Network attachment name. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @x-cozystack-options {source: network} ## @typedef {struct} GPU - GPU device configuration. ## @field {string} name - The name of the GPU resource to attach. +## @maxLength 317 +## @pattern ^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$ ## @x-cozystack-options {source: gpu} ## @typedef {struct} Resources - Resource configuration for the virtual machine. @@ -55,10 +63,14 @@ externalAllowICMP: true runStrategy: Always ## @param {string} instanceType - Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @x-cozystack-options {source: instancetype} instanceType: "u1.medium" ## @param {string} instanceProfile - Virtual Machine preferences profile. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @x-cozystack-options {source: instanceprofile} instanceProfile: ubuntu @@ -98,6 +110,8 @@ gpus: [] ## - name: nvidia.com/GA102GL_A10 ## @param {string} cpuModel - Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map +## @maxLength 128 +## @pattern ^([A-Za-z0-9][-A-Za-z0-9_.+]*)?$ cpuModel: "" ## @param {Firmware} [firmware] - Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM). diff --git a/packages/apps/vpc/templates/vpc.yaml b/packages/apps/vpc/templates/vpc.yaml index 049d71987..bcecb3032 100644 --- a/packages/apps/vpc/templates/vpc.yaml +++ b/packages/apps/vpc/templates/vpc.yaml @@ -53,7 +53,7 @@ metadata: name: {{ $subnetId }} namespace: {{ $.Release.Namespace }} labels: - cozystack.io/subnetName: {{ .name }} + cozystack.io/subnetName: {{ .name | quote }} cozystack.io/vpcId: {{ $vpcId }} cozystack.io/vpcName: {{ $.Release.Name }} cozystack.io/tenantName: {{ $.Release.Namespace }} @@ -70,13 +70,13 @@ kind: Subnet metadata: name: {{ $subnetId }} labels: - cozystack.io/subnetName: {{ .name }} + cozystack.io/subnetName: {{ .name | quote }} cozystack.io/vpcId: {{ $vpcId }} cozystack.io/vpcName: {{ $.Release.Name }} cozystack.io/tenantName: {{ $.Release.Namespace }} spec: vpc: {{ $vpcId }} - cidrBlock: {{ .cidr }} + cidrBlock: {{ .cidr | quote }} provider: "{{ $subnetId }}.{{ $.Release.Namespace }}.ovn" protocol: IPv4 enableLb: false @@ -101,14 +101,14 @@ metadata: cozystack.io/tenantName: {{ $.Release.Namespace }} data: {{- range .Values.subnets }} - {{ .name }}.ID: {{ print "subnet-" (print $.Release.Namespace "/" $vpcId "/" .name | sha256sum | trunc 8) }} - {{ .name }}.CIDR: {{ .cidr }} + {{ printf "%s.ID" .name | quote }}: {{ print "subnet-" (print $.Release.Namespace "/" $vpcId "/" .name | sha256sum | trunc 8) }} + {{ printf "%s.CIDR" .name | quote }}: {{ .cidr | quote }} {{- end }} {{- range .Values.peers }} {{- $remoteRelease := printf "virtualprivatecloud-%s" .vpcName }} {{- $remoteVpcId := printf "vpc-%s" (printf "%s/%s" .tenantNamespace $remoteRelease | sha256sum | trunc 6) }} - peer.{{ .tenantNamespace }}.{{ .vpcName }}.vpcId: {{ $remoteVpcId | quote }} - peer.{{ .tenantNamespace }}.{{ .vpcName }}.tenantNamespace: {{ .tenantNamespace | quote }} + {{ printf "peer.%s.%s.vpcId" .tenantNamespace .vpcName | quote }}: {{ $remoteVpcId | quote }} + {{ printf "peer.%s.%s.tenantNamespace" .tenantNamespace .vpcName | quote }}: {{ .tenantNamespace | quote }} {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/packages/apps/vpc/values.schema.json b/packages/apps/vpc/values.schema.json index bff82a8af..1d6d9100a 100644 --- a/packages/apps/vpc/values.schema.json +++ b/packages/apps/vpc/values.schema.json @@ -21,11 +21,14 @@ }, "cidr": { "description": "IP address range", - "type": "string" + "type": "string", + "pattern": "^[0-9A-Fa-f.:/,]*$" }, "name": { "description": "Subnet name", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" } } } @@ -43,11 +46,15 @@ "properties": { "tenantNamespace": { "description": "Namespace of the remote tenant", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, "vpcName": { "description": "Logical name of the remote VPC (without \"virtualprivatecloud-\" prefix)", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" } } } @@ -65,11 +72,13 @@ "properties": { "cidr": { "description": "Destination CIDR", - "type": "string" + "type": "string", + "pattern": "^[0-9A-Fa-f.:/,]*$" }, "nextHopIP": { "description": "Next hop IP address", - "type": "string" + "type": "string", + "pattern": "^[0-9A-Fa-f.:]*$" } } } diff --git a/packages/apps/vpc/values.yaml b/packages/apps/vpc/values.yaml index b3132ec53..0c10e5f83 100644 --- a/packages/apps/vpc/values.yaml +++ b/packages/apps/vpc/values.yaml @@ -4,7 +4,10 @@ ## @typedef {struct} Subnet - Subnet of a VPC ## @field {string} name - Subnet name +## @maxLength 63 +## @pattern ^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$ ## @field {string} [cidr] - IP address range +## @pattern ^[0-9A-Fa-f.:/,]*$ ## @field {[]string} [allowSubnets] - Additional source CIDRs admitted into this private subnet, such as remote networks routed in through a gateway VM ## @param {[]Subnet} subnets - Subnets of a VPC @@ -20,7 +23,11 @@ subnets: [] ## @typedef {struct} Peer - VPC peering target ## @field {string} vpcName - Logical name of the remote VPC (without "virtualprivatecloud-" prefix) +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @field {string} tenantNamespace - Namespace of the remote tenant +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @param {[]Peer} peers - VPC peering connections (bidirectional declaration required) peers: [] @@ -31,7 +38,9 @@ peers: [] ## @typedef {struct} Route - Static route entry ## @field {string} cidr - Destination CIDR +## @pattern ^[0-9A-Fa-f.:/,]*$ ## @field {string} nextHopIP - Next hop IP address +## @pattern ^[0-9A-Fa-f.:]*$ ## @param {[]Route} routes - Static routes for the VPC routes: [] diff --git a/packages/apps/vpn/README.md b/packages/apps/vpn/README.md index 47ee23750..c4f5d8a35 100644 --- a/packages/apps/vpn/README.md +++ b/packages/apps/vpn/README.md @@ -33,7 +33,7 @@ Furthermore, Shadowbox is compatible with standard Shadowsocks clients, providin | Name | Description | Type | Value | | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- | -| `host` | Host used to substitute into generated URLs. | `string` | `""` | +| `host` | Host used to substitute into generated URLs: a DNS name, an IPv4 address or an IPv6 address. | `string` | `""` | | `users` | Users configuration map. | `map[string]object` | `{}` | | `users[name].password` | Password for the user (autogenerated if not provided). | `string` | `""` | | `externalIPs` | List of externalIPs for service. Optional. If not specified, will use LoadBalancer service by default. | `[]string` | `[]` | diff --git a/packages/apps/vpn/templates/secret.yaml b/packages/apps/vpn/templates/secret.yaml index 31a3643ce..cda3b6e86 100644 --- a/packages/apps/vpn/templates/secret.yaml +++ b/packages/apps/vpn/templates/secret.yaml @@ -10,6 +10,9 @@ {{- $_ := set $passwords .name .password }} {{- end }} {{- range $user, $u := .Values.users }} + {{- if not (regexMatch "^[-._a-zA-Z0-9]+$" $user) }} + {{- fail (printf "users: %q is not a valid user name: use letters, digits, '-', '_' and '.'" $user) }} + {{- end }} {{- if $u.password }} {{- $_ := set $passwords $user $u.password }} {{- else if not (index $passwords $user) }} @@ -34,25 +37,7 @@ stringData: "portForNewAccessKeys": 40000, "hostname": "localhost" } - shadowbox_config.json: | - { - "accessKeys": [ - {{- $c := 1 | int }} - {{- range $user, $u := .Values.users }} - {{- if ne $c 1 }},{{ end }} - { - "id": "{{ $c }}", - "metricsId": "{{ $user }}", - "name": "{{ $user }}", - "password": "{{ index $passwords $user }}", - "port": 40000, - "encryptionMethod": "chacha20-ietf-poly1305" - } - {{- $c = add1 $c }} - {{- end }} - ], - "nextId": {{ $c }} - } + shadowbox_config.json: {{ include "vpn.shadowboxConfig" (dict "users" .Values.users "passwords" $passwords) | quote }} --- apiVersion: v1 kind: Secret @@ -60,6 +45,32 @@ metadata: name: {{ .Release.Name }}-urls type: Opaque stringData: - {{- range $user, $u := .Values.users }} - "{{ $user }}": "ss://{{ regexReplaceAll "=" (replace "/" "_" (replace "+" "-" (printf "chacha20-ietf-poly1305:%s" (index $passwords $user) | b64enc))) "" }}@{{ $.Values.host | default (printf "%s.%s" $.Release.Name $host) }}:40000/?outline=1#{{ $.Release.Name }}" + {{- $urlHost := $.Values.host | default (printf "%s.%s" $.Release.Name $host) }} + {{- /* A URL carries an IPv6 address in brackets, so the port that follows + is not read as part of it. */}} + {{- if contains ":" $urlHost }} + {{- $urlHost = printf "[%s]" $urlHost }} {{- end }} + {{- range $user, $u := .Values.users }} + {{ $user | quote }}: {{ printf "ss://%s@%s:40000/?outline=1#%s" (regexReplaceAll "=" (replace "/" "_" (replace "+" "-" (printf "chacha20-ietf-poly1305:%s" (index $passwords $user) | b64enc))) "") $urlHost $.Release.Name | quote }} + {{- end }} +{{- define "vpn.shadowboxConfig" -}} +{ + "accessKeys": [ + {{- $c := 1 | int }} + {{- range $user, $u := .users }} + {{- if ne $c 1 }},{{ end }} + { + "id": "{{ $c }}", + "metricsId": {{ $user | toJson }}, + "name": {{ $user | toJson }}, + "password": {{ index $.passwords $user | toJson }}, + "port": 40000, + "encryptionMethod": "chacha20-ietf-poly1305" + } + {{- $c = add1 $c }} + {{- end }} + ], + "nextId": {{ $c }} +} +{{ end -}} diff --git a/packages/apps/vpn/tests/host_guard_test.yaml b/packages/apps/vpn/tests/host_guard_test.yaml index ef68d209f..9787d51de 100644 --- a/packages/apps/vpn/tests/host_guard_test.yaml +++ b/packages/apps/vpn/tests/host_guard_test.yaml @@ -26,3 +26,46 @@ tests: asserts: - hasDocuments: count: 2 + + # The host goes only into the ss:// URL, which takes any case and an IPv6 + # address in brackets. + - it: writes an uppercase host into the access URL as given + set: + _namespace: + host: example.com + host: VPN.Example.COM + users: + alice: + password: secret + documentSelector: + path: metadata.name + value: vpn-test-urls + asserts: + - matchRegex: + path: stringData.alice + pattern: '^ss://[^@]+@VPN\.Example\.COM:40000/\?outline=1#vpn-test$' + + - it: brackets an IPv6 host in the access URL + set: + _namespace: + host: example.com + host: "2001:db8::1" + users: + alice: + password: secret + documentSelector: + path: metadata.name + value: vpn-test-urls + asserts: + - matchRegex: + path: stringData.alice + pattern: '^ss://[^@]+@\[2001:db8::1\]:40000/\?outline=1#vpn-test$' + + - it: refuses a host that is neither a DNS name nor an address + set: + _namespace: + host: example.com + host: "vpn.example.com/#@other.example" + asserts: + - failedTemplate: + errorPattern: "at '/host'.*does not match pattern" diff --git a/packages/apps/vpn/values.schema.json b/packages/apps/vpn/values.schema.json index 9e8de52aa..2e784124d 100644 --- a/packages/apps/vpn/values.schema.json +++ b/packages/apps/vpn/values.schema.json @@ -100,9 +100,11 @@ "default": false }, "host": { - "description": "Host used to substitute into generated URLs.", + "description": "Host used to substitute into generated URLs: a DNS name, an IPv4 address or an IPv6 address.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^(([A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*)|[0-9A-Fa-f.]*:[0-9A-Fa-f:.]*)?$" }, "users": { "description": "Users configuration map.", diff --git a/packages/apps/vpn/values.yaml b/packages/apps/vpn/values.yaml index c76719d14..60c5531fa 100644 --- a/packages/apps/vpn/values.yaml +++ b/packages/apps/vpn/values.yaml @@ -71,7 +71,9 @@ external: false ## @section Application-specific parameters ## -## @param {string} host - Host used to substitute into generated URLs. +## @param {string} host - Host used to substitute into generated URLs: a DNS name, an IPv4 address or an IPv6 address. +## @maxLength 253 +## @pattern ^(([A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*)|[0-9A-Fa-f.]*:[0-9A-Fa-f:.]*)?$ host: "" ## @typedef {struct} User - User configuration. diff --git a/packages/extra/bootbox/README.md b/packages/extra/bootbox/README.md index dfb2c65f5..8df674292 100644 --- a/packages/extra/bootbox/README.md +++ b/packages/extra/bootbox/README.md @@ -9,7 +9,7 @@ | `whitelistHTTP` | Secure HTTP by enabling client networks whitelisting. | `bool` | `true` | | `whitelist` | List of client networks. | `[]string` | `[]` | | `machines` | Configuration of physical machine instances. | `[]object` | `[]` | -| `machines[i].hostname` | Hostname. | `string` | `""` | +| `machines[i].hostname` | Hostname, a DNS subdomain such as `node1` or `node1.rack2.example.com`. | `string` | `""` | | `machines[i].arch` | Architecture. | `string` | `""` | | `machines[i].ip` | IP address configuration. | `object` | `{}` | | `machines[i].ip.address` | IP address. | `string` | `""` | diff --git a/packages/extra/bootbox/templates/_helpers.tpl b/packages/extra/bootbox/templates/_helpers.tpl new file mode 100644 index 000000000..90d30db7d --- /dev/null +++ b/packages/extra/bootbox/templates/_helpers.tpl @@ -0,0 +1,18 @@ +{{- define "bootbox.host" -}} +{{- $apex := .Values.host | default (include "cozy-lib.ns-host-required" .) -}} +{{- if not (regexMatch "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" (toString $apex)) -}} +{{- fail (printf "host %q must be a DNS name." (toString $apex)) -}} +{{- end -}} +{{- printf "bootbox.%s" $apex -}} +{{- end -}} + +{{- define "bootbox.whitelist" -}} +{{- range . }} +{{- range splitList "," (toString .) }} +{{- if not (regexMatch "^([0-9]{1,3}(\\.[0-9]{1,3}){3}(/[0-9]{1,2})?|[0-9A-Fa-f:]*:[0-9A-Fa-f:.]*(/[0-9]{1,3})?)$" (trim .)) }} +{{- fail (printf "whitelist entry %q is not an IP address or CIDR range." (trim .)) }} +{{- end }} +{{- end }} +{{- end }} +{{- join "," . }} +{{- end }} diff --git a/packages/extra/bootbox/templates/matchbox/ingress.yaml b/packages/extra/bootbox/templates/matchbox/ingress.yaml index 1b5bb3bed..a11a722a0 100644 --- a/packages/extra/bootbox/templates/matchbox/ingress.yaml +++ b/packages/extra/bootbox/templates/matchbox/ingress.yaml @@ -1,7 +1,6 @@ {{- $solver := (index .Values._cluster "solver") | default "http01" }} {{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} {{- $ingress := .Values._namespace.ingress }} -{{- $host := include "cozy-lib.ns-host-required" . }} {{- $wildcardSecret := (index .Values._cluster "wildcard-secret-name") | default "" }} apiVersion: networking.k8s.io/v1 kind: Ingress @@ -19,14 +18,14 @@ metadata: cert-manager.io/cluster-issuer: {{ $clusterIssuer }} {{- end }} {{- if .Values.whitelistHTTP }} - nginx.ingress.kubernetes.io/whitelist-source-range: "{{ join "," (.Values.whitelist | default "0.0.0.0/32") }}" + nginx.ingress.kubernetes.io/whitelist-source-range: {{ include "bootbox.whitelist" .Values.whitelist | default "0.0.0.0/32" | quote }} {{- end }} {{- end }} spec: ingressClassName: {{ $ingress }} tls: - hosts: - - "{{ printf "bootbox.%s" (.Values.host | default $host) }}" + - {{ include "bootbox.host" . | quote }} {{- /* Operator wildcard mode: no per-host secret — ingress-nginx falls back to the default SSL certificate while the tls section keeps the HTTP-to-HTTPS redirect enforced. */}} @@ -34,7 +33,7 @@ spec: secretName: bootbox-tls {{- end }} rules: - - host: "{{ printf "bootbox.%s" (.Values.host | default $host) }}" + - host: {{ include "bootbox.host" . | quote }} http: paths: - path: / diff --git a/packages/extra/bootbox/templates/matchbox/machines.yaml b/packages/extra/bootbox/templates/matchbox/machines.yaml index 02ba9b7e6..dc61fc2ee 100644 --- a/packages/extra/bootbox/templates/matchbox/machines.yaml +++ b/packages/extra/bootbox/templates/matchbox/machines.yaml @@ -1,20 +1,23 @@ -{{- $host := include "cozy-lib.ns-host-required" . }} +{{- $bootHost := include "bootbox.host" . }} {{ range $m := .Values.machines }} --- apiVersion: tinkerbell.org/v1alpha1 kind: Hardware metadata: - name: {{ $m.hostname }} + name: {{ $m.hostname | quote }} namespace: cozy-bootbox spec: interfaces: {{- range $mac := $m.mac }} + {{- if not (regexMatch "^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$" (toString $mac)) }} + {{- fail (printf "machines[%s].mac entry %q is not a MAC address." (toString $m.hostname) (toString $mac)) }} + {{- end }} - dhcp: - hostname: {{ $m.hostname }} - mac: {{ lower $mac }} + hostname: {{ $m.hostname | quote }} + mac: {{ lower $mac | quote }} {{- with $m.arch }} - arch: {{ . }} + arch: {{ . | quote }} {{- end }} {{- with $m.ip }} ip: @@ -37,6 +40,6 @@ spec: netboot: allowPXE: true ipxe: - url: "https://{{ printf "bootbox.%s" ($.Values.host | default $host) }}/boot.ipxe" + url: {{ printf "https://%s/boot.ipxe" $bootHost | quote }} {{- end }} {{- end }} diff --git a/packages/extra/bootbox/tests/machine_hostname_test.yaml b/packages/extra/bootbox/tests/machine_hostname_test.yaml new file mode 100644 index 000000000..7976395e0 --- /dev/null +++ b/packages/extra/bootbox/tests/machine_hostname_test.yaml @@ -0,0 +1,51 @@ +suite: bootbox machine hostnames +templates: + - templates/matchbox/machines.yaml + +release: + name: bootbox + namespace: tenant-root + +set: + _namespace: + host: example.org + ingress: tenant-root + +# The hostname names the Hardware object and its DHCP host, both quoted, so a +# DNS subdomain is what it is held to. +tests: + - it: accepts a hostname that is a DNS subdomain + set: + machines: + - arch: x86_64 + hostname: node1.rack2.example.org + mac: ["00:00:5e:00:53:01"] + uefi: true + leaseTime: 3600 + ip: + address: 192.0.2.10 + gateway: 192.0.2.1 + netmask: 255.255.255.0 + asserts: + - equal: + path: metadata.name + value: node1.rack2.example.org + - equal: + path: spec.interfaces[0].dhcp.hostname + value: node1.rack2.example.org + + - it: refuses a hostname that is not a DNS subdomain + set: + machines: + - arch: x86_64 + hostname: "node1\n---\nkind: Namespace" + mac: ["00:00:5e:00:53:01"] + uefi: true + leaseTime: 3600 + ip: + address: 192.0.2.10 + gateway: 192.0.2.1 + netmask: 255.255.255.0 + asserts: + - failedTemplate: + errorPattern: "at '/machines/0/hostname'.*does not match pattern" diff --git a/packages/extra/bootbox/values.schema.json b/packages/extra/bootbox/values.schema.json index 372bbd294..54f372a4b 100644 --- a/packages/extra/bootbox/values.schema.json +++ b/packages/extra/bootbox/values.schema.json @@ -31,11 +31,14 @@ "properties": { "arch": { "description": "Architecture.", - "type": "string" + "type": "string", + "pattern": "^[A-Za-z0-9_]*$" }, "hostname": { - "description": "Hostname.", - "type": "string" + "description": "Hostname, a DNS subdomain such as `node1` or `node1.rack2.example.com`.", + "type": "string", + "maxLength": 253, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" }, "ip": { "description": "IP address configuration.", diff --git a/packages/extra/bootbox/values.yaml b/packages/extra/bootbox/values.yaml index be29d059f..c9ccb17ef 100644 --- a/packages/extra/bootbox/values.yaml +++ b/packages/extra/bootbox/values.yaml @@ -19,8 +19,11 @@ whitelist: [] ## @field {string} netmask - Netmask. ## @typedef {struct} Machine - Machine configuration. -## @field {string} hostname - Hostname. +## @field {string} hostname - Hostname, a DNS subdomain such as `node1` or `node1.rack2.example.com`. +## @maxLength 253 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ ## @field {string} arch - Architecture. +## @pattern ^[A-Za-z0-9_]*$ ## @field {MachineConfig} ip - IP address configuration. ## @field {int} leaseTime - Lease time. ## @field {[]string} mac - MAC addresses. diff --git a/packages/extra/etcd/values.schema.json b/packages/extra/etcd/values.schema.json index 73cf517b9..157dac80e 100644 --- a/packages/extra/etcd/values.schema.json +++ b/packages/extra/etcd/values.schema.json @@ -5,7 +5,8 @@ "version": { "description": "etcd version (X.Y.Z) to run, set on the EtcdCluster's spec.version; the operator pulls etcd from its own configured image.", "type": "string", - "default": "3.6.11" + "default": "3.6.11", + "pattern": "^([0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?)?$" }, "size": { "description": "Persistent Volume size.", @@ -24,7 +25,9 @@ "storageClass": { "description": "StorageClass used to store the data.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "replicas": { "description": "Number of etcd replicas.", diff --git a/packages/extra/etcd/values.yaml b/packages/extra/etcd/values.yaml index d11601d97..f028f2dea 100644 --- a/packages/extra/etcd/values.yaml +++ b/packages/extra/etcd/values.yaml @@ -3,12 +3,15 @@ ## ## @param {string} [version] - etcd version (X.Y.Z) to run, set on the EtcdCluster's spec.version; the operator pulls etcd from its own configured image. +## @pattern ^([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?)?$ version: "3.6.11" ## @param {quantity} [size] - Persistent Volume size. size: 4Gi ## @param {string} [storageClass] - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ storageClass: "" ## @param {int} [replicas] - Number of etcd replicas. diff --git a/packages/extra/external-dns/README.md b/packages/extra/external-dns/README.md index 0769f83d7..cffc34840 100644 --- a/packages/extra/external-dns/README.md +++ b/packages/extra/external-dns/README.md @@ -4,14 +4,14 @@ ### Common parameters -| Name | Description | Type | Value | -| ------------------ | ---------------------------------------------------------------------------------- | ---------- | ------------- | -| `provider` | DNS provider name. | `string` | `{}` | -| `domainFilters` | List of domains this external-dns instance can manage. | `[]string` | `[]` | -| `policy` | How DNS records are synchronized. | `string` | `upsert-only` | -| `extraArgs` | Extra arguments for external-dns. | `[]string` | `[]` | -| `gatewayAPI` | Enable Gateway API HTTPRoute and TLSRoute as sources for DNS records. | `bool` | `false` | -| `annotationPrefix` | Custom annotation prefix for external-dns (useful for running multiple instances). | `string` | `""` | +| Name | Description | Type | Value | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ------------- | +| `provider` | DNS provider name. | `string` | `{}` | +| `domainFilters` | List of domains this external-dns instance can manage. Each must be a DNS name such as `example.com`, optionally with a leading or trailing dot. | `[]string` | `[]` | +| `policy` | How DNS records are synchronized. | `string` | `upsert-only` | +| `extraArgs` | Extra arguments for external-dns, each passed to it as written. | `[]string` | `[]` | +| `gatewayAPI` | Enable Gateway API HTTPRoute and TLSRoute as sources for DNS records. | `bool` | `false` | +| `annotationPrefix` | Custom annotation prefix for external-dns (useful for running multiple instances): a DNS name followed by `/`, such as `dns.example.com/`. | `string` | `""` | ### Cloudflare diff --git a/packages/extra/external-dns/templates/external-dns.yaml b/packages/extra/external-dns/templates/external-dns.yaml index b863083ca..505cef175 100644 --- a/packages/extra/external-dns/templates/external-dns.yaml +++ b/packages/extra/external-dns/templates/external-dns.yaml @@ -1,6 +1,38 @@ {{- if not .Values.provider }} {{- fail "provider is required: set it to one of cloudflare, aws, azure, google, digitalocean, linode, ovh, exoscale, godaddy, inmemory" }} {{- end }} +{{- /* The upstream chart writes domain filters and the annotation prefix into + its container args unquoted, so both are held to the names they stand + for before they are handed on. */}} +{{- range $i, $domain := .Values.domainFilters }} +{{- if not (regexMatch "^\\.?[A-Za-z0-9_]([-A-Za-z0-9_.]*[A-Za-z0-9])?\\.?$" (toString $domain)) }} +{{- fail (printf "domainFilters[%d] is %q: a domain filter must be a DNS name such as example.com" $i (toString $domain)) }} +{{- end }} +{{- end }} +{{- with .Values.annotationPrefix }} +{{- if not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/$" (toString .)) }} +{{- fail (printf "annotationPrefix %q must be a DNS name followed by \"/\", such as dns.example.com/" (toString .)) }} +{{- end }} +{{- end }} +{{- $godaddy := and (eq .Values.provider "godaddy") (or .Values.godaddy.apiKey .Values.godaddy.apiSecret) }} +{{- if $godaddy }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-godaddy-credentials + labels: + app.kubernetes.io/instance: {{ .Release.Name }}-system + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +stringData: + {{- with .Values.godaddy.apiKey }} + apiKey: {{ . | quote }} + {{- end }} + {{- with .Values.godaddy.apiSecret }} + apiSecret: {{ . | quote }} + {{- end }} +--- +{{- end }} apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: @@ -136,6 +168,27 @@ spec: {{- end }} {{- end }} + {{- /* external-dns reads every flag from EXTERNAL_DNS_ as well, so + the GoDaddy credentials come from a Secret through the environment + rather than sitting in the HelmRelease and the container args. */}} + {{- if $godaddy }} + env: + {{- if .Values.godaddy.apiKey }} + - name: EXTERNAL_DNS_GODADDY_API_KEY + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-godaddy-credentials + key: apiKey + {{- end }} + {{- if .Values.godaddy.apiSecret }} + - name: EXTERNAL_DNS_GODADDY_API_SECRET + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-godaddy-credentials + key: apiSecret + {{- end }} + {{- end }} + {{- if eq .Values.provider "exoscale" }} {{- if or .Values.exoscale.apiKey .Values.exoscale.apiSecret }} env: @@ -146,20 +199,16 @@ spec: {{- end }} {{- end }} - {{- /* extraArgs: merge user-supplied args with provider-specific args (godaddy) */}} - {{- $godaddyArgs := list }} - {{- if eq .Values.provider "godaddy" }} - {{- if .Values.godaddy.apiKey }} - {{- $godaddyArgs = append $godaddyArgs (printf "--godaddy-api-key=%s" .Values.godaddy.apiKey) }} - {{- end }} - {{- if .Values.godaddy.apiSecret }} - {{- $godaddyArgs = append $godaddyArgs (printf "--godaddy-api-secret=%s" .Values.godaddy.apiSecret) }} - {{- end }} - {{- end }} - {{- $allArgs := concat (.Values.extraArgs | default list) $godaddyArgs }} - {{- with $allArgs }} + {{- /* The upstream chart renders each extra arg as `- {{ tpl . $ }}`: an + unquoted YAML scalar that also goes through tpl. Each arg is + therefore handed on already quoted, and every "{{" in it as a + template action that prints "{{", so tpl gives back exactly the + quoted arg and the YAML parser exactly the arg. */}} + {{- with .Values.extraArgs }} extraArgs: - {{- toYaml . | nindent 8 }} + {{- range . }} + - {{ . | toString | quote | replace "{{" "{{\"{{\"}}" | quote }} + {{- end }} {{- end }} {{- with (include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $)) }} diff --git a/packages/extra/external-dns/tests/args_test.yaml b/packages/extra/external-dns/tests/args_test.yaml new file mode 100644 index 000000000..e2faf7408 --- /dev/null +++ b/packages/extra/external-dns/tests/args_test.yaml @@ -0,0 +1,83 @@ +suite: external-dns values handed to the upstream chart +templates: + - templates/external-dns.yaml + +set: + provider: inmemory + +# The upstream chart renders domainFilters, annotationPrefix and extraArgs into +# its container args unquoted, and extraArgs through tpl as well. These cases +# pin what reaches it. +tests: + - it: refuses a domain filter that is not a DNS name + set: + domainFilters: + - "example.com\n- --source=service" + asserts: + - failedTemplate: + errorPattern: 'domainFilters\[0\] is .*: a domain filter must be a DNS name' + + - it: accepts domain filters that are DNS names, with a leading or trailing dot + set: + domainFilters: [example.com, .sub.example.com, example.org.] + asserts: + - equal: + path: spec.values.external-dns.domainFilters + value: [example.com, .sub.example.com, example.org.] + + - it: refuses an annotation prefix that is not a DNS name followed by a slash + set: + annotationPrefix: 'dns.example.com/ #' + asserts: + - failedTemplate: + errorPattern: 'annotationPrefix .* must be a DNS name followed by "/"' + + - it: hands an extra arg on quoted, with every template delimiter escaped + set: + extraArgs: + - '--fqdn-template={{.Name}}.example.com' + - '{{ print "x" }}' + - "--txt-prefix=a: b\n- --source=service" + asserts: + - equal: + path: spec.values.external-dns.extraArgs + value: + - '"--fqdn-template={{"{{"}}.Name}}.example.com"' + - '"{{"{{"}} print \"x\" }}"' + - '"--txt-prefix=a: b\n- --source=service"' + + - it: keeps the GoDaddy credentials in a Secret read through the environment + set: + provider: godaddy + godaddy: + apiKey: 'key{{ print "x" }}' + apiSecret: "secret\n- --source=service" + asserts: + - hasDocuments: + count: 2 + - isKind: + of: Secret + documentIndex: 0 + - equal: + path: stringData + value: + apiKey: 'key{{ print "x" }}' + apiSecret: "secret\n- --source=service" + documentIndex: 0 + - equal: + path: spec.values.external-dns.env + value: + - name: EXTERNAL_DNS_GODADDY_API_KEY + valueFrom: + secretKeyRef: + name: RELEASE-NAME-godaddy-credentials + key: apiKey + - name: EXTERNAL_DNS_GODADDY_API_SECRET + valueFrom: + secretKeyRef: + name: RELEASE-NAME-godaddy-credentials + key: apiSecret + documentIndex: 1 + - notExists: + path: spec.values.external-dns.extraArgs + documentIndex: 1 diff --git a/packages/extra/external-dns/values.schema.json b/packages/extra/external-dns/values.schema.json index 3f30384e5..1c30d79af 100644 --- a/packages/extra/external-dns/values.schema.json +++ b/packages/extra/external-dns/values.schema.json @@ -19,7 +19,7 @@ ] }, "domainFilters": { - "description": "List of domains this external-dns instance can manage.", + "description": "List of domains this external-dns instance can manage. Each must be a DNS name such as `example.com`, optionally with a leading or trailing dot.", "type": "array", "default": [], "items": { @@ -37,7 +37,7 @@ ] }, "extraArgs": { - "description": "Extra arguments for external-dns.", + "description": "Extra arguments for external-dns, each passed to it as written.", "type": "array", "default": [], "items": { @@ -50,7 +50,7 @@ "default": false }, "annotationPrefix": { - "description": "Custom annotation prefix for external-dns (useful for running multiple instances).", + "description": "Custom annotation prefix for external-dns (useful for running multiple instances): a DNS name followed by `/`, such as `dns.example.com/`.", "type": "string", "default": "" }, diff --git a/packages/extra/external-dns/values.yaml b/packages/extra/external-dns/values.yaml index 801580822..4121821a9 100644 --- a/packages/extra/external-dns/values.yaml +++ b/packages/extra/external-dns/values.yaml @@ -17,7 +17,7 @@ ## @param {Provider} provider - DNS provider name. # provider: -## @param {[]string} domainFilters - List of domains this external-dns instance can manage. +## @param {[]string} domainFilters - List of domains this external-dns instance can manage. Each must be a DNS name such as `example.com`, optionally with a leading or trailing dot. domainFilters: [] ## @enum {string} Policy - How DNS records are synchronized. @@ -28,13 +28,13 @@ domainFilters: [] ## @param {Policy} policy="upsert-only" - How DNS records are synchronized. policy: "upsert-only" -## @param {[]string} extraArgs - Extra arguments for external-dns. +## @param {[]string} extraArgs - Extra arguments for external-dns, each passed to it as written. extraArgs: [] ## @param {bool} gatewayAPI=false - Enable Gateway API HTTPRoute and TLSRoute as sources for DNS records. gatewayAPI: false -## @param {string} [annotationPrefix] - Custom annotation prefix for external-dns (useful for running multiple instances). +## @param {string} [annotationPrefix] - Custom annotation prefix for external-dns (useful for running multiple instances): a DNS name followed by `/`, such as `dns.example.com/`. annotationPrefix: "" ## diff --git a/packages/extra/ingress/templates/_whitelist.tpl b/packages/extra/ingress/templates/_whitelist.tpl new file mode 100644 index 000000000..76d54be6d --- /dev/null +++ b/packages/extra/ingress/templates/_whitelist.tpl @@ -0,0 +1,10 @@ +{{- define "ingress.whitelist" -}} +{{- range . }} +{{- range splitList "," (toString .) }} +{{- if not (regexMatch "^([0-9]{1,3}(\\.[0-9]{1,3}){3}(/[0-9]{1,2})?|[0-9A-Fa-f:]*:[0-9A-Fa-f:.]*(/[0-9]{1,3})?)$" (trim .)) }} +{{- fail (printf "whitelist entry %q is not an IP address or CIDR range." (trim .)) }} +{{- end }} +{{- end }} +{{- end }} +{{- join "," . }} +{{- end }} diff --git a/packages/extra/ingress/templates/nginx-ingress.yaml b/packages/extra/ingress/templates/nginx-ingress.yaml index 4354a532e..0e0605ecc 100644 --- a/packages/extra/ingress/templates/nginx-ingress.yaml +++ b/packages/extra/ingress/templates/nginx-ingress.yaml @@ -117,7 +117,7 @@ spec: {{- if or .Values.whitelist .Values.cloudflareProxy $proxyProtocol }} config: {{- with .Values.whitelist }} - whitelist-source-range: "{{ join "," . }}" + whitelist-source-range: {{ include "ingress.whitelist" . | quote }} {{- end }} {{- if .Values.cloudflareProxy }} {{- /* ssl-passthrough forwards HTTPS from loopback with the edge address diff --git a/packages/extra/monitoring/templates/_helpers.tpl b/packages/extra/monitoring/templates/_helpers.tpl index 3cf3eaffe..0182b0d82 100644 --- a/packages/extra/monitoring/templates/_helpers.tpl +++ b/packages/extra/monitoring/templates/_helpers.tpl @@ -15,3 +15,68 @@ {{- end -}} {{- end -}} {{- end -}} + +{{- define "monitoring.childValueShape" -}} +{{- $resources := dict "requests" (dict "cpu" "*" "memory" "*") "limits" (dict "cpu" "*" "memory" "*") -}} +{{- $bounds := dict "minAllowed" (dict "cpu" "*" "memory" "*") "maxAllowed" (dict "cpu" "*" "memory" "*") -}} +{{- dict + "host" "*" + "metricsStorages" (list (dict "name" "*" "retentionPeriod" "*" "deduplicationInterval" "*" "storage" "*" "storageClassName" "*" "vminsert" $bounds "vmselect" $bounds "vmstorage" $bounds)) + "logsStorages" (list (dict "name" "*" "retentionPeriod" "*" "storage" "*" "storageClassName" "*")) + "tracingStorages" (list (dict "name" "*" "mode" "*" "retentionPeriod" "*" "storage" "*" "storageClassName" "*" "retentionDiskUsageBytes" "*")) + "tracingCentralHost" "*" + "tracingCollector" (dict "enabled" "*" "replicas" "*" "samplingPercentage" "*" "redactAttributes" "*" "resources" $resources) + "alerta" (dict "storage" "*" "storageClassName" "*" "resources" $resources "alerts" (dict + "telegram" (dict "token" "*" "chatID" "*" "disabledSeverity" "*") + "slack" (dict "url" "*" "disabledSeverity" "*" "dashboardUrl" "*" "summaryFmt" "*") + "email" (dict "to" "*" "from" "*" "smarthost" "*" "authUsername" "*" "repeatInterval" "*" "alertnames" "*" "severities" "*" "template" "*"))) + "grafana" (dict "db" (dict "size" "*") "resources" $resources) + "vmagent" (dict "externalLabels" "*" "remoteWrite" (dict "urls" "*") "inlineScrapeConfig" "*") + "oidc" (dict "mode" "*" "customConfig" (dict "config" "*" "secretRef" (dict "name" "*")) "users" (list (dict "email" "*" "role" "*"))) + "schedulingClass" "*" + | toJson -}} +{{- end -}} + +{{- define "monitoring.cutToShape" -}} +{{- $value := index . 0 -}} +{{- $shape := index . 1 -}} +{{- if and (kindIs "map" $shape) (kindIs "map" $value) -}} +{{- $out := dict -}} +{{- range $key, $child := $value -}} +{{- if hasKey $shape $key -}} +{{- $_ := set $out $key (include "monitoring.cutToShape" (list $child (get $shape $key)) | fromJson).v -}} +{{- end -}} +{{- end -}} +{{- dict "v" $out | toJson -}} +{{- else if and (kindIs "slice" $shape) (kindIs "slice" $value) -}} +{{- $out := list -}} +{{- range $value -}} +{{- $out = append $out (include "monitoring.cutToShape" (list . (first $shape)) | fromJson).v -}} +{{- end -}} +{{- dict "v" $out | toJson -}} +{{- else -}} +{{- dict "v" $value | toJson -}} +{{- end -}} +{{- end -}} + +{{- define "monitoring.childValues" -}} +{{- $values := (include "monitoring.cutToShape" (list (omit .Values "_cluster" "_namespace") (include "monitoring.childValueShape" . | fromJson)) | fromJson).v -}} +{{- with (dig "vmagent" "inlineScrapeConfig" "" $values) -}} +{{- $scrape := fromYamlArray (toString .) -}} +{{- if and (eq (len $scrape) 1) (kindIs "string" (first $scrape)) (hasPrefix "error" (first $scrape)) -}} +{{- fail (printf "vmagent.inlineScrapeConfig must be a YAML list of scrape configs: %s" (first $scrape)) -}} +{{- end -}} +{{- $_ := set $values.vmagent "inlineScrapeConfig" (toYaml $scrape) -}} +{{- end -}} +{{- range $label, $_ := dig "vmagent" "externalLabels" dict $values -}} +{{- if not (regexMatch "^[A-Za-z_][A-Za-z0-9_]*$" $label) -}} +{{- fail (printf "vmagent.externalLabels key %q must be a label name: letters, digits and '_', not starting with a digit." $label) -}} +{{- end -}} +{{- end -}} +{{- range $key, $_ := dig "oidc" "customConfig" "config" dict $values -}} +{{- if not (regexMatch "^[a-z][a-z0-9_]*$" $key) -}} +{{- fail (printf "oidc.customConfig.config key %q must be a grafana.ini key: lowercase letters, digits and '_', starting with a letter." $key) -}} +{{- end -}} +{{- end -}} +{{- $values | toJson -}} +{{- end -}} diff --git a/packages/extra/monitoring/templates/helmrelease.yaml b/packages/extra/monitoring/templates/helmrelease.yaml index 58cdfd4b5..392db7f18 100644 --- a/packages/extra/monitoring/templates/helmrelease.yaml +++ b/packages/extra/monitoring/templates/helmrelease.yaml @@ -93,12 +93,4 @@ spec: valuesFrom: - kind: Secret name: cozystack-values - {{- /* The apps API does not prune keys the Monitoring schema leaves out, and - a central tenant's collector enforces the platform's rate on it, so its - image stays the platform's. So does Grafana's: its pod may reach a - central tenant's vmauth and mounts the Secret the tenant names in - oidc.customConfig.secretRef. */}} - {{- $values := deepCopy .Values }} - {{- $_ := unset $values.tracingCollector "image" }} - {{- $_ := unset $values.grafana "image" }} - values: {{- $values | toYaml | nindent 4 }} + values: {{- include "cozy-lib.yaml.toYaml" (list (include "monitoring.childValues" . | fromJson) "values") | nindent 4 }} diff --git a/packages/extra/monitoring/tests/helmrelease_test.yaml b/packages/extra/monitoring/tests/helmrelease_test.yaml index fc98baf11..25772d219 100644 --- a/packages/extra/monitoring/tests/helmrelease_test.yaml +++ b/packages/extra/monitoring/tests/helmrelease_test.yaml @@ -159,3 +159,61 @@ tests: - equal: path: spec.values.grafana.resources.requests.cpu value: 100m + + # Both maps reach the inner chart key by key: a label key becomes a vmagent + # label name and an OIDC key a grafana.ini key, so a key that is neither + # would reach those configs unchecked. + - it: refuses an external label key that is not a label name + set: + vmagent: + externalLabels: + $tplYaml: '{{ print "x" }}' + asserts: + - failedTemplate: + errorPattern: 'vmagent.externalLabels key "\$tplYaml" must be a label name' + + - it: refuses an OIDC config key that is not a grafana.ini key + set: + oidc: + mode: CustomConfig + customConfig: + config: + "client_id\n[server]\nroot_url": x + asserts: + - failedTemplate: + errorPattern: 'oidc.customConfig.config key ".*" must be a grafana.ini key' + + - it: passes label and OIDC config keys of the right shape through + set: + vmagent: + externalLabels: + cluster: tenant-a + _region: eu + oidc: + mode: CustomConfig + customConfig: + config: + client_id: grafana + role_attribute_path: role + asserts: + - equal: + path: spec.values.vmagent.externalLabels + value: + cluster: tenant-a + _region: eu + - equal: + path: spec.values.oidc.customConfig.config + value: + client_id: grafana + role_attribute_path: role + + # A label value may be any UTF-8; the inner chart quotes it. + - it: passes a cluster label of any characters through + set: + vmagent: + externalLabels: + cluster: "prod: eu/west #1" + asserts: + - equal: + path: spec.values.vmagent.externalLabels.cluster + value: "prod: eu/west #1" diff --git a/packages/extra/monitoring/values.schema.json b/packages/extra/monitoring/values.schema.json index 55a06e6da..1daa0ff90 100644 --- a/packages/extra/monitoring/values.schema.json +++ b/packages/extra/monitoring/values.schema.json @@ -5,7 +5,9 @@ "host": { "description": "The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host).", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "metricsStorages": { "description": "Configuration of metrics storage instances.", @@ -41,7 +43,9 @@ }, "name": { "description": "Name of the storage instance.", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, "retentionPeriod": { "description": "Retention period for metrics.", @@ -50,11 +54,14 @@ "storage": { "description": "Persistent volume size.", "type": "string", - "default": "10Gi" + "default": "10Gi", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "storageClassName": { "description": "StorageClass used for the data.", - "type": "string" + "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "vminsert": { "description": "Configuration for vminsert.", @@ -303,7 +310,9 @@ "properties": { "name": { "description": "Name of the storage instance.", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, "retentionPeriod": { "description": "Retention period for logs.", @@ -313,12 +322,15 @@ "storage": { "description": "Persistent volume size.", "type": "string", - "default": "10Gi" + "default": "10Gi", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "storageClassName": { "description": "StorageClass used to store the data.", "type": "string", - "default": "replicated" + "default": "replicated", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } @@ -348,7 +360,9 @@ }, "name": { "description": "Name of the storage instance: a lowercase RFC 1123 label of at most 42 characters. Treat as immutable once a backend exists: the VTCluster/VTSingle, its Services, PVCs and Grafana datasource are all named after it, so renaming an entry deploys a new, empty backend and removes the old one, the same way changing mode does (single mode loses the old PVC, cluster mode leaves the old vtstorage PVCs Bound until the whole Monitoring release is deleted).", - "type": "string" + "type": "string", + "maxLength": 42, + "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, "retentionDiskUsageBytes": { "description": "Optional disk-usage cap as a VictoriaMetrics BytesString (e.g. \"8GB\" or \"8GiB\"), bounding disk use on top of the age-based retentionPeriod. Uses byte-suffix grammar (kb/mb/gb/tb, KiB/MiB/GiB/TiB), NOT the Kubernetes-quantity grammar of the sibling storage field, so \"8Gi\" is rejected by the operator. In cluster mode the cap is per vtstorage replica (replicaCount 2), so the effective total is twice the value. Unset, the store drops its oldest day once its filesystem is 80% full instead, so every store is disk-bounded. Either way VictoriaTraces keeps the last two days, so spans arriving faster than the cap allows for two days can still fill the disk.", @@ -376,7 +390,9 @@ "storageClassName": { "description": "StorageClass used to store the data.", "type": "string", - "default": "replicated" + "default": "replicated", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } @@ -588,7 +604,8 @@ "url": { "description": "Configuration uri for Slack alerts.", "type": "string", - "default": "" + "default": "", + "pattern": "^(https?://[^\\s\"\\\\]*)?$" } } }, @@ -604,7 +621,8 @@ "chatID": { "description": "Telegram chat ID(s), separated by commas.", "type": "string", - "default": "" + "default": "", + "pattern": "^[-@A-Za-z0-9_, ]*$" }, "disabledSeverity": { "description": "List of severities without alerts (e.g. [\"informational\",\"warning\"]).", @@ -617,7 +635,8 @@ "token": { "description": "Telegram bot token.", "type": "string", - "default": "" + "default": "", + "pattern": "^([0-9]+:[A-Za-z0-9_-]+)?$" } } } @@ -703,12 +722,15 @@ "storage": { "description": "Persistent volume size for the database.", "type": "string", - "default": "10Gi" + "default": "10Gi", + "pattern": "^((\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?)?$" }, "storageClassName": { "description": "StorageClass used for the database.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } }, @@ -725,7 +747,8 @@ "size": { "description": "Persistent volume size for the database.", "type": "string", - "default": "10Gi" + "default": "10Gi", + "pattern": "^((\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?)?$" } } }, @@ -858,7 +881,9 @@ "name": { "description": "Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } diff --git a/packages/extra/monitoring/values.yaml b/packages/extra/monitoring/values.yaml index ff14d504d..f25b820bd 100644 --- a/packages/extra/monitoring/values.yaml +++ b/packages/extra/monitoring/values.yaml @@ -2,6 +2,8 @@ ## ## @param {string} host - The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ host: "" ## @@ -26,10 +28,15 @@ host: "" ## @typedef {struct} MetricsStorage - Configuration of metrics storage instance. ## @field {string} name - Name of the storage instance. +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @field {string} retentionPeriod - Retention period for metrics. ## @field {string} deduplicationInterval - Deduplication interval for metrics. ## @field {string} storage="10Gi" - Persistent volume size. +## @pattern ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ ## @field {string} [storageClassName] - StorageClass used for the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {VMComponent} [vminsert] - Configuration for vminsert. ## @field {VMComponent} [vmselect] - Configuration for vmselect. ## @field {VMComponent} [vmstorage] - Configuration for vmstorage. @@ -81,9 +88,14 @@ metricsStorages: ## @typedef {struct} LogsStorage - Configuration of logs storage instance. ## @field {string} name - Name of the storage instance. +## @maxLength 63 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @field {string} retentionPeriod="1" - Retention period for logs. ## @field {string} storage="10Gi" - Persistent volume size. +## @pattern ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ ## @field {string} storageClassName="replicated" - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @param {[]LogsStorage} logsStorages - Configuration of logs storage instances. logsStorages: @@ -102,10 +114,14 @@ logsStorages: ## @typedef {struct} TracingStorage - Configuration of traces storage instance. ## @field {string} name - Name of the storage instance: a lowercase RFC 1123 label of at most 42 characters. Treat as immutable once a backend exists: the VTCluster/VTSingle, its Services, PVCs and Grafana datasource are all named after it, so renaming an entry deploys a new, empty backend and removes the old one, the same way changing mode does (single mode loses the old PVC, cluster mode leaves the old vtstorage PVCs Bound until the whole Monitoring release is deleted). +## @maxLength 42 +## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ## @field {TracingMode} mode="cluster" - Deployment mode: "cluster" renders a VTCluster; "single" renders a single-binary VTSingle for edge/dev/small clusters. Treat as immutable once a backend exists: mode selects which Kind is rendered under the same name, so changing it on a running backend re-identifies the object rather than reconfiguring it. Switching from "single" to "cluster" prunes the VTSingle and the operator garbage-collects its PVC (stored traces are lost); switching from "cluster" to "single" (or removing the entry) leaves the vtstorage PVCs Bound and billed until the whole Monitoring release is deleted. The API cannot guard this (transition rules are not available on an array-item field), so this note is the only guard: migrate deliberately, accepting the loss. ## @field {string} retentionPeriod="14d" - Retention period for traces. ## @field {quantity} storage="10Gi" - Persistent volume size. ## @field {string} storageClassName="replicated" - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [retentionDiskUsageBytes] - Optional disk-usage cap as a VictoriaMetrics BytesString (e.g. "8GB" or "8GiB"), bounding disk use on top of the age-based retentionPeriod. Uses byte-suffix grammar (kb/mb/gb/tb, KiB/MiB/GiB/TiB), NOT the Kubernetes-quantity grammar of the sibling storage field, so "8Gi" is rejected by the operator. In cluster mode the cap is per vtstorage replica (replicaCount 2), so the effective total is twice the value. Unset, the store drops its oldest day once its filesystem is 80% full instead, so every store is disk-bounded. Either way VictoriaTraces keeps the last two days, so spans arriving faster than the cap allows for two days can still fill the disk. ## @param {[]TracingStorage} tracingStorages - Configuration of traces storage instances. Empty by default (tracing off): no backend and no trace collector are rendered. Adding an entry provisions a VictoriaTraces backend and, while tracingCollector.enabled is true, deploys the OTLP collector in front of it. A tenant with shared-central tracing (the Tenant's tracingCentral) gets the collector, while tracingCollector.enabled is true, without an entry, which then exports to the shared store; entries still listed keep their store and datasource, so traces stored before the switch stay readable until the entry is removed. @@ -148,11 +164,14 @@ tracingCollector: ## @typedef {struct} TelegramAlerts - Telegram alert configuration. ## @field {string} token - Telegram bot token. +## @pattern ^([0-9]+:[A-Za-z0-9_-]+)?$ ## @field {string} chatID - Telegram chat ID(s), separated by commas. +## @pattern ^[-@A-Za-z0-9_, ]*$ ## @field {[]string} [disabledSeverity] - List of severities without alerts (e.g. ["informational","warning"]). ## @typedef {struct} SlackAlerts - Slack alert configuration. ## @field {string} url - Configuration uri for Slack alerts. +## @pattern ^(https?://[^\s"\\]*)?$ ## @field {[]string} [disabledSeverity] - List of severities without alerts (e.g. ["informational","warning"]). ## @typedef {struct} EmailAlerts - Email alert configuration. When enabled, alerts carrying the label `notify_email="true"` with a severity from `severities` (default `critical` and `major`) are sent by email in addition to Alerta, and alerts listed in `alertnames` are emailed regardless of labels unless matched by an earlier platform route. The label is matched as a string, so a rule must carry `notify_email: "true"` rather than a bare YAML boolean. @@ -172,7 +191,10 @@ tracingCollector: ## @typedef {struct} Alerta - Configuration for the Alerta service. ## @field {string} [storage] - Persistent volume size for the database. +## @pattern ^((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)?$ ## @field {string} [storageClassName] - StorageClass used for the database. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {Resources} [resources] - Resource configuration. ## @field {Alerts} [alerts] - Alert routing configuration. @@ -210,6 +232,7 @@ alerta: ## @typedef {struct} GrafanaDB - Grafana database configuration. ## @field {string} [size] - Persistent volume size for the database. +## @pattern ^((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)?$ ## @typedef {struct} Grafana - Grafana service configuration. ## @field {GrafanaDB} [db] - Database configuration. @@ -264,6 +287,8 @@ vmagent: ## @typedef {struct} OIDCSecretRef - Reference to a Secret carrying an `[auth.generic_oauth]` ini fragment. ## @field {string} [name] - Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @typedef {struct} OIDCCustomConfigInline - Inline map of grafana.ini `[auth.generic_oauth]` keys. ## @field {string} [] - Value for the generic_oauth key (e.g. `client_id`, `client_secret`, `auth_url`, `token_url`, `api_url`, `scopes`, `role_attribute_path`). diff --git a/packages/extra/seaweedfs/templates/_whitelist.tpl b/packages/extra/seaweedfs/templates/_whitelist.tpl new file mode 100644 index 000000000..07022a1ce --- /dev/null +++ b/packages/extra/seaweedfs/templates/_whitelist.tpl @@ -0,0 +1,10 @@ +{{- define "seaweedfs.whitelist" -}} +{{- range . }} +{{- range splitList "," (toString .) }} +{{- if not (regexMatch "^([0-9]{1,3}(\\.[0-9]{1,3}){3}(/[0-9]{1,2})?|[0-9A-Fa-f:]*:[0-9A-Fa-f:.]*(/[0-9]{1,3})?)$" (trim .)) }} +{{- fail (printf "filer.whitelist entry %q is not an IP address or CIDR range." (trim .)) }} +{{- end }} +{{- end }} +{{- end }} +{{- join "," . }} +{{- end }} diff --git a/packages/extra/seaweedfs/templates/client/cosi-deployment.yaml b/packages/extra/seaweedfs/templates/client/cosi-deployment.yaml index 619462dac..6dc6af3ea 100644 --- a/packages/extra/seaweedfs/templates/client/cosi-deployment.yaml +++ b/packages/extra/seaweedfs/templates/client/cosi-deployment.yaml @@ -39,9 +39,9 @@ spec: - name: DRIVERNAME value: {{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io - name: ENDPOINT - value: https://{{ .Values.host | default (printf "s3.%s" $host) }} + value: {{ printf "https://%s" (.Values.host | default (printf "s3.%s" $host)) | quote }} - name: SEAWEEDFS_FILER - value: "{{ .Values.filer.grpcHost }}:{{ .Values.filer.grpcPort }}" + value: {{ printf "%s:%v" .Values.filer.grpcHost .Values.filer.grpcPort | quote }} - name: WEED_GRPC_CLIENT_KEY value: /usr/local/share/ca-certificates/client/tls.key - name: WEED_GRPC_CLIENT_CERT diff --git a/packages/extra/seaweedfs/templates/ingress.yaml b/packages/extra/seaweedfs/templates/ingress.yaml index cf4e837e5..855907ec2 100644 --- a/packages/extra/seaweedfs/templates/ingress.yaml +++ b/packages/extra/seaweedfs/templates/ingress.yaml @@ -8,12 +8,12 @@ metadata: annotations: nginx.ingress.kubernetes.io/backend-protocol: GRPCS nginx.ingress.kubernetes.io/ssl-passthrough: "true" - nginx.ingress.kubernetes.io/whitelist-source-range: "{{ join "," (.Values.filer.whitelist | default "0.0.0.0/32") }}" + nginx.ingress.kubernetes.io/whitelist-source-range: {{ include "seaweedfs.whitelist" .Values.filer.whitelist | default "0.0.0.0/32" | quote }} name: seaweedfs-filer-external spec: ingressClassName: tenant-root rules: - - host: {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) }} + - host: {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) | quote }} http: paths: - backend: diff --git a/packages/extra/seaweedfs/templates/seaweedfs.yaml b/packages/extra/seaweedfs/templates/seaweedfs.yaml index c76b959ff..dbef07465 100644 --- a/packages/extra/seaweedfs/templates/seaweedfs.yaml +++ b/packages/extra/seaweedfs/templates/seaweedfs.yaml @@ -43,6 +43,37 @@ {{- end }} {{- $_ := set $allPools $poolName $pool.diskType }} {{- end }} +{{- $zoneNodeSelectors := dict }} +{{- range $zoneName, $zone := ternary .Values.volume.zones dict (eq .Values.topology "MultiZone") }} +{{- if not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $zoneName) }} +{{- fail (printf "volume.zones key %q must be a valid DNS label (lowercase alphanumeric and hyphens, no dots)." $zoneName) }} +{{- end }} +{{- with $zone.dataCenter }} +{{- if not (regexMatch "^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" .) }} +{{- fail (printf "volume.zones.%s.dataCenter %q must be letters, digits, '-', '_' or '.', starting and ending with a letter or digit." $zoneName .) }} +{{- end }} +{{- end }} +{{- $selector := dict "topology.kubernetes.io/zone" $zoneName }} +{{- with $zone.nodeSelector }} +{{- $selector = fromYaml . }} +{{- /* fromYaml reports a parse error as the one key "Error", holding a + message that starts with "error ". A selector on a label named Error + never looks like that, as a label value holds no space. The test is + cozy-lib.yaml.fromYaml's, inline to keep this field's message. */}} +{{- if and (eq (len $selector) 1) (hasPrefix "error " (toString (get $selector "Error"))) }} +{{- fail (printf "volume.zones.%s.nodeSelector must be a YAML map of node labels: %s" $zoneName (get $selector "Error")) }} +{{- end }} +{{- range $key, $value := $selector }} +{{- if not (regexMatch "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" $key) }} +{{- fail (printf "volume.zones.%s.nodeSelector key %q is not a valid label key." $zoneName $key) }} +{{- end }} +{{- if not (and (kindIs "string" $value) (regexMatch "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" $value) (le (len $value) 63)) }} +{{- fail (printf "volume.zones.%s.nodeSelector value of %q must be a label value string." $zoneName $key) }} +{{- end }} +{{- end }} +{{- end }} +{{- $_ := set $zoneNodeSelectors $zoneName (printf "%s\n" (toYaml $selector)) }} +{{- end }} {{- if eq .Values.topology "MultiZone" }} {{- range $zoneName, $zone := .Values.volume.zones }} {{- range $poolName, $pool := (dig "pools" dict $zone) }} @@ -305,7 +336,7 @@ spec: volumes: {{- if eq .Values.topology "Simple" }} {{- range $poolName, $pool := .Values.volume.pools }} - {{ $poolName }}: + {{ $poolName | quote }}: replicas: {{ ternary $pool.replicas $.Values.volume.replicas (hasKey $pool "replicas") }} {{- $poolResources := include "cozy-lib.resources.defaultingSanitize" (list ($pool.resourcesPreset | default $.Values.volume.resourcesPreset) (default dict $pool.resources) $) | fromYaml }} resources: {{- toYaml $poolResources | nindent 12 }} @@ -327,7 +358,7 @@ spec: {{- end }} {{- else if eq .Values.topology "MultiZone" }} {{- range $zoneName, $zone := .Values.volume.zones }} - {{ $zoneName }}: + {{ $zoneName | quote }}: replicas: {{ ternary $zone.replicas $.Values.volume.replicas (hasKey $zone "replicas") }} resources: {{- toYaml $volumeResources | nindent 12 }} extraEnvironmentVars: @@ -340,13 +371,8 @@ spec: storageClass: {{ . | quote }} {{- end }} maxVolumes: 0 - nodeSelector: | - {{- with $zone.nodeSelector }} -{{ . | indent 12 }} - {{- else }} - topology.kubernetes.io/zone: {{ $zoneName }} - {{- end }} - dataCenter: {{ $zone.dataCenter | default $zoneName }} + nodeSelector: {{ get $zoneNodeSelectors $zoneName | quote }} + dataCenter: {{ $zone.dataCenter | default $zoneName | quote }} {{- if $.Values.volume.diskType }} extraArgs: - "-disk={{ $.Values.volume.diskType }}" @@ -354,7 +380,7 @@ spec: {{- end }} {{- range $zoneName, $zone := .Values.volume.zones }} {{- range $poolName, $pool := (dig "pools" dict $zone) }} - {{ $zoneName }}-{{ $poolName }}: + {{ printf "%s-%s" $zoneName $poolName | quote }}: replicas: {{ ternary $pool.replicas (ternary $zone.replicas $.Values.volume.replicas (hasKey $zone "replicas")) (hasKey $pool "replicas") }} {{- $poolResources := include "cozy-lib.resources.defaultingSanitize" (list ($pool.resourcesPreset | default $.Values.volume.resourcesPreset) (default dict $pool.resources) $) | fromYaml }} resources: {{- toYaml $poolResources | nindent 12 }} @@ -371,13 +397,8 @@ spec: storageClass: {{ . | quote }} {{- end }} maxVolumes: 0 - nodeSelector: | - {{- with $zone.nodeSelector }} -{{ . | indent 12 }} - {{- else }} - topology.kubernetes.io/zone: {{ $zoneName }} - {{- end }} - dataCenter: {{ $zone.dataCenter | default $zoneName }} + nodeSelector: {{ get $zoneNodeSelectors $zoneName | quote }} + dataCenter: {{ $zone.dataCenter | default $zoneName | quote }} extraArgs: - "-disk={{ $pool.diskType }}" {{- end }} @@ -392,7 +413,7 @@ spec: {{- end }} replicas: {{ .Values.filer.replicas }} s3: - domainName: {{ .Values.host | default (printf "s3.%s" $host) }} + domainName: {{ .Values.host | default (printf "s3.%s" $host) | quote }} {{- $filerResources := include "cozy-lib.resources.defaultingSanitize" (list .Values.filer.resourcesPreset .Values.filer.resources $) | fromYaml }} resources: {{- toYaml $filerResources | nindent 10 }} extraEnvironmentVars: @@ -402,7 +423,7 @@ spec: ingress: enabled: {{ not (empty $ingress) }} className: {{ $ingress }} - host: {{ .Values.host | default (printf "s3.%s" $host) }} + host: {{ .Values.host | default (printf "s3.%s" $host) | quote }} annotations: # Limit single PUT request to 5GB to enforce multipart uploads for large files. # This prevents issues with large file uploads and reduces support load. @@ -425,7 +446,7 @@ spec: {{- end }} tls: - hosts: - - {{ .Values.host | default (printf "s3.%s" $host) }} + - {{ .Values.host | default (printf "s3.%s" $host) | quote }} {{- /* Operator wildcard mode: no per-host secret — ingress-nginx falls back to the default SSL certificate while the tls section keeps the HTTP-to-HTTPS redirect enforced. */}} diff --git a/packages/extra/seaweedfs/tests/db_storage_class_test.yaml b/packages/extra/seaweedfs/tests/db_storage_class_test.yaml index da4f6cd2d..de7e4fb9d 100644 --- a/packages/extra/seaweedfs/tests/db_storage_class_test.yaml +++ b/packages/extra/seaweedfs/tests/db_storage_class_test.yaml @@ -20,11 +20,10 @@ tests: path: spec.values.db.storageClass value: "123" - - it: keeps a storage class with a line break inside its own field + - it: refuses a storage class with a line break set: db: storageClass: "local\n replicas: 9" asserts: - - equal: - path: spec.values.db.storageClass - value: "local\n replicas: 9" + - failedTemplate: + errorPattern: "storageClass.*does not match pattern" diff --git a/packages/extra/seaweedfs/tests/volume_storage_class_test.yaml b/packages/extra/seaweedfs/tests/volume_storage_class_test.yaml index 2474f3358..8a8a5d5d9 100644 --- a/packages/extra/seaweedfs/tests/volume_storage_class_test.yaml +++ b/packages/extra/seaweedfs/tests/volume_storage_class_test.yaml @@ -29,26 +29,16 @@ tests: path: spec.values.seaweedfs.volume.dataDirs[0].storageClass value: "123" - # The value is written into the values of another release; a line break in - # it must not open new keys there. - - it: keeps a storage class with a line break inside its own field + - it: refuses a storage class with a line break set: <<: *platform volume: storageClass: "local\n image: example/other" - documentSelector: - path: metadata.name - value: seaweedfs-system asserts: - - equal: - path: spec.values.seaweedfs.volume.dataDirs[0].storageClass - value: "local\n image: example/other" - - notExists: - path: spec.values.seaweedfs.volume.dataDirs[0].image + - failedTemplate: + errorPattern: "storageClass.*does not match pattern" - # A pool or zone class is quoted by hand around the value, which a quote - # character inside it closes early, breaking the release values. - - it: keeps a pool storage class with a quote inside its own field + - it: refuses a pool storage class with a quote set: <<: *platform volume: @@ -56,15 +46,11 @@ tests: fast: diskType: ssd storageClass: 'local"x' - documentSelector: - path: metadata.name - value: seaweedfs-system asserts: - - equal: - path: spec.values.seaweedfs.volumes.fast.dataDirs[0].storageClass - value: 'local"x' + - failedTemplate: + errorPattern: "storageClass.*does not match pattern" - - it: keeps a zone storage class with a quote inside its own field + - it: refuses a zone storage class with a quote set: <<: *platform topology: MultiZone @@ -73,15 +59,11 @@ tests: zones: a: storageClass: 'local"x' - documentSelector: - path: metadata.name - value: seaweedfs-system asserts: - - equal: - path: spec.values.seaweedfs.volumes.a.dataDirs[0].storageClass - value: 'local"x' + - failedTemplate: + errorPattern: "storageClass.*does not match pattern" - - it: keeps a zone pool storage class with a quote inside its own field + - it: refuses a zone pool storage class with a quote set: <<: *platform topology: MultiZone @@ -93,10 +75,6 @@ tests: fast: diskType: ssd storageClass: 'local"x' - documentSelector: - path: metadata.name - value: seaweedfs-system asserts: - - equal: - path: spec.values.seaweedfs.volumes.a-fast.dataDirs[0].storageClass - value: 'local"x' + - failedTemplate: + errorPattern: "storageClass.*does not match pattern" diff --git a/packages/extra/seaweedfs/tests/zone_node_selector_test.yaml b/packages/extra/seaweedfs/tests/zone_node_selector_test.yaml new file mode 100644 index 000000000..073b33f90 --- /dev/null +++ b/packages/extra/seaweedfs/tests/zone_node_selector_test.yaml @@ -0,0 +1,53 @@ +suite: seaweedfs zone nodeSelector reaches the data plane as a YAML map + +templates: + - templates/seaweedfs.yaml + +release: + name: seaweedfs + namespace: tenant-root + +set: &platform + topology: MultiZone + _namespace: + host: example.org + ingress: tenant-root + _cluster: + issuer-name: letsencrypt-prod + solver: http01 + +tests: + # fromYaml reports a parse error as a map with the single key "Error", so a + # label of that name must not read as one. + - it: hands on a nodeSelector on a label named Error + set: + <<: *platform + volume: + zones: + z1: + nodeSelector: "Error: value" + z2: {} + z3: {} + documentSelector: + path: metadata.name + value: seaweedfs-system + asserts: + - equal: + path: spec.values.seaweedfs.volumes.z1.nodeSelector + value: "Error: value\n" + - equal: + path: spec.values.seaweedfs.volumes.z2.nodeSelector + value: "topology.kubernetes.io/zone: z2\n" + + - it: refuses a nodeSelector that is not valid YAML + set: + <<: *platform + volume: + zones: + z1: + nodeSelector: "a: [1, b" + z2: {} + z3: {} + asserts: + - failedTemplate: + errorPattern: 'volume.zones.z1.nodeSelector must be a YAML map of node labels: error converting YAML to JSON' diff --git a/packages/extra/seaweedfs/values.schema.json b/packages/extra/seaweedfs/values.schema.json index 2c282e7c8..5085d3364 100644 --- a/packages/extra/seaweedfs/values.schema.json +++ b/packages/extra/seaweedfs/values.schema.json @@ -5,7 +5,9 @@ "host": { "description": "The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "topology": { "description": "The topology of the SeaweedFS cluster.", @@ -136,7 +138,9 @@ "storageClass": { "description": "StorageClass used to store the data.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } }, @@ -263,7 +267,9 @@ "grpcHost": { "description": "The hostname used to expose or access the filer service externally.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "grpcPort": { "description": "The port used to access the filer service externally.", @@ -500,7 +506,9 @@ }, "storageClass": { "description": "Kubernetes StorageClass for the pool. Defaults to volume.storageClass.", - "type": "string" + "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } @@ -614,7 +622,9 @@ "storageClass": { "description": "StorageClass used to store the data.", "type": "string", - "default": "" + "default": "", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" }, "zones": { "description": "A map of zones for MultiZone topology. Each zone can have its own number of replicas and size.", @@ -625,7 +635,9 @@ "properties": { "dataCenter": { "description": "SeaweedFS data center name for this zone. Defaults to the zone name.", - "type": "string" + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$" }, "nodeSelector": { "description": "YAML nodeSelector for this zone (default: topology.kubernetes.io/zone: \u003czoneName\u003e).", @@ -748,7 +760,9 @@ }, "storageClass": { "description": "Kubernetes StorageClass for the pool. Defaults to volume.storageClass.", - "type": "string" + "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } @@ -772,7 +786,9 @@ }, "storageClass": { "description": "StorageClass used to store zone data. Defaults to volume.storageClass.", - "type": "string" + "type": "string", + "maxLength": 253, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" } } } diff --git a/packages/extra/seaweedfs/values.yaml b/packages/extra/seaweedfs/values.yaml index c484146fb..dfd090c14 100644 --- a/packages/extra/seaweedfs/values.yaml +++ b/packages/extra/seaweedfs/values.yaml @@ -3,6 +3,8 @@ ## ## @param {string} [host] - The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host). +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ host: "" ## @enum {string} Topology - The topology of the SeaweedFS cluster. @@ -77,6 +79,8 @@ replicationFactor: 2 ## @field {int} [replicas] - Number of database replicas. ## @field {quantity} [size] - Persistent Volume size. ## @field {string} [storageClass] - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. ## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted. @@ -132,6 +136,8 @@ master: ## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. ## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted. ## @field {string} [grpcHost] - The hostname used to expose or access the filer service externally. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {int} [grpcPort] - The port used to access the filer service externally. ## @field {[]string} [whitelist] - A list of IP addresses or CIDR ranges that are allowed to access the filer service. @@ -149,6 +155,8 @@ filer: ## @field {int} [replicas] - Number of volume replicas. Defaults to volume.replicas (Simple) or zone.replicas/volume.replicas (MultiZone). ## @field {quantity} [size] - Persistent Volume size. Defaults to volume.size (Simple) or zone.size/volume.size (MultiZone). ## @field {string} [storageClass] - Kubernetes StorageClass for the pool. Defaults to volume.storageClass. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. ## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted. Defaults to volume.resourcesPreset. @@ -156,8 +164,12 @@ filer: ## @field {int} [replicas] - Number of replicas in the zone. ## @field {quantity} [size] - Zone storage size. ## @field {string} [dataCenter] - SeaweedFS data center name for this zone. Defaults to the zone name. +## @maxLength 63 +## @pattern ^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$ ## @field {string} [nodeSelector] - YAML nodeSelector for this zone (default: topology.kubernetes.io/zone: ). ## @field {string} [storageClass] - StorageClass used to store zone data. Defaults to volume.storageClass. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {map[string]StoragePool} [pools] - A map of storage pools for this zone. Each pool creates a separate Volume StatefulSet per zone. ## NOTE: Zone-level resources/resourcesPreset are inherited from volume.* settings. Pools within a zone can define their own resources. @@ -165,6 +177,8 @@ filer: ## @field {int} [replicas] - Number of volume replicas. ## @field {quantity} [size] - Persistent Volume size. ## @field {string} [storageClass] - StorageClass used to store the data. +## @maxLength 253 +## @pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$ ## @field {string} [diskType] - SeaweedFS disk type tag for the default volume servers (e.g., "hdd", "ssd"). ## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. ## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted. diff --git a/packages/library/cozy-lib/templates/_affinity.tpl b/packages/library/cozy-lib/templates/_affinity.tpl new file mode 100644 index 000000000..26d3c7a72 --- /dev/null +++ b/packages/library/cozy-lib/templates/_affinity.tpl @@ -0,0 +1,24 @@ +{{- /* + An affinity, checked and written as YAML. The charts hand the affinity to + an operator's custom resource as it is written, so only the three fields of + a Kubernetes Affinity are accepted. + + Takes a 2-element list: the affinity, and the name of the field it came + from, for the error message. + + {{ include "cozy-lib.affinity.toYaml" (list .Values.affinity "affinity") }} +*/}} +{{- define "cozy-lib.affinity.toYaml" -}} +{{- include "cozy-lib.checkInput" . -}} +{{- $affinity := index . 0 -}} +{{- $field := index . 1 -}} +{{- if not (kindIs "map" $affinity) -}} +{{- fail (printf "%s must be an object holding nodeAffinity, podAffinity or podAntiAffinity" $field) -}} +{{- end -}} +{{- range $key, $_ := $affinity -}} +{{- if not (has $key (list "nodeAffinity" "podAffinity" "podAntiAffinity")) -}} +{{- fail (printf "%s.%s is not a field of an affinity: use nodeAffinity, podAffinity or podAntiAffinity" $field $key) -}} +{{- end -}} +{{- end -}} +{{- include "cozy-lib.yaml.toYaml" (list $affinity $field) -}} +{{- end -}} diff --git a/packages/library/cozy-lib/templates/_etcd.tpl b/packages/library/cozy-lib/templates/_etcd.tpl index 45c1b44d1..2a2e00435 100644 --- a/packages/library/cozy-lib/templates/_etcd.tpl +++ b/packages/library/cozy-lib/templates/_etcd.tpl @@ -42,11 +42,11 @@ metadata: name: {{ $name }} spec: version: {{ $values.version | quote }} - replicas: {{ $values.replicas }} + replicas: {{ int $values.replicas }} storage: - size: {{ $values.size }} + size: {{ $values.size | quote }} {{- with $values.storageClass }} - storageClassName: {{ . }} + storageClassName: {{ . | quote }} {{- end }} options: # quotaBackendBytes/snapshotCount are typed integers in v1alpha2 (no quotes). @@ -113,7 +113,7 @@ spec: {{- end }} {{- with $values.affinity }} affinity: - {{- toYaml . | nindent 4 }} + {{- include "cozy-lib.affinity.toYaml" (list . "affinity") | nindent 4 }} {{- else }} # Soft anti-affinity, a preference on top of the spread constraint above, # which by default is the hard rule that keeps two members off one node @@ -333,7 +333,7 @@ metadata: name: {{ $name }} namespace: {{ $root.Release.Namespace }} spec: - replicas: {{ .values.replicas }} + replicas: {{ int .values.replicas }} minReplicas: {{ div .values.replicas 2 | add1 }} kind: etcd type: etcd diff --git a/packages/library/cozy-lib/templates/_resources.tpl b/packages/library/cozy-lib/templates/_resources.tpl index dfab53399..7d6c1d573 100644 --- a/packages/library/cozy-lib/templates/_resources.tpl +++ b/packages/library/cozy-lib/templates/_resources.tpl @@ -170,7 +170,7 @@ {{- $_ := set $output.limits $k $v }} {{- end }} {{- end }} -{{- $output | toYaml }} +{{- include "cozy-lib.yaml.toYaml" (list $output "resources") }} {{- end }} {{- /* @@ -251,7 +251,7 @@ {{- define "cozy-lib.resources.flatten" -}} {{- $out := dict -}} -{{- $res := include "cozy-lib.resources.requestsAndLimits" . | fromYaml -}} +{{- $res := include "cozy-lib.yaml.fromYaml" (list (include "cozy-lib.resources.requestsAndLimits" .) "resources") | fromJson -}} {{- range $section, $values := $res }} {{- range $k, $v := $values }} {{- with include "cozy-lib.resources.flattenResource" (list $section $k) }} @@ -259,7 +259,7 @@ {{- end }} {{- end }} {{- end }} -{{- $out | toYaml }} +{{- include "cozy-lib.yaml.toYaml" (list $out "resources") }} {{- end }} {{/* diff --git a/packages/library/cozy-lib/templates/_yaml.tpl b/packages/library/cozy-lib/templates/_yaml.tpl new file mode 100644 index 000000000..ba0e221fe --- /dev/null +++ b/packages/library/cozy-lib/templates/_yaml.tpl @@ -0,0 +1,70 @@ +{{- /* + toYaml that fails instead of rendering nothing. Helm's toYaml returns an + empty string when it cannot marshal a value, as for a DEL or C1 control + character anywhere in it or U+0085 in a map key, and the object it was + rendering would come out empty. A value that does marshal never comes out + empty ("null", "{}", '""'). + + Takes a 2-element list: the value, and the name of the field it came from, + for the error message. + + {{ include "cozy-lib.yaml.toYaml" (list .Values.affinity "affinity") }} +*/}} +{{- define "cozy-lib.yaml.toYaml" -}} +{{- include "cozy-lib.checkInput" . -}} +{{- $out := toYaml (index . 0) -}} +{{- if eq $out "" -}} +{{- fail (printf "%s cannot be written as YAML: remove control characters from it, and U+0085 from its keys" (index . 1)) -}} +{{- end -}} +{{- $out -}} +{{- end -}} + +{{- /* + fromYaml that fails on a parse error. Helm's fromYaml returns a map holding + only the key "Error" instead, and a caller that reads the keys it expects + finds none of them and goes on as if the input were empty. A map key "<<" + is one way to get there: YAML reads it as a merge key, and a merge of a + scalar is a parse error. + + Takes a 2-element list: the YAML text, and the name of the field it came + from, for the error message. Returns the map as JSON, for the caller to read + back with fromJson, which does not fail on it. + + {{ include "cozy-lib.yaml.fromYaml" (list $text "resourceQuotas") | fromJson }} +*/}} +{{- define "cozy-lib.yaml.fromYaml" -}} +{{- include "cozy-lib.checkInput" . -}} +{{- $out := fromYaml (index . 0) -}} +{{- if and (eq (len $out) 1) (hasPrefix "error " (toString (get $out "Error"))) -}} +{{- fail (printf "%s cannot be read back from YAML: %s" (index . 1) (get $out "Error")) -}} +{{- end -}} +{{- toJson $out -}} +{{- end -}} + +{{- /* + Fails on any map key, at any depth, that begins with "$tplYaml". Charts that + follow the NATS chart's convention render the value under such a key with + tpl, so a map handed on to another chart as its values must not carry one. + + Takes a 2-element list: the name of the field, for the error message, and + its value. + + {{ include "cozy-lib.yaml.assertNoTemplateKeys" (list "addons.cilium.valuesOverride" .Values.addons.cilium.valuesOverride) }} +*/}} +{{- define "cozy-lib.yaml.assertNoTemplateKeys" -}} +{{- include "cozy-lib.checkInput" . -}} +{{- $path := index . 0 -}} +{{- $value := index . 1 -}} +{{- if kindIs "map" $value -}} +{{- range $key, $child := $value -}} +{{- if hasPrefix "$tplYaml" $key -}} +{{- fail (printf "%s: key %q is not allowed, as charts that follow the NATS chart's convention run its value as a template" $path $key) -}} +{{- end -}} +{{- include "cozy-lib.yaml.assertNoTemplateKeys" (list (printf "%s.%s" $path $key) $child) -}} +{{- end -}} +{{- else if kindIs "slice" $value -}} +{{- range $i, $child := $value -}} +{{- include "cozy-lib.yaml.assertNoTemplateKeys" (list (printf "%s[%d]" $path $i) $child) -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/packages/system/bootbox-rd/cozyrds/bootbox.yaml b/packages/system/bootbox-rd/cozyrds/bootbox.yaml index c9319d746..4ef324a44 100644 --- a/packages/system/bootbox-rd/cozyrds/bootbox.yaml +++ b/packages/system/bootbox-rd/cozyrds/bootbox.yaml @@ -8,7 +8,7 @@ spec: plural: bootboxes singular: bootbox openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"whitelistHTTP":{"description":"Secure HTTP by enabling client networks whitelisting.","type":"boolean","default":true},"whitelist":{"description":"List of client networks.","type":"array","default":[],"items":{"type":"string"}},"machines":{"description":"Configuration of physical machine instances.","type":"array","default":[],"items":{"type":"object","required":["arch","hostname","ip","leaseTime","uefi"],"properties":{"arch":{"description":"Architecture.","type":"string"},"hostname":{"description":"Hostname.","type":"string"},"ip":{"description":"IP address configuration.","type":"object","required":["address","gateway","netmask"],"properties":{"address":{"description":"IP address.","type":"string"},"gateway":{"description":"IP gateway.","type":"string"},"netmask":{"description":"Netmask.","type":"string"}}},"leaseTime":{"description":"Lease time.","type":"integer"},"mac":{"description":"MAC addresses.","type":"array","items":{"type":"string"}},"nameServers":{"description":"Name servers.","type":"array","items":{"type":"string"}},"timeServers":{"description":"Time servers.","type":"array","items":{"type":"string"}},"uefi":{"description":"UEFI.","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":{"whitelistHTTP":{"description":"Secure HTTP by enabling client networks whitelisting.","type":"boolean","default":true},"whitelist":{"description":"List of client networks.","type":"array","default":[],"items":{"type":"string"}},"machines":{"description":"Configuration of physical machine instances.","type":"array","default":[],"items":{"type":"object","required":["arch","hostname","ip","leaseTime","uefi"],"properties":{"arch":{"description":"Architecture.","type":"string","pattern":"^[A-Za-z0-9_]*$"},"hostname":{"description":"Hostname, a DNS subdomain such as `node1` or `node1.rack2.example.com`.","type":"string","maxLength":253,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"},"ip":{"description":"IP address configuration.","type":"object","required":["address","gateway","netmask"],"properties":{"address":{"description":"IP address.","type":"string"},"gateway":{"description":"IP gateway.","type":"string"},"netmask":{"description":"Netmask.","type":"string"}}},"leaseTime":{"description":"Lease time.","type":"integer"},"mac":{"description":"MAC addresses.","type":"array","items":{"type":"string"}},"nameServers":{"description":"Name servers.","type":"array","items":{"type":"string"}},"timeServers":{"description":"Time servers.","type":"array","items":{"type":"string"}},"uefi":{"description":"UEFI.","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: "" labels: diff --git a/packages/system/bucket-rd/cozyrds/bucket.yaml b/packages/system/bucket-rd/cozyrds/bucket.yaml index 720456ef9..5cf66bf47 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":{"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}}} + {"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":"","maxLength":63,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$","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/clickhouse-rd/cozyrds/clickhouse.yaml b/packages/system/clickhouse-rd/cozyrds/clickhouse.yaml index ed13761c4..f36390935 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. 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}}} + {"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","pattern":"^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$"},"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":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"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","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"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","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"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":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"bucketKey":{"description":"Key in the Secret holding the bucket name. Defaults to `bucketName`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"endpointKey":{"description":"Key in the Secret holding the S3 endpoint URL. Defaults to `endpoint`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"regionKey":{"description":"Key in the Secret holding the S3 region. Defaults to `region`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"secretAccessKeyKey":{"description":"Key in the Secret holding the secret access key. Defaults to `secretKey`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"}}},"s3PathOverride":{"description":"DEPRECATED. Object-key prefix inside the legacy `s3Bucket`; the new platform flow scopes by namespace automatically.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"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","pattern":"^[A-Za-z0-9_.-]*$"},"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":"","pattern":"^[-0-9A-Za-z*/,@? ]*$"},"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: diff --git a/packages/system/etcd-rd/cozyrds/etcd.yaml b/packages/system/etcd-rd/cozyrds/etcd.yaml index c53046c32..7eaf93433 100644 --- a/packages/system/etcd-rd/cozyrds/etcd.yaml +++ b/packages/system/etcd-rd/cozyrds/etcd.yaml @@ -8,7 +8,7 @@ spec: plural: etcds singular: etcd openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"version":{"description":"etcd version (X.Y.Z) to run, set on the EtcdCluster's spec.version; the operator pulls etcd from its own configured image.","type":"string","default":"3.6.11"},"size":{"description":"Persistent Volume size.","default":"4Gi","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":""},"replicas":{"description":"Number of etcd replicas.","type":"integer","default":3},"resources":{"description":"Resource configuration for etcd.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","default":"1000m","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":"Amount of memory allocated.","default":"512Mi","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}}},"affinity":{"description":"Affinity rules set verbatim on the EtcdCluster's spec.affinity, replacing the chart default. When left empty the chart applies a soft (preferred) podAntiAffinity by kubernetes.io/hostname on top of the topologySpreadConstraints, which by default require an even spread of members over nodes (whenUnsatisfiable DoNotSchedule, maxSkew 1) unless the platform sets scheduling.globalAppTopologySpreadConstraints. The anti-affinity stays soft because a required rule forbids two members on one node even when every node already has one, so an etcd with more members than schedulable nodes could not start all of them. Set a requiredDuringSchedulingIgnoredDuringExecution rule here only on clusters with at least as many schedulable nodes as members. With node-local storage a recreated member Pod can only return to its own node, so a required rule keeps it Pending while that node holds another member, and the default spread does the same once some other node holds none. The operator copies affinity into each EtcdMember when it creates the member and builds every Pod of that member from that copy, so a change does not reschedule running members and takes effect only as members are replaced by new ones.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":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":{"version":{"description":"etcd version (X.Y.Z) to run, set on the EtcdCluster's spec.version; the operator pulls etcd from its own configured image.","type":"string","default":"3.6.11","pattern":"^([0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?)?$"},"size":{"description":"Persistent Volume size.","default":"4Gi","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"replicas":{"description":"Number of etcd replicas.","type":"integer","default":3},"resources":{"description":"Resource configuration for etcd.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","default":"1000m","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":"Amount of memory allocated.","default":"512Mi","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}}},"affinity":{"description":"Affinity rules set verbatim on the EtcdCluster's spec.affinity, replacing the chart default. When left empty the chart applies a soft (preferred) podAntiAffinity by kubernetes.io/hostname on top of the topologySpreadConstraints, which by default require an even spread of members over nodes (whenUnsatisfiable DoNotSchedule, maxSkew 1) unless the platform sets scheduling.globalAppTopologySpreadConstraints. The anti-affinity stays soft because a required rule forbids two members on one node even when every node already has one, so an etcd with more members than schedulable nodes could not start all of them. Set a requiredDuringSchedulingIgnoredDuringExecution rule here only on clusters with at least as many schedulable nodes as members. With node-local storage a recreated member Pod can only return to its own node, so a required rule keeps it Pending while that node holds another member, and the default spread does the same once some other node holds none. The operator copies affinity into each EtcdMember when it creates the member and builds every Pod of that member from that copy, so a change does not reschedule running members and takes effect only as members are replaced by new ones.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":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: "" labels: diff --git a/packages/system/external-dns-rd/cozyrds/external-dns.yaml b/packages/system/external-dns-rd/cozyrds/external-dns.yaml index 6b49bfedd..bd8b4f6f4 100644 --- a/packages/system/external-dns-rd/cozyrds/external-dns.yaml +++ b/packages/system/external-dns-rd/cozyrds/external-dns.yaml @@ -8,7 +8,7 @@ spec: plural: externaldns singular: externaldns openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"provider":{"description":"DNS provider name.","type":"string","enum":["cloudflare","aws","azure","google","digitalocean","linode","ovh","exoscale","godaddy","inmemory"]},"domainFilters":{"description":"List of domains this external-dns instance can manage.","type":"array","default":[],"items":{"type":"string"}},"policy":{"description":"How DNS records are synchronized.","type":"string","default":"upsert-only","enum":["create-only","sync","upsert-only"]},"extraArgs":{"description":"Extra arguments for external-dns.","type":"array","default":[],"items":{"type":"string"}},"gatewayAPI":{"description":"Enable Gateway API HTTPRoute and TLSRoute as sources for DNS records.","type":"boolean","default":false},"annotationPrefix":{"description":"Custom annotation prefix for external-dns (useful for running multiple instances).","type":"string","default":""},"cloudflare":{"description":"Cloudflare provider credentials.","type":"object","default":{"apiEmail":"","apiKey":"","apiToken":"","proxied":false},"x-kubernetes-preserve-unknown-fields":true},"aws":{"description":"AWS Route53 provider credentials.","type":"object","default":{"accessKeyId":"","region":"","secretAccessKey":"","zoneType":""},"x-kubernetes-preserve-unknown-fields":true},"azure":{"description":"Azure DNS provider credentials.","type":"object","default":{"aadClientId":"","aadClientSecret":"","resourceGroup":"","subscriptionId":"","tenantId":""},"x-kubernetes-preserve-unknown-fields":true},"google":{"description":"Google Cloud DNS provider credentials.","type":"object","default":{"project":"","serviceAccountKey":""},"x-kubernetes-preserve-unknown-fields":true},"digitalocean":{"description":"DigitalOcean DNS provider credentials.","type":"object","default":{"token":""},"x-kubernetes-preserve-unknown-fields":true},"linode":{"description":"Linode DNS provider credentials.","type":"object","default":{"token":""},"x-kubernetes-preserve-unknown-fields":true},"ovh":{"description":"OVH DNS provider credentials.","type":"object","default":{"applicationKey":"","applicationSecret":"","consumerKey":"","endpoint":""},"x-kubernetes-preserve-unknown-fields":true},"exoscale":{"description":"Exoscale DNS provider credentials.","type":"object","default":{"apiKey":"","apiSecret":""},"x-kubernetes-preserve-unknown-fields":true},"godaddy":{"description":"GoDaddy DNS provider credentials.","type":"object","default":{"apiKey":"","apiSecret":""},"x-kubernetes-preserve-unknown-fields":true},"resources":{"description":"Explicit CPU and memory configuration. 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.nano","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"]},"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":{"provider":{"description":"DNS provider name.","type":"string","enum":["cloudflare","aws","azure","google","digitalocean","linode","ovh","exoscale","godaddy","inmemory"]},"domainFilters":{"description":"List of domains this external-dns instance can manage. Each must be a DNS name such as `example.com`, optionally with a leading or trailing dot.","type":"array","default":[],"items":{"type":"string"}},"policy":{"description":"How DNS records are synchronized.","type":"string","default":"upsert-only","enum":["create-only","sync","upsert-only"]},"extraArgs":{"description":"Extra arguments for external-dns, each passed to it as written.","type":"array","default":[],"items":{"type":"string"}},"gatewayAPI":{"description":"Enable Gateway API HTTPRoute and TLSRoute as sources for DNS records.","type":"boolean","default":false},"annotationPrefix":{"description":"Custom annotation prefix for external-dns (useful for running multiple instances): a DNS name followed by `/`, such as `dns.example.com/`.","type":"string","default":""},"cloudflare":{"description":"Cloudflare provider credentials.","type":"object","default":{"apiEmail":"","apiKey":"","apiToken":"","proxied":false},"x-kubernetes-preserve-unknown-fields":true},"aws":{"description":"AWS Route53 provider credentials.","type":"object","default":{"accessKeyId":"","region":"","secretAccessKey":"","zoneType":""},"x-kubernetes-preserve-unknown-fields":true},"azure":{"description":"Azure DNS provider credentials.","type":"object","default":{"aadClientId":"","aadClientSecret":"","resourceGroup":"","subscriptionId":"","tenantId":""},"x-kubernetes-preserve-unknown-fields":true},"google":{"description":"Google Cloud DNS provider credentials.","type":"object","default":{"project":"","serviceAccountKey":""},"x-kubernetes-preserve-unknown-fields":true},"digitalocean":{"description":"DigitalOcean DNS provider credentials.","type":"object","default":{"token":""},"x-kubernetes-preserve-unknown-fields":true},"linode":{"description":"Linode DNS provider credentials.","type":"object","default":{"token":""},"x-kubernetes-preserve-unknown-fields":true},"ovh":{"description":"OVH DNS provider credentials.","type":"object","default":{"applicationKey":"","applicationSecret":"","consumerKey":"","endpoint":""},"x-kubernetes-preserve-unknown-fields":true},"exoscale":{"description":"Exoscale DNS provider credentials.","type":"object","default":{"apiKey":"","apiSecret":""},"x-kubernetes-preserve-unknown-fields":true},"godaddy":{"description":"GoDaddy DNS provider credentials.","type":"object","default":{"apiKey":"","apiSecret":""},"x-kubernetes-preserve-unknown-fields":true},"resources":{"description":"Explicit CPU and memory configuration. 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.nano","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"]},"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: "" chartRef: diff --git a/packages/system/foundationdb-rd/cozyrds/foundationdb.yaml b/packages/system/foundationdb-rd/cozyrds/foundationdb.yaml index 7581be05f..18404153d 100644 --- a/packages/system/foundationdb-rd/cozyrds/foundationdb.yaml +++ b/packages/system/foundationdb-rd/cozyrds/foundationdb.yaml @@ -8,7 +8,7 @@ spec: singular: foundationdb plural: foundationdbs openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"version":{"description":"FoundationDB major.minor version to deploy","type":"string","default":"v7.3","enum":["v7.4","v7.3"]},"cluster":{"description":"Cluster configuration.","type":"object","default":{},"required":["faultDomain","processCounts","redundancyMode","storageEngine"],"properties":{"faultDomain":{"description":"Fault domain configuration.","type":"object","default":{},"required":["key","valueFrom"],"properties":{"key":{"description":"Fault domain key.","type":"string","default":"kubernetes.io/hostname"},"valueFrom":{"description":"Fault domain value source.","type":"string","default":"spec.nodeName"}}},"processCounts":{"description":"Process counts for different roles.","type":"object","default":{},"required":["cluster_controller","stateless","storage"],"properties":{"cluster_controller":{"description":"Number of cluster controller processes.","type":"integer","default":1},"stateless":{"description":"Number of stateless processes (-1 for automatic).","type":"integer","default":-1},"storage":{"description":"Number of storage processes (determines cluster size).","type":"integer","default":3}}},"redundancyMode":{"description":"Database redundancy mode (single, double, triple, three_datacenter, three_datacenter_fallback).","type":"string","default":"double"},"storageEngine":{"description":"Storage engine (ssd-2, ssd-redwood-v1, ssd-rocksdb-v1, memory).","type":"string","default":"ssd-2"}}},"storage":{"description":"Storage configuration.","type":"object","default":{},"required":["size","storageClass"],"properties":{"size":{"description":"Size of persistent volumes for each instance.","default":"16Gi","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":"Storage class (if not set, uses cluster default).","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}}}},"resources":{"description":"Explicit CPU and memory configuration for each FoundationDB instance. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each instance.","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 instance.","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":"c1.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"]},"backup":{"description":"DEPRECATED Backup configuration (use the Cozystack backups framework: BackupClass + FoundationDB strategy).","type":"object","default":{},"required":["enabled","retentionPolicy","s3"],"properties":{"enabled":{"description":"DEPRECATED Enable in-chart backups (superseded by BackupClass + FoundationDB strategy).","type":"boolean","default":false},"retentionPolicy":{"description":"DEPRECATED Retention policy for backups.","type":"string","default":"7d"},"s3":{"description":"DEPRECATED S3 configuration for backups.","type":"object","default":{},"required":["bucket","credentials","endpoint","region"],"properties":{"bucket":{"description":"DEPRECATED S3 bucket name.","type":"string","default":""},"credentials":{"description":"DEPRECATED S3 credentials.","type":"object","default":{},"required":["accessKeyId","secretAccessKey"],"properties":{"accessKeyId":{"description":"DEPRECATED S3 access key ID.","type":"string","default":""},"secretAccessKey":{"description":"DEPRECATED S3 secret access key.","type":"string","default":""}}},"endpoint":{"description":"DEPRECATED S3 endpoint URL.","type":"string","default":""},"region":{"description":"DEPRECATED S3 region.","type":"string","default":"us-east-1"}}}}},"monitoring":{"description":"Monitoring configuration.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable WorkloadMonitor integration.","type":"boolean","default":true}}},"customParameters":{"description":"Custom parameters to pass to FoundationDB.","type":"array","default":[],"items":{"type":"string"}},"imageType":{"description":"Container image deployment type.","type":"string","default":"split","enum":["unified","split"]},"securityContext":{"description":"Security context for containers.","type":"object","default":{},"required":["runAsGroup","runAsUser"],"properties":{"runAsGroup":{"description":"Group ID to run the container.","type":"integer","default":4059},"runAsUser":{"description":"User ID to run the container.","type":"integer","default":4059}}},"automaticReplacements":{"description":"Enable automatic pod replacements.","type":"boolean","default":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":{"version":{"description":"FoundationDB major.minor version to deploy","type":"string","default":"v7.3","enum":["v7.4","v7.3"]},"cluster":{"description":"Cluster configuration.","type":"object","default":{},"required":["faultDomain","processCounts","redundancyMode","storageEngine"],"properties":{"faultDomain":{"description":"Fault domain configuration.","type":"object","default":{},"required":["key","valueFrom"],"properties":{"key":{"description":"Fault domain key.","type":"string","default":"kubernetes.io/hostname","maxLength":317,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$"},"valueFrom":{"description":"Fault domain value source.","type":"string","default":"spec.nodeName","maxLength":317,"pattern":"^[A-Za-z0-9_.$'\\[\\]/-]*$"}}},"processCounts":{"description":"Process counts for different roles.","type":"object","default":{},"required":["cluster_controller","stateless","storage"],"properties":{"cluster_controller":{"description":"Number of cluster controller processes.","type":"integer","default":1},"stateless":{"description":"Number of stateless processes (-1 for automatic).","type":"integer","default":-1},"storage":{"description":"Number of storage processes (determines cluster size).","type":"integer","default":3}}},"redundancyMode":{"description":"Database redundancy mode (single, double, triple, three_datacenter, three_datacenter_fallback).","type":"string","default":"double"},"storageEngine":{"description":"Storage engine (ssd-2, ssd-redwood-v1, ssd-rocksdb-v1, memory).","type":"string","default":"ssd-2"}}},"storage":{"description":"Storage configuration.","type":"object","default":{},"required":["size","storageClass"],"properties":{"size":{"description":"Size of persistent volumes for each instance.","default":"16Gi","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":"Storage class (if not set, uses cluster default).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}}}},"resources":{"description":"Explicit CPU and memory configuration for each FoundationDB instance. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each instance.","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 instance.","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":"c1.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"]},"backup":{"description":"DEPRECATED Backup configuration (use the Cozystack backups framework: BackupClass + FoundationDB strategy).","type":"object","default":{},"required":["enabled","retentionPolicy","s3"],"properties":{"enabled":{"description":"DEPRECATED Enable in-chart backups (superseded by BackupClass + FoundationDB strategy).","type":"boolean","default":false},"retentionPolicy":{"description":"DEPRECATED Retention policy for backups.","type":"string","default":"7d"},"s3":{"description":"DEPRECATED S3 configuration for backups.","type":"object","default":{},"required":["bucket","credentials","endpoint","region"],"properties":{"bucket":{"description":"DEPRECATED S3 bucket name.","type":"string","default":"","maxLength":63,"pattern":"^([a-z0-9][a-z0-9.-]*[a-z0-9])?$"},"credentials":{"description":"DEPRECATED S3 credentials.","type":"object","default":{},"required":["accessKeyId","secretAccessKey"],"properties":{"accessKeyId":{"description":"DEPRECATED S3 access key ID.","type":"string","default":""},"secretAccessKey":{"description":"DEPRECATED S3 secret access key.","type":"string","default":""}}},"endpoint":{"description":"DEPRECATED S3 endpoint URL.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"region":{"description":"DEPRECATED S3 region.","type":"string","default":"us-east-1"}}}}},"monitoring":{"description":"Monitoring configuration.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable WorkloadMonitor integration.","type":"boolean","default":true}}},"customParameters":{"description":"Custom parameters to pass to FoundationDB.","type":"array","default":[],"items":{"type":"string"}},"imageType":{"description":"Container image deployment type.","type":"string","default":"split","enum":["unified","split"]},"securityContext":{"description":"Security context for containers.","type":"object","default":{},"required":["runAsGroup","runAsUser"],"properties":{"runAsGroup":{"description":"Group ID to run the container.","type":"integer","default":4059},"runAsUser":{"description":"User ID to run the container.","type":"integer","default":4059}}},"automaticReplacements":{"description":"Enable automatic pod replacements.","type":"boolean","default":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: foundationdb- labels: diff --git a/packages/system/harbor-rd/cozyrds/harbor.yaml b/packages/system/harbor-rd/cozyrds/harbor.yaml index 002d35a77..d5ab1eb02 100644 --- a/packages/system/harbor-rd/cozyrds/harbor.yaml +++ b/packages/system/harbor-rd/cozyrds/harbor.yaml @@ -8,7 +8,7 @@ spec: singular: harbor plural: harbors openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"host":{"description":"Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host).","type":"string","default":""},"managementWhitelist":{"description":"IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API.","type":"array","default":[],"items":{"type":"string"}},"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"}},"nginx":{"description":"Entry-point proxy configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"portal":{"description":"Web portal configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"core":{"description":"Core API server configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"registry":{"description":"Container image registry configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"jobservice":{"description":"Background job service configuration.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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.nano","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"]}}},"trivy":{"description":"Trivy vulnerability scanner configuration.","type":"object","default":{},"required":["enabled","size"],"properties":{"enabled":{"description":"Enable or disable the vulnerability scanner.","type":"boolean","default":true},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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.nano","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 size for vulnerability database cache.","default":"5Gi","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}}},"database":{"description":"PostgreSQL database configuration.","type":"object","default":{},"required":["replicas","size"],"properties":{"replicas":{"description":"Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset.","type":"integer","default":2},"size":{"description":"Persistent Volume size for database storage.","default":"5Gi","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}}},"redis":{"description":"Redis cache configuration.","type":"object","default":{},"required":["replicas","size"],"properties":{"replicas":{"description":"Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are.","type":"integer","default":2},"size":{"description":"Persistent Volume size for cache storage.","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":{"host":{"description":"Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"managementWhitelist":{"description":"IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API.","type":"array","default":[],"items":{"type":"string"}},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"nginx":{"description":"Entry-point proxy configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"portal":{"description":"Web portal configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"core":{"description":"Core API server configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"registry":{"description":"Container image registry configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"jobservice":{"description":"Background job service configuration.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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.nano","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"]}}},"trivy":{"description":"Trivy vulnerability scanner configuration.","type":"object","default":{},"required":["enabled","size"],"properties":{"enabled":{"description":"Enable or disable the vulnerability scanner.","type":"boolean","default":true},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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.nano","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 size for vulnerability database cache.","default":"5Gi","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}}},"database":{"description":"PostgreSQL database configuration.","type":"object","default":{},"required":["replicas","size"],"properties":{"replicas":{"description":"Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset.","type":"integer","default":2},"size":{"description":"Persistent Volume size for database storage.","default":"5Gi","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}}},"redis":{"description":"Redis cache configuration.","type":"object","default":{},"required":["replicas","size"],"properties":{"replicas":{"description":"Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are.","type":"integer","default":2},"size":{"description":"Persistent Volume size for cache storage.","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: "harbor-" labels: diff --git a/packages/system/kafka-rd/cozyrds/kafka.yaml b/packages/system/kafka-rd/cozyrds/kafka.yaml index 8814c19c2..fc5f72f2b 100644 --- a/packages/system/kafka-rd/cozyrds/kafka.yaml +++ b/packages/system/kafka-rd/cozyrds/kafka.yaml @@ -8,7 +8,7 @@ spec: plural: kafkas singular: kafka openAPISchema: |- - {"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Kafka cluster name. The KRaft controller pods are named `kafka--c--` with an 8-character hash, and that pod hostname must fit the 63-character DNS-1123 label limit even for the smallest cluster.","maxLength":44},"properties":{"external":{"description":"Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `-cluster-ca-cert` and `-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.","type":"boolean"}}},"version":{"description":"Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it.","type":"string","default":"v4.3","enum":["v4.3","v4.2"]},"users":{"description":"Users allowed on the external listener. Each key `` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `.`, where `` is `kafka-`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.","type":"object","default":{},"additionalProperties":{"type":"object"}},"topics":{"description":"Topics configuration.","type":"array","default":[],"items":{"type":"object","required":["name","partitions","replicas"],"properties":{"config":{"description":"Topic configuration.","type":"object","x-kubernetes-preserve-unknown-fields":true},"name":{"description":"Topic name.","type":"string"},"partitions":{"description":"Number of partitions.","type":"integer"},"replicas":{"description":"Number of replicas.","type":"integer"}}}},"kafka":{"description":"Kafka configuration.","type":"object","default":{},"required":["replicas","resourcesPreset","size","storageClass"],"properties":{"controllerStorageSize":{"description":"Persistent Volume size for KRaft controller metadata.","default":"5Gi","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},"replicas":{"description":"Number of Kafka replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. 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":"c1.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 size for Kafka.","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 Kafka data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}}}},"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","x-cozystack-name":{"type":"string","description":"Kafka cluster name. The KRaft controller pods are named `kafka--c--` with an 8-character hash, and that pod hostname must fit the 63-character DNS-1123 label limit even for the smallest cluster.","maxLength":44},"properties":{"external":{"description":"Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `-cluster-ca-cert` and `-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.","type":"boolean"}}},"version":{"description":"Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it.","type":"string","default":"v4.3","enum":["v4.3","v4.2"]},"users":{"description":"Users allowed on the external listener. Each key `` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `.`, where `` is `kafka-`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.","type":"object","default":{},"additionalProperties":{"type":"object"}},"topics":{"description":"Topics configuration.","type":"array","default":[],"items":{"type":"object","required":["name","partitions","replicas"],"properties":{"config":{"description":"Topic configuration.","type":"object","x-kubernetes-preserve-unknown-fields":true},"name":{"description":"Topic name.","type":"string","maxLength":249,"pattern":"^[a-zA-Z0-9._-]+$"},"partitions":{"description":"Number of partitions.","type":"integer"},"replicas":{"description":"Number of replicas.","type":"integer"}}}},"kafka":{"description":"Kafka configuration.","type":"object","default":{},"required":["replicas","resourcesPreset","size","storageClass"],"properties":{"controllerStorageSize":{"description":"Persistent Volume size for KRaft controller metadata.","default":"5Gi","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},"replicas":{"description":"Number of Kafka replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. 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":"c1.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 size for Kafka.","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 Kafka data.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}}}},"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: kafka- labels: diff --git a/packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml b/packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml index 2a3aef297..fc88e609f 100644 --- a/packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml +++ b/packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml @@ -21,7 +21,7 @@ spec: singular: kubernetesnodes plural: kubernetesnodeses openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"cluster":{"description":"Name of the parent Kubernetes cluster (the `Kubernetes` CR) in the same namespace this node pool attaches to. Required. The pool's CAPI objects are wired to the parent cluster `kubernetes-`; the KubernetesNodes CR must be named `-`. The pool's objects are named `kubernetes--`; when a MachineDeployment of that name already exists and belongs to another Helm release, the render fails instead of taking it over.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"cluster is immutable"}]},"network":{"description":"Joins this pool's worker VMs to a cozyplane VPC. Must match the parent Kubernetes cluster's `network`, which puts the control plane in the same VPC. Setting or changing it on an existing pool rolls every worker VM of the pool. Requires the cozyplane networking variant and `substrate: kubevirt`.","type":"object","default":{},"properties":{"name":{"description":"Name of the VirtualPrivateCloud (without the \"virtualprivatecloud-\" prefix) in this namespace","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VPC's namespace that routes this pool's worker VMs. Empty uses the VPC's default table. Requires `network.name` and the cozyplane networking variant. Like `network`, setting or changing it rolls every worker VM of the pool.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"storageClass":{"description":"StorageClass for the worker node system disk. When empty, CDI picks the class: the one annotated `storageclass.kubevirt.io/is-default-virt-class`, else the cluster default. Worker VMs live-migrate, so their disks need ReadWriteMany — the RWX access mode is supplied by the chosen StorageClass's CDI StorageProfile — and linstor-csi rejects RWX volumes that are not on a DRBD-backed StorageClass, so prefer a replicated/DRBD class. On an `osImage.builtin` pool this field also decides whether the pool renders at all: the chart refuses a pool whose class differs from its golden's, because across classes CDI either falls back to a host-assisted copy over the pod network (different CSI drivers or volume modes) or leaves a clone into the other class to the CSI driver. Leaving it empty makes the same comparison against the class CDI would pick. On a `builtin` pool the resolved class is then written onto the worker disk rather than left for the cluster to fill in at bind time, so a pool that has already cloned keeps binding on the class its disks are on even after an admin moves the default annotation; on the HTTP path an empty class is still left to the cluster. Has no effect on `substrate: proxmox`, where the worker disk is cloned from the VM template onto the template's storage or `proxmox.storage`.","type":"string","default":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"minReplicas":{"description":"Minimum number of replicas in this pool. Used as the cluster-autoscaler floor.","type":"integer","default":0},"maxReplicas":{"description":"Maximum number of replicas in this pool. Used as the cluster-autoscaler ceiling. 0 pauses the pool: its workers are scaled down to zero.","type":"integer","default":10},"instanceType":{"description":"KubeVirt instance type that sizes each worker VM when `resources` is not set. Ignored when `resources.cpu` and `resources.memory` are both set, and therefore on `substrate: proxmox`, which requires them.","type":"string","default":"u1.medium","x-cozystack-options":{"source":"instancetype"}},"diskSize":{"description":"System disk size for the worker VM. Carries the Talos OS image, kubelet state, containerd image cache, and any local-path PVCs. How the OS image reaches the disk follows this pool's `osImage`: the default and `osImage.factory` stream the Image Factory raw artifact in over HTTP, while `osImage.builtin` makes the disk a storage-layer CDI clone of a shared golden image, with no HTTP fetch. A `builtin` pool must keep diskSize at or above the golden's storage size (6Gi in the shipped worker image catalog), because a CDI clone target cannot be smaller than its source -- the chart rejects a smaller value at render time rather than letting the clone stall. Sizing a `builtin` pool also has to allow for transient headroom the finished disk does not show: CDI populates a larger target by cloning the golden at the source size and then growing it, so a worker being provisioned occupies a temporary clone PVC at the golden's size on top of this diskSize, and both are multiplied by the replica count of a replicated StorageClass. The golden itself is a separate one-time cost for the whole cluster, not a per-worker one. So the peak is the golden, plus `diskSize + golden storage` for each worker cloning at that moment. A pool whose storage backend cannot spare that peak does not fail: the clone waits for space, the VM never boots, and the reason is visible only in the storage layer's own events. Has no effect on `substrate: proxmox`, where the worker disk is a clone of the VM template's disk and keeps its size.","default":"20Gi","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},"roles":{"description":"List of node roles. Each role `r` labels nodes with `node-role.kubernetes.io/`. Use `[ingress-nginx]` for a pool that hosts the tenant ingress-nginx controller.","type":"array","default":[],"items":{"type":"string"}},"resources":{"description":"Explicit CPU and memory for each worker node, as an alternative to `instanceType` sizing. Optional: when omitted, the node is sized by `instanceType`. When both `cpu` and `memory` are set, they take precedence and `instanceType` is ignored (the instancetype is omitted from the VM, since KubeVirt cannot override an instancetype's CPU/memory). Set both `cpu` and `memory` together or neither; setting only one is rejected at render time. On the kubevirt substrate `cpu` is written into the VM as spelled and decoded as YAML, so a leading zero is read as octal, as in any Kubernetes manifest: `\"010\"` is eight cores, and the autoscaler capacity counts eight. The kubelet reservations still read the value as a decimal, so `\"010\"` reserves what `\"10\"` does.","type":"object","default":{},"properties":{"cpu":{"description":"Number of vCPU cores for each worker VM, as a whole number such as `2`. On the `kubevirt` substrate the value becomes the VM's integer `domain.cpu.cores`, so millicore, fractional and negative quantities, and counts above 4294967295, are rejected at render time; an unquoted `0` is treated as unset. On the `proxmox` substrate a millicore or fractional quantity is rounded up to whole cores.","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.","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}}},"podCpuLimit":{"description":"CPU limit for the worker VM's virt-launcher `compute` container, which is the ceiling the guest vCPU threads, the QEMU emulator thread and the IO threads share. Distinct from `resources.cpu`, which sizes the guest itself. Cannot be combined with `instanceType` sizing: KubeVirt refuses a VM that references an instancetype and also sets `domain.resources.limits.cpu`, so the chart rejects that combination at render time. Sizing the pool by `resources` (both `cpu` and `memory`) is what drops the instancetype from the VM, which is where the limit is usable. When unset, KubeVirt derives the limit from the guest vCPU count in any namespace carrying a ResourceQuota that limits CPU, so a worker sized at N vCPUs runs under a ceiling of N with the emulation overhead taken out of the same N. Setting a value declares the limit on the VM directly, which is both what lands it on the container and what stops KubeVirt deriving one. It moves the CPU request with it: KubeVirt copies a declared CPU limit into the CPU request when the VM declares no request of its own, so a pool that sets only this field asks the scheduler for its whole ceiling instead of the fraction of the vCPU count it asked for before, and a ceiling the nodes cannot spare leaves the workers Pending on `Insufficient cpu`. Pair it with `podCpuRequest` to move the ceiling without moving the request. Zero means no ceiling at all rather than the tightest one, since the kubelet turns a zero CPU limit into no CFS quota while the declared key still stops KubeVirt deriving one — but it is only accepted together with `podCpuRequest: 0`, because KubeVirt keeps deriving a request from the vCPU count when the VM declares none and a request above a declared limit of zero is rejected when the worker's Pod is created. A negative value is refused at render time. Changing it rolls the pool, because the worker VM template is named by a hash of its content.","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},"podCpuRequest":{"description":"CPU request for the worker VM's virt-launcher `compute` container, which is what the scheduler reserves for a worker on its host and what weights it against neighbours on a contended one. Distinct from `resources.cpu`, which sizes the guest itself. It exists to be paired with `podCpuLimit`: KubeVirt copies a declared CPU limit into the request when the VM declares no request, so raising the ceiling alone raises what every worker in the pool asks the scheduler for, and this field is what holds the request still while the ceiling moves. Cannot be combined with `instanceType` sizing, for the same reason as `podCpuLimit`: KubeVirt refuses a VM that references an instancetype and also sets `domain.resources.requests.cpu`, so the chart rejects that combination at render time, as it does a value above `podCpuLimit`. Usable without a limit, where it only changes the scheduler's weighting: KubeVirt still derives the ceiling from the guest vCPU count in any namespace carrying a ResourceQuota that limits CPU, so keep the request at or below that count. A request above that derived ceiling is refused only when the worker's Pod is created, and deliberately not at render time: the ceiling exists only where such a ResourceQuota does, so refusing here would take away a configuration that works in a namespace without one. Zero is accepted on its own and reserves nothing, but zero beside a `podCpuLimit` is refused, because KubeVirt cannot tell an explicit zero request from an absent one and replaces both with the limit — which is the outcome this field exists to avoid, arrived at silently. A negative value is refused as well. When unset, KubeVirt computes the request from the guest vCPU count and the cluster CPU allocation ratio. Changing it rolls the pool, because the worker VM template is named by a hash of its content.","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},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"name":{"description":"Name of GPU, such as \"nvidia.com/AD102GL_L40S\".","type":"string","x-cozystack-options":{"source":"gpu"}}}}},"maxUnavailable":{"description":"Workers a rollout (instance type, image or version change) may remove before their replacement is up. Unset, it is 0, so each replacement joins before an old worker is drained, and 1 on a pool with `gpus`, whose replacement may need the very GPU the old worker holds. With 0, a rollout needs room for one extra VM: a pool short of quota or capacity for it stalls, with the new Machine Pending, until room is made or `maxUnavailable` is set to 1. Set 1 on a Proxmox pool whose template passes a GPU through: the chart cannot see that GPU, and with 0 the rollout would wait for it forever.","type":"integer","maximum":2147483647,"minimum":0},"kernelModules":{"description":"Kernel modules loaded on every worker in this pool, emitted as Talos `machine.kernel.modules`. A Talos system extension installs a module but does not load it, so an extension-provided driver needs its modules declared here. Leave unset to let the chart decide: a pool holding at least one `nvidia.com/*` GPU gets `nvidia` (with `NVreg_NvLinkDisable=1`, which the gpu-operator driver container applies on non-Talos workers; on Talos that container has to be turned off or it clashes with the system extension, and nothing then mounts the ConfigMap carrying the parameter), `nvidia_uvm`, `nvidia_drm`, `nvidia_modeset` (that order — Talos loads the list in sequence and the last three depend on the first), and any other pool gets nothing. Set a non-empty list to replace the chart's choice entirely, or `[]` to opt out and emit no modules even on a GPU pool. The field carries no default, and unset is not the same value as `[]`: a generated parameter table that shows `[]` in its Default column is printing what it prints for any array with no default, not the effective value — leaving the field out selects the automatic set, writing `[]` disables it. The module still has to be in the image, and which extensions the image carries is the pool's schematic: a GPU pool points `osImage.factory.schematicID` (or `osImage.builtin.schematicID`) at a schematic with the NVIDIA extensions, and on Blackwell (GB202) that must be the open-kernel-modules extension. The automatic set keys on the `nvidia.com/` resource prefix alone and nothing cross-checks it against that schematic; on Talos v1.13 a declared module the image does not ship leaves its controller retrying rather than failing the boot, so the symptom is a missing driver, not a dead node. This value is part of the worker machine config, whose content hash names the `TalosConfigTemplate`, so changing it rolls every existing worker in the pool rather than only affecting nodes created later.","type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"description":"Module name as `modprobe` takes it, e.g. `nvidia_uvm`.","type":"string"},"parameters":{"description":"Module parameters, each as a bare `key=value` string.","type":"array","items":{"type":"string"}}}}},"kubelet":{"description":"Kubelet resource reservations for this pool. An empty reservation is computed from the worker's size: `resources` when set, otherwise the `instanceType`.","type":"object","default":{},"properties":{"evictionHardMemory":{"description":"Hard eviction threshold for memory (absolute like 200Mi or percentage like 7%).","type":"string","default":"7%"},"evictionSoftMemory":{"description":"Soft eviction threshold for memory (absolute like 1Gi or percentage like 10%).","type":"string","default":"10%"},"kubeReservedCpu":{"description":"CPU reserved for kubelet and container runtime. When empty, 5% of the worker's CPU, clamped to 50m..500m.","type":"string"},"kubeReservedMemory":{"description":"Memory reserved for kubelet and container runtime. When empty, 5% of the worker's memory, clamped to 256Mi..1Gi.","type":"string"},"systemReservedCpu":{"description":"CPU reserved for host OS. When empty, 5% of the worker's CPU, clamped to 50m..500m.","type":"string"},"systemReservedMemory":{"description":"Memory reserved for host OS. When empty, 5% of the worker's memory, clamped to 256Mi..1Gi.","type":"string"}}},"logSerialConsole":{"description":"Stream each worker VM's guest serial console into a `guest-console-log` container beside virt-launcher, readable with `kubectl logs`. The only view of a worker that stalls during boot before Talos apid answers, when neither a Node nor a certificate request exists to diagnose from. Two costs the field name does not show. Changing the value rolls the pool, because it is part of the worker VM template whose name is a hash of its content -- including the stuck VM whose console was wanted, so it buys visibility into the next boot rather than the current one. And it overrides the platform's cluster-wide `disableSerialConsoleLog`, set because that container has been seen holding virt-launcher in `PodInitializing` (kubevirt/kubevirt#15989), which would take the pool down rather than explain it -- so check that virt-launcher Pods reach Running after enabling it.","type":"boolean","default":false},"maxUnhealthy":{"description":"Maximum number of unhealthy nodes tolerated in this pool before remediation is paused. The MachineHealthCheck admission webhook accepts either a bare integer (\"0\", \"1\", ...) or a percentage (\"0%\", \"50%\"); bare numeric strings are rejected, so the safer default is a percentage. Drop to \"0%\" once the pool is stable. Watch how a percentage behaves in a small group: the MachineHealthCheck controller scales it against the number of machines the check covers and rounds down, then remediates only while the unhealthy count is at or below that result. At \"50%\" a group of one therefore never remediates, because half of one rounds down to zero, and a group of two remediates one unhealthy machine but not two.","type":"string","default":"50%"},"nodeStartupTimeout":{"description":"Maximum time a Machine is allowed to spend reaching the Ready condition before it is remediated. Raise for slow first boots (the Talos image import from the Image Factory, or a storage class slow to provision or clone the worker disk). The MachineHealthCheck measures it from the later of the Machine's creation and its InfrastructureReady transition, so the clock restarts when the infrastructure reports ready: a worker gets this long for the disk image import and the VM to come up, and then this long again for the guest to boot and its kubelet to register with the tenant apiserver. Either leg stretches on a host under load, and a Machine remediated here is deleted before it ever joins, so its replacement starts the same sequence from the beginning.","type":"string","default":"20m"},"readyUnknownTimeout":{"description":"How long a worker Node may report `Ready=Unknown` before the MachineHealthCheck remediates the Machine, which for a KubeVirt worker means deleting the VM. `Ready=Unknown` is what the node lifecycle controller writes once it stops hearing from a kubelet, on a grace period of its own, so the wall clock from a guest going quiet to a deleted worker is this value plus that grace period. A guest starved of CPU stops answering long before it is dead, so a value of a few tens of seconds deletes workers that would have come back on their own. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips.","type":"string","default":"5m"},"readyFalseTimeout":{"description":"How long a worker Node may report `Ready=False` before the MachineHealthCheck remediates the Machine. A Node that has registered but has no working CNI yet reports `Ready=False`, so this value is the whole budget a first boot gets for the CNI rollout to reach that node, and a worker deleted mid-rollout takes the rollout with it while its replacement starts over. Raising it delays replacing a worker that is genuinely dead, but not rescheduling its workload: Pods leave an unreachable Node on the node lifecycle controller's taint-based eviction and the toleration that carries, not on this timer. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips.","type":"string","default":"10m"},"maxNodeProvisionTime":{"description":"How long the cluster-autoscaler waits for a newly created worker to register as a Node before it treats that machine as long-unregistered. Rendered onto this pool's MachineDeployment as the `cluster.x-k8s.io/autoscaling-options-maxnodeprovisiontime` annotation, which overrides the autoscaler's built-in default for this pool only. Two things change when the timer fires, and both make a slow join worse rather than better: the machine stops counting towards the pool's upcoming capacity, so the autoscaler asks for a replacement for capacity that is already on its way, and the machine becomes eligible for removal. Size it above the slowest join a healthy worker can take, counting the Talos image import, the guest boot and the CNI rollout. Accepted as a whole number of seconds, minutes or hours (\"30m\", \"1h30m\"), which is narrower than Go's duration syntax on purpose: the autoscaler ignores a value it cannot parse and falls back to its own default without failing, and the narrower shape cannot express a value that overflows the parser or a fraction it rounds to zero. The canonical form a duration serializes back to (\"20m0s\", \"1h0m0s\") is accepted.","type":"string","default":"30m"},"version":{"description":"Kubernetes major.minor version the pool joins. Must not be ahead of the parent cluster's minor (workers may not lead the apiserver); it may lag behind during a rolling upgrade -- bump the parent Kubernetes CR first, then each pool. The render fails when it is ahead. Its pairing with the Talos release the pool resolves (`talos.version`, or the `osImage` override) is checked against the chart's Talos<->Kubernetes support matrix: for a Talos minor the matrix lists, a Kubernetes minor outside that minor's list is refused; a Talos minor the matrix does not list is not checked.","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"osImage":{"description":"Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. The object is atomic: its two sources exclude each other, so a value that sets one of them replaces the whole object and is never completed from a default.","type":"object","default":{},"properties":{"builtin":{"description":"Clone a golden image from the worker image catalog. Requires a StorageClass whose volumes are reachable from any node, in practice a replicated/DRBD class: the clone is a storage-layer copy, and on a node-pinned class its two ends land on unrelated nodes -- the golden binds where CDI imported it, a worker disk where its VM is scheduled.","type":"object","properties":{"schematicID":{"description":"Talos schematic ID of the golden to clone. Defaults to `talos.schematicID`.","type":"string"},"version":{"description":"Talos version of the golden to clone. Defaults to `talos.version`.","type":"string"}}},"factory":{"description":"Import from an Image Factory / mirror (default).","type":"object","properties":{"imageFactoryURL":{"description":"Base URL of the Image Factory serving the boot raw image. Defaults to `talos.imageFactoryURL`. No trailing slash. This redirects only the worker boot-disk import; the installer image in the worker machine config is always sourced from `talos.installerRepository`, so an air-gapped pool must also have `talos.installerRepository` pointed at a reachable registry.","type":"string"},"schematicID":{"description":"Talos schematic ID. Defaults to `talos.schematicID`.","type":"string"},"version":{"description":"Talos version. Defaults to `talos.version`.","type":"string"}}}},"x-kubernetes-map-type":"atomic"},"talos":{"description":"Talos worker image configuration for this pool.","type":"object","default":{},"required":["imageFactoryURL","installerRepository","registryMirrors","schematicID","version"],"properties":{"imageFactoryCA":{"description":"Complete PEM certificate block(s) CDI must trust when importing this pool's worker OS disk image over HTTPS — the no-osImage default and `osImage.factory` path. Empty by default, so the importer uses only its system trust store, which is what the public factory needs. Set this when the factory in use (`imageFactoryURL` or `osImage.factory.imageFactoryURL`) is a self-hosted factory or mirror served by an internal CA, which the importer otherwise rejects with `x509: certificate signed by unknown authority`. The chart renders it into a ConfigMap in the release namespace — CDI requires certConfigMap to sit alongside the DataVolume — and references that from the worker DataVolume's `source.http.certConfigMap`; CDI appends it to the system pool rather than replacing it, so a publicly-trusted endpoint verifies either way. A pool on `osImage.builtin` clones a golden image and builds no HTTP source, so this field has no effect there. On `substrate: proxmox` it has no effect on the workers either: the ConfigMap is still rendered, but nothing references it.","type":"string","default":""},"imageFactoryURL":{"description":"Default base URL of the Talos Image Factory that serves the worker OS disk image (the `openstack-amd64.raw.xz` raw artifact streamed in by CDI over HTTP). Applies only when this pool imports over HTTP — the default and `osImage.factory`, which overrides it via `osImage.factory.imageFactoryURL`. A pool on `osImage.builtin` clones a golden image from the worker image catalog and does not use this field at all. Defaults to the public factory. Point at a self-hosted Image Factory, a caching mirror, or an internal HTTP file server for air-gapped, rate-limited, or flaky-egress environments. No trailing slash. It is interpolated into the worker DataVolume source URL, so on those HTTP paths it must be a plain `http(s)` URL and the render refuses anything else; a pool on `osImage.builtin` builds no such URL and is not held to it, so blanking this field there is legal. On `substrate: proxmox` the workers clone a VM template that already carries the OS, so this field has no effect there beyond that format check.","type":"string","default":"https://factory.talos.dev"},"installerRepository":{"description":"OCI repository prefix for the Talos installer image, written into the worker machine config as `machine.install.image`. Resolved as `/:` against whatever this pool's `osImage` pins, falling back to `talos.schematicID` and `talos.version` — so the installer matches the OS the pool actually booted. The prefix itself has no `osImage.*` override, so an air-gapped pool needs it pointed at a reachable registry as well. Defaults to the public factory's installer path. Override for air-gapped or mirrored registries. No trailing slash.","type":"string","default":"factory.talos.dev/installer"},"registryMirrors":{"description":"Talos `machine.registries.mirrors` passthrough for worker nodes: a map of upstream registry host to `{ endpoints: [ ... ] }`. Empty by default, so workers pull container images (the Talos `kubelet` image included) directly from the upstream registry. Point a host such as `ghcr.io` at an in-cluster pull-through mirror for air-gapped, rate-limited, or flaky-egress environments so a worker's boot does not depend on live public egress. Talos still falls back to the upstream registry unless a host also sets `skipFallback: true`, so a mirror alone does not enforce air-gap. This value is part of the worker machine config, whose content hash names the TalosConfigTemplate, so changing it rolls every existing worker in the pool rather than only affecting nodes created later.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"schematicID":{"description":"Talos image-factory schematic ID. Defaults to the cozystack-tested vanilla schematic. Operators using custom schematics (system extensions, kernel args) override here. The pool can pin its own via `osImage.builtin.schematicID` or `osImage.factory.schematicID`; when `osImage` omits it, this value applies. Whichever of the two applies is interpolated into an image URL and a DataVolume name, so it must be a plain lowercase alphanumeric identifier -- the render refuses anything else. A custom schematic on `osImage.builtin` also needs its own catalog entry, since the golden is named from the schematic ID.","type":"string","default":"ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515"},"sysctls":{"description":"Sysctl overrides rendered into Talos `machine.sysctls` on this pool's guest workers only. Values must be strings (quote numeric values); for example, `user.max_user_namespaces: \"11255\"` enables the user namespaces required by the Talos gVisor extension. An empty map preserves Talos defaults and the existing bootstrap hash. Adding, changing or removing an override changes the content-hashed TalosConfigTemplate and rolls the pool's workers. Supported names and values depend on the worker's Talos release and kernel; unsafe settings can weaken guest isolation or prevent workers from booting. This does not install gVisor or configure a RuntimeClass, and does not change the management hosts, control plane or other pools.","type":"object","default":{},"additionalProperties":{"type":"string"}},"version":{"description":"Default Talos release for this pool's worker OS image and for the installer image written into the worker machine config. The pool can pin its own release via `osImage.builtin.version` or `osImage.factory.version`; when `osImage` omits it, this value applies. Both ways in are checked against the chart's Talos<->Kubernetes support matrix, against whichever release the pool actually resolves to, so an override cannot slip past a check `talos.version` would have failed. The matrix lists, for each Talos minor the chart knows, the Kubernetes minors it supports and refuses a pool `version` outside that list; a Talos minor it does not list passes unchecked, so pointing either field at a Talos release the chart does not know about is the operator's call, not a checked one. Whichever release applies is interpolated into an image URL and a DataVolume name, so it must be a full `vMAJOR.MINOR.PATCH` release, optionally with a pre-release suffix -- the render refuses anything else, a minor-only `v1.13` included. The values schema types this as a bare string, so a malformed one is accepted by the CR and fails the pool's HelmRelease instead.","type":"string","default":"v1.13.12"}}},"substrate":{"description":"Which infrastructure provider backs this pool's worker VMs. `kubevirt` runs them inside this cluster on KubeVirt, sized by `instanceType` and booted from a Talos disk image CDI streams from the image factory. `proxmox` runs them on an external Proxmox VE cluster through capmox, sized by `resources`, and cloned from a Talos VM template that already exists on the hypervisor. The two substrates take different Talos platform images and different sizing inputs, so switching an existing pool is refused: the chart reads the live MachineDeployment's template kind and fails the render rather than rolling every worker to the other hypervisor and deleting the template the draining MachineSet still references. Create a new pool on the other substrate and scale this one down.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["network"],"properties":{"dnsServers":{"description":"Nameservers written into the worker machineconfig. On kubevirt the workers use the management cluster's CoreDNS, which they reach over the pod network; an off-cluster Proxmox worker cannot, so it needs reachable resolvers of its own. Required when `substrate` is `proxmox`. Keep in sync with the parent kubernetes chart's `proxmox.dnsServers`.","type":"array","default":[],"items":{"type":"string"}},"full":{"description":"Full clone rather than linked. Default is a linked clone: it costs kilobytes at creation instead of the whole disk, because a ZFS-backed linked clone writes only its own increment (measured: 8K against 10.2G for the same worker full-cloned onto a `sparse 0` pool). The cost is that the clone holds the template's base snapshot, so the template cannot be rotated while any linked clone still references it — which is what the consolidation CronJob resolves 24h after creation. Set true for a pool that must be independent of the template from the first second.","type":"boolean","default":false},"network":{"description":"NIC configuration.","type":"object","default":{},"required":["bridge"],"properties":{"bridge":{"description":"Proxmox bridge the VM NIC attaches to (e.g. `vmbr0`). Required when `substrate` is `proxmox`.","type":"string","default":""},"mtu":{"description":"NIC MTU. Omitted when unset.","type":"integer"},"vlan":{"description":"L2 VLAN tag. Omitted when unset.","type":"integer"}}},"pool":{"description":"Proxmox resource pool the worker VMs are added to. Set the same pool on every node pool of a tenant cluster and grant the tenant's tokens their privileges on `/pool/`: that is the one ACL path that follows every VM capmox creates, replacements included. The pool must exist on the hypervisor; capmox does not create it. Empty adds the workers to no pool.","type":"string","default":""},"storage":{"description":"Proxmox storage for the cloned disk; needs `full: true`. A target storage is a full-clone parameter — a linked clone always lives on the template's storage, and Proxmox refuses the pair — so the render refuses it too. Empty keeps the template's storage.","type":"string","default":""},"templateTags":{"description":"Tags identifying the Talos VM template to clone. capmox matches a template when its tag set is EQUAL to this list, not when it contains it, so every tag on the template must be listed here — a missing one yields `found 0 VM templates with tags ...` while the tags are plainly present. The template has to carry this pool's `talos.schematicID` at `talos.version` in the nocloud flavour, with the Proxmox guest agent enabled for the `qemu-guest-agent` extension of the default schematic; `hack/proxmox-talos-template.sh` builds it from these values and prints the tags to list here. That script tags the template `talos-`, and the render refuses a `talos-vX.Y.Z` tag other than `talos-`, because the template is the boot disk while `talos.version` reaches only the installer, so a pool left on the previous release's tags would roll its workers onto the old kernel. Do not build it from the platform release's `nocloud-amd64.raw.xz`: that is the bare-metal node image, whose `zfs` extension keeps a VM from finishing its boot sequence and reboots it at the Talos boot timeout. Required when `substrate` is `proxmox`.","type":"array","default":[],"items":{"type":"string"}}}}}} + {"title":"Chart Values","type":"object","properties":{"cluster":{"description":"Name of the parent Kubernetes cluster (the `Kubernetes` CR) in the same namespace this node pool attaches to. Required. The pool's CAPI objects are wired to the parent cluster `kubernetes-`; the KubernetesNodes CR must be named `-`. The pool's objects are named `kubernetes--`; when a MachineDeployment of that name already exists and belongs to another Helm release, the render fails instead of taking it over.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"cluster is immutable"}]},"network":{"description":"Joins this pool's worker VMs to a cozyplane VPC. Must match the parent Kubernetes cluster's `network`, which puts the control plane in the same VPC. Setting or changing it on an existing pool rolls every worker VM of the pool. Requires the cozyplane networking variant and `substrate: kubevirt`.","type":"object","default":{},"properties":{"name":{"description":"Name of the VirtualPrivateCloud (without the \"virtualprivatecloud-\" prefix) in this namespace","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VPC's namespace that routes this pool's worker VMs. Empty uses the VPC's default table. Requires `network.name` and the cozyplane networking variant. Like `network`, setting or changing it rolls every worker VM of the pool.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"storageClass":{"description":"StorageClass for the worker node system disk. When empty, CDI picks the class: the one annotated `storageclass.kubevirt.io/is-default-virt-class`, else the cluster default. Worker VMs live-migrate, so their disks need ReadWriteMany — the RWX access mode is supplied by the chosen StorageClass's CDI StorageProfile — and linstor-csi rejects RWX volumes that are not on a DRBD-backed StorageClass, so prefer a replicated/DRBD class. On an `osImage.builtin` pool this field also decides whether the pool renders at all: the chart refuses a pool whose class differs from its golden's, because across classes CDI either falls back to a host-assisted copy over the pod network (different CSI drivers or volume modes) or leaves a clone into the other class to the CSI driver. Leaving it empty makes the same comparison against the class CDI would pick. On a `builtin` pool the resolved class is then written onto the worker disk rather than left for the cluster to fill in at bind time, so a pool that has already cloned keeps binding on the class its disks are on even after an admin moves the default annotation; on the HTTP path an empty class is still left to the cluster. Has no effect on `substrate: proxmox`, where the worker disk is cloned from the VM template onto the template's storage or `proxmox.storage`.","type":"string","default":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"minReplicas":{"description":"Minimum number of replicas in this pool. Used as the cluster-autoscaler floor.","type":"integer","default":0},"maxReplicas":{"description":"Maximum number of replicas in this pool. Used as the cluster-autoscaler ceiling. 0 pauses the pool: its workers are scaled down to zero.","type":"integer","default":10},"instanceType":{"description":"KubeVirt instance type that sizes each worker VM when `resources` is not set. Ignored when `resources.cpu` and `resources.memory` are both set, and therefore on `substrate: proxmox`, which requires them.","type":"string","default":"u1.medium","x-cozystack-options":{"source":"instancetype"}},"diskSize":{"description":"System disk size for the worker VM. Carries the Talos OS image, kubelet state, containerd image cache, and any local-path PVCs. How the OS image reaches the disk follows this pool's `osImage`: the default and `osImage.factory` stream the Image Factory raw artifact in over HTTP, while `osImage.builtin` makes the disk a storage-layer CDI clone of a shared golden image, with no HTTP fetch. A `builtin` pool must keep diskSize at or above the golden's storage size (6Gi in the shipped worker image catalog), because a CDI clone target cannot be smaller than its source -- the chart rejects a smaller value at render time rather than letting the clone stall. Sizing a `builtin` pool also has to allow for transient headroom the finished disk does not show: CDI populates a larger target by cloning the golden at the source size and then growing it, so a worker being provisioned occupies a temporary clone PVC at the golden's size on top of this diskSize, and both are multiplied by the replica count of a replicated StorageClass. The golden itself is a separate one-time cost for the whole cluster, not a per-worker one. So the peak is the golden, plus `diskSize + golden storage` for each worker cloning at that moment. A pool whose storage backend cannot spare that peak does not fail: the clone waits for space, the VM never boots, and the reason is visible only in the storage layer's own events. Has no effect on `substrate: proxmox`, where the worker disk is a clone of the VM template's disk and keeps its size.","default":"20Gi","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},"roles":{"description":"List of node roles. Each role `r` labels nodes with `node-role.kubernetes.io/`. Use `[ingress-nginx]` for a pool that hosts the tenant ingress-nginx controller.","type":"array","default":[],"items":{"type":"string"}},"resources":{"description":"Explicit CPU and memory for each worker node, as an alternative to `instanceType` sizing. Optional: when omitted, the node is sized by `instanceType`. When both `cpu` and `memory` are set, they take precedence and `instanceType` is ignored (the instancetype is omitted from the VM, since KubeVirt cannot override an instancetype's CPU/memory). Set both `cpu` and `memory` together or neither; setting only one is rejected at render time. On the kubevirt substrate `cpu` is written into the VM as spelled and decoded as YAML, so a leading zero is read as octal, as in any Kubernetes manifest: `\"010\"` is eight cores, and the autoscaler capacity counts eight. The kubelet reservations still read the value as a decimal, so `\"010\"` reserves what `\"10\"` does.","type":"object","default":{},"properties":{"cpu":{"description":"Number of vCPU cores for each worker VM, as a whole number such as `2`. On the `kubevirt` substrate the value becomes the VM's integer `domain.cpu.cores`, so millicore, fractional and negative quantities, and counts above 4294967295, are rejected at render time; an unquoted `0` is treated as unset. On the `proxmox` substrate a millicore or fractional quantity is rounded up to whole cores.","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.","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}}},"podCpuLimit":{"description":"CPU limit for the worker VM's virt-launcher `compute` container, which is the ceiling the guest vCPU threads, the QEMU emulator thread and the IO threads share. Distinct from `resources.cpu`, which sizes the guest itself. Cannot be combined with `instanceType` sizing: KubeVirt refuses a VM that references an instancetype and also sets `domain.resources.limits.cpu`, so the chart rejects that combination at render time. Sizing the pool by `resources` (both `cpu` and `memory`) is what drops the instancetype from the VM, which is where the limit is usable. When unset, KubeVirt derives the limit from the guest vCPU count in any namespace carrying a ResourceQuota that limits CPU, so a worker sized at N vCPUs runs under a ceiling of N with the emulation overhead taken out of the same N. Setting a value declares the limit on the VM directly, which is both what lands it on the container and what stops KubeVirt deriving one. It moves the CPU request with it: KubeVirt copies a declared CPU limit into the CPU request when the VM declares no request of its own, so a pool that sets only this field asks the scheduler for its whole ceiling instead of the fraction of the vCPU count it asked for before, and a ceiling the nodes cannot spare leaves the workers Pending on `Insufficient cpu`. Pair it with `podCpuRequest` to move the ceiling without moving the request. Zero means no ceiling at all rather than the tightest one, since the kubelet turns a zero CPU limit into no CFS quota while the declared key still stops KubeVirt deriving one — but it is only accepted together with `podCpuRequest: 0`, because KubeVirt keeps deriving a request from the vCPU count when the VM declares none and a request above a declared limit of zero is rejected when the worker's Pod is created. A negative value is refused at render time. Changing it rolls the pool, because the worker VM template is named by a hash of its content.","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},"podCpuRequest":{"description":"CPU request for the worker VM's virt-launcher `compute` container, which is what the scheduler reserves for a worker on its host and what weights it against neighbours on a contended one. Distinct from `resources.cpu`, which sizes the guest itself. It exists to be paired with `podCpuLimit`: KubeVirt copies a declared CPU limit into the request when the VM declares no request, so raising the ceiling alone raises what every worker in the pool asks the scheduler for, and this field is what holds the request still while the ceiling moves. Cannot be combined with `instanceType` sizing, for the same reason as `podCpuLimit`: KubeVirt refuses a VM that references an instancetype and also sets `domain.resources.requests.cpu`, so the chart rejects that combination at render time, as it does a value above `podCpuLimit`. Usable without a limit, where it only changes the scheduler's weighting: KubeVirt still derives the ceiling from the guest vCPU count in any namespace carrying a ResourceQuota that limits CPU, so keep the request at or below that count. A request above that derived ceiling is refused only when the worker's Pod is created, and deliberately not at render time: the ceiling exists only where such a ResourceQuota does, so refusing here would take away a configuration that works in a namespace without one. Zero is accepted on its own and reserves nothing, but zero beside a `podCpuLimit` is refused, because KubeVirt cannot tell an explicit zero request from an absent one and replaces both with the limit — which is the outcome this field exists to avoid, arrived at silently. A negative value is refused as well. When unset, KubeVirt computes the request from the guest vCPU count and the cluster CPU allocation ratio. Changing it rolls the pool, because the worker VM template is named by a hash of its content.","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},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"name":{"description":"Name of GPU, such as \"nvidia.com/AD102GL_L40S\".","type":"string","maxLength":317,"pattern":"^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$","x-cozystack-options":{"source":"gpu"}}}}},"maxUnavailable":{"description":"Workers a rollout (instance type, image or version change) may remove before their replacement is up. Unset, it is 0, so each replacement joins before an old worker is drained, and 1 on a pool with `gpus`, whose replacement may need the very GPU the old worker holds. With 0, a rollout needs room for one extra VM: a pool short of quota or capacity for it stalls, with the new Machine Pending, until room is made or `maxUnavailable` is set to 1. Set 1 on a Proxmox pool whose template passes a GPU through: the chart cannot see that GPU, and with 0 the rollout would wait for it forever.","type":"integer","maximum":2147483647,"minimum":0},"kernelModules":{"description":"Kernel modules loaded on every worker in this pool, emitted as Talos `machine.kernel.modules`. A Talos system extension installs a module but does not load it, so an extension-provided driver needs its modules declared here. Leave unset to let the chart decide: a pool holding at least one `nvidia.com/*` GPU gets `nvidia` (with `NVreg_NvLinkDisable=1`, which the gpu-operator driver container applies on non-Talos workers; on Talos that container has to be turned off or it clashes with the system extension, and nothing then mounts the ConfigMap carrying the parameter), `nvidia_uvm`, `nvidia_drm`, `nvidia_modeset` (that order — Talos loads the list in sequence and the last three depend on the first), and any other pool gets nothing. Set a non-empty list to replace the chart's choice entirely, or `[]` to opt out and emit no modules even on a GPU pool. The field carries no default, and unset is not the same value as `[]`: a generated parameter table that shows `[]` in its Default column is printing what it prints for any array with no default, not the effective value — leaving the field out selects the automatic set, writing `[]` disables it. The module still has to be in the image, and which extensions the image carries is the pool's schematic: a GPU pool points `osImage.factory.schematicID` (or `osImage.builtin.schematicID`) at a schematic with the NVIDIA extensions, and on Blackwell (GB202) that must be the open-kernel-modules extension. The automatic set keys on the `nvidia.com/` resource prefix alone and nothing cross-checks it against that schematic; on Talos v1.13 a declared module the image does not ship leaves its controller retrying rather than failing the boot, so the symptom is a missing driver, not a dead node. This value is part of the worker machine config, whose content hash names the `TalosConfigTemplate`, so changing it rolls every existing worker in the pool rather than only affecting nodes created later.","type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"description":"Module name as `modprobe` takes it, e.g. `nvidia_uvm`.","type":"string"},"parameters":{"description":"Module parameters, each as a bare `key=value` string.","type":"array","items":{"type":"string"}}}}},"kubelet":{"description":"Kubelet resource reservations for this pool. An empty reservation is computed from the worker's size: `resources` when set, otherwise the `instanceType`.","type":"object","default":{},"properties":{"evictionHardMemory":{"description":"Hard eviction threshold for memory (absolute like 200Mi or percentage like 7%).","type":"string","default":"7%"},"evictionSoftMemory":{"description":"Soft eviction threshold for memory (absolute like 1Gi or percentage like 10%).","type":"string","default":"10%"},"kubeReservedCpu":{"description":"CPU reserved for kubelet and container runtime. When empty, 5% of the worker's CPU, clamped to 50m..500m.","type":"string"},"kubeReservedMemory":{"description":"Memory reserved for kubelet and container runtime. When empty, 5% of the worker's memory, clamped to 256Mi..1Gi.","type":"string"},"systemReservedCpu":{"description":"CPU reserved for host OS. When empty, 5% of the worker's CPU, clamped to 50m..500m.","type":"string"},"systemReservedMemory":{"description":"Memory reserved for host OS. When empty, 5% of the worker's memory, clamped to 256Mi..1Gi.","type":"string"}}},"logSerialConsole":{"description":"Stream each worker VM's guest serial console into a `guest-console-log` container beside virt-launcher, readable with `kubectl logs`. The only view of a worker that stalls during boot before Talos apid answers, when neither a Node nor a certificate request exists to diagnose from. Two costs the field name does not show. Changing the value rolls the pool, because it is part of the worker VM template whose name is a hash of its content -- including the stuck VM whose console was wanted, so it buys visibility into the next boot rather than the current one. And it overrides the platform's cluster-wide `disableSerialConsoleLog`, set because that container has been seen holding virt-launcher in `PodInitializing` (kubevirt/kubevirt#15989), which would take the pool down rather than explain it -- so check that virt-launcher Pods reach Running after enabling it.","type":"boolean","default":false},"maxUnhealthy":{"description":"Maximum number of unhealthy nodes tolerated in this pool before remediation is paused. The MachineHealthCheck admission webhook accepts either a bare integer (\"0\", \"1\", ...) or a percentage (\"0%\", \"50%\"); bare numeric strings are rejected, so the safer default is a percentage. Drop to \"0%\" once the pool is stable. Watch how a percentage behaves in a small group: the MachineHealthCheck controller scales it against the number of machines the check covers and rounds down, then remediates only while the unhealthy count is at or below that result. At \"50%\" a group of one therefore never remediates, because half of one rounds down to zero, and a group of two remediates one unhealthy machine but not two.","type":"string","default":"50%"},"nodeStartupTimeout":{"description":"Maximum time a Machine is allowed to spend reaching the Ready condition before it is remediated. Raise for slow first boots (the Talos image import from the Image Factory, or a storage class slow to provision or clone the worker disk). The MachineHealthCheck measures it from the later of the Machine's creation and its InfrastructureReady transition, so the clock restarts when the infrastructure reports ready: a worker gets this long for the disk image import and the VM to come up, and then this long again for the guest to boot and its kubelet to register with the tenant apiserver. Either leg stretches on a host under load, and a Machine remediated here is deleted before it ever joins, so its replacement starts the same sequence from the beginning.","type":"string","default":"20m","pattern":"^(0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+)$"},"readyUnknownTimeout":{"description":"How long a worker Node may report `Ready=Unknown` before the MachineHealthCheck remediates the Machine, which for a KubeVirt worker means deleting the VM. `Ready=Unknown` is what the node lifecycle controller writes once it stops hearing from a kubelet, on a grace period of its own, so the wall clock from a guest going quiet to a deleted worker is this value plus that grace period. A guest starved of CPU stops answering long before it is dead, so a value of a few tens of seconds deletes workers that would have come back on their own. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips.","type":"string","default":"5m"},"readyFalseTimeout":{"description":"How long a worker Node may report `Ready=False` before the MachineHealthCheck remediates the Machine. A Node that has registered but has no working CNI yet reports `Ready=False`, so this value is the whole budget a first boot gets for the CNI rollout to reach that node, and a worker deleted mid-rollout takes the rollout with it while its replacement starts over. Raising it delays replacing a worker that is genuinely dead, but not rescheduling its workload: Pods leave an unreachable Node on the node lifecycle controller's taint-based eviction and the toleration that carries, not on this timer. Validated at render time like maxNodeProvisionTime: the CAPI webhook does not check these timeouts, and a zero or negative value would remediate the moment the condition flips.","type":"string","default":"10m"},"maxNodeProvisionTime":{"description":"How long the cluster-autoscaler waits for a newly created worker to register as a Node before it treats that machine as long-unregistered. Rendered onto this pool's MachineDeployment as the `cluster.x-k8s.io/autoscaling-options-maxnodeprovisiontime` annotation, which overrides the autoscaler's built-in default for this pool only. Two things change when the timer fires, and both make a slow join worse rather than better: the machine stops counting towards the pool's upcoming capacity, so the autoscaler asks for a replacement for capacity that is already on its way, and the machine becomes eligible for removal. Size it above the slowest join a healthy worker can take, counting the Talos image import, the guest boot and the CNI rollout. Accepted as a whole number of seconds, minutes or hours (\"30m\", \"1h30m\"), which is narrower than Go's duration syntax on purpose: the autoscaler ignores a value it cannot parse and falls back to its own default without failing, and the narrower shape cannot express a value that overflows the parser or a fraction it rounds to zero. The canonical form a duration serializes back to (\"20m0s\", \"1h0m0s\") is accepted.","type":"string","default":"30m"},"version":{"description":"Kubernetes major.minor version the pool joins. Must not be ahead of the parent cluster's minor (workers may not lead the apiserver); it may lag behind during a rolling upgrade -- bump the parent Kubernetes CR first, then each pool. The render fails when it is ahead. Its pairing with the Talos release the pool resolves (`talos.version`, or the `osImage` override) is checked against the chart's Talos<->Kubernetes support matrix: for a Talos minor the matrix lists, a Kubernetes minor outside that minor's list is refused; a Talos minor the matrix does not list is not checked.","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"osImage":{"description":"Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. The object is atomic: its two sources exclude each other, so a value that sets one of them replaces the whole object and is never completed from a default.","type":"object","default":{},"properties":{"builtin":{"description":"Clone a golden image from the worker image catalog. Requires a StorageClass whose volumes are reachable from any node, in practice a replicated/DRBD class: the clone is a storage-layer copy, and on a node-pinned class its two ends land on unrelated nodes -- the golden binds where CDI imported it, a worker disk where its VM is scheduled.","type":"object","properties":{"schematicID":{"description":"Talos schematic ID of the golden to clone. Defaults to `talos.schematicID`.","type":"string"},"version":{"description":"Talos version of the golden to clone. Defaults to `talos.version`.","type":"string"}}},"factory":{"description":"Import from an Image Factory / mirror (default).","type":"object","properties":{"imageFactoryURL":{"description":"Base URL of the Image Factory serving the boot raw image. Defaults to `talos.imageFactoryURL`. No trailing slash. This redirects only the worker boot-disk import; the installer image in the worker machine config is always sourced from `talos.installerRepository`, so an air-gapped pool must also have `talos.installerRepository` pointed at a reachable registry.","type":"string"},"schematicID":{"description":"Talos schematic ID. Defaults to `talos.schematicID`.","type":"string"},"version":{"description":"Talos version. Defaults to `talos.version`.","type":"string"}}}},"x-kubernetes-map-type":"atomic"},"talos":{"description":"Talos worker image configuration for this pool.","type":"object","default":{},"required":["imageFactoryURL","installerRepository","registryMirrors","schematicID","version"],"properties":{"imageFactoryCA":{"description":"Complete PEM certificate block(s) CDI must trust when importing this pool's worker OS disk image over HTTPS — the no-osImage default and `osImage.factory` path. Empty by default, so the importer uses only its system trust store, which is what the public factory needs. Set this when the factory in use (`imageFactoryURL` or `osImage.factory.imageFactoryURL`) is a self-hosted factory or mirror served by an internal CA, which the importer otherwise rejects with `x509: certificate signed by unknown authority`. The chart renders it into a ConfigMap in the release namespace — CDI requires certConfigMap to sit alongside the DataVolume — and references that from the worker DataVolume's `source.http.certConfigMap`; CDI appends it to the system pool rather than replacing it, so a publicly-trusted endpoint verifies either way. A pool on `osImage.builtin` clones a golden image and builds no HTTP source, so this field has no effect there. On `substrate: proxmox` it has no effect on the workers either: the ConfigMap is still rendered, but nothing references it.","type":"string","default":""},"imageFactoryURL":{"description":"Default base URL of the Talos Image Factory that serves the worker OS disk image (the `openstack-amd64.raw.xz` raw artifact streamed in by CDI over HTTP). Applies only when this pool imports over HTTP — the default and `osImage.factory`, which overrides it via `osImage.factory.imageFactoryURL`. A pool on `osImage.builtin` clones a golden image from the worker image catalog and does not use this field at all. Defaults to the public factory. Point at a self-hosted Image Factory, a caching mirror, or an internal HTTP file server for air-gapped, rate-limited, or flaky-egress environments. No trailing slash. It is interpolated into the worker DataVolume source URL, so on those HTTP paths it must be a plain `http(s)` URL and the render refuses anything else; a pool on `osImage.builtin` builds no such URL and is not held to it, so blanking this field there is legal. On `substrate: proxmox` the workers clone a VM template that already carries the OS, so this field has no effect there beyond that format check.","type":"string","default":"https://factory.talos.dev"},"installerRepository":{"description":"OCI repository prefix for the Talos installer image, written into the worker machine config as `machine.install.image`. Resolved as `/:` against whatever this pool's `osImage` pins, falling back to `talos.schematicID` and `talos.version` — so the installer matches the OS the pool actually booted. The prefix itself has no `osImage.*` override, so an air-gapped pool needs it pointed at a reachable registry as well. Defaults to the public factory's installer path. Override for air-gapped or mirrored registries. No trailing slash.","type":"string","default":"factory.talos.dev/installer","pattern":"^([A-Za-z0-9]|\\[[0-9A-Fa-f:.]+\\])[-A-Za-z0-9._:/@]*$"},"registryMirrors":{"description":"Talos `machine.registries.mirrors` passthrough for worker nodes: a map of upstream registry host to `{ endpoints: [ ... ] }`. Empty by default, so workers pull container images (the Talos `kubelet` image included) directly from the upstream registry. Point a host such as `ghcr.io` at an in-cluster pull-through mirror for air-gapped, rate-limited, or flaky-egress environments so a worker's boot does not depend on live public egress. Talos still falls back to the upstream registry unless a host also sets `skipFallback: true`, so a mirror alone does not enforce air-gap. This value is part of the worker machine config, whose content hash names the TalosConfigTemplate, so changing it rolls every existing worker in the pool rather than only affecting nodes created later.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"schematicID":{"description":"Talos image-factory schematic ID. Defaults to the cozystack-tested vanilla schematic. Operators using custom schematics (system extensions, kernel args) override here. The pool can pin its own via `osImage.builtin.schematicID` or `osImage.factory.schematicID`; when `osImage` omits it, this value applies. Whichever of the two applies is interpolated into an image URL and a DataVolume name, so it must be a plain lowercase alphanumeric identifier -- the render refuses anything else. A custom schematic on `osImage.builtin` also needs its own catalog entry, since the golden is named from the schematic ID.","type":"string","default":"ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515"},"sysctls":{"description":"Sysctl overrides rendered into Talos `machine.sysctls` on this pool's guest workers only. Values must be strings (quote numeric values); for example, `user.max_user_namespaces: \"11255\"` enables the user namespaces required by the Talos gVisor extension. An empty map preserves Talos defaults and the existing bootstrap hash. Adding, changing or removing an override changes the content-hashed TalosConfigTemplate and rolls the pool's workers. Supported names and values depend on the worker's Talos release and kernel; unsafe settings can weaken guest isolation or prevent workers from booting. This does not install gVisor or configure a RuntimeClass, and does not change the management hosts, control plane or other pools.","type":"object","default":{},"additionalProperties":{"type":"string"}},"version":{"description":"Default Talos release for this pool's worker OS image and for the installer image written into the worker machine config. The pool can pin its own release via `osImage.builtin.version` or `osImage.factory.version`; when `osImage` omits it, this value applies. Both ways in are checked against the chart's Talos<->Kubernetes support matrix, against whichever release the pool actually resolves to, so an override cannot slip past a check `talos.version` would have failed. The matrix lists, for each Talos minor the chart knows, the Kubernetes minors it supports and refuses a pool `version` outside that list; a Talos minor it does not list passes unchecked, so pointing either field at a Talos release the chart does not know about is the operator's call, not a checked one. Whichever release applies is interpolated into an image URL and a DataVolume name, so it must be a full `vMAJOR.MINOR.PATCH` release, optionally with a pre-release suffix -- the render refuses anything else, a minor-only `v1.13` included. The values schema types this as a bare string, so a malformed one is accepted by the CR and fails the pool's HelmRelease instead.","type":"string","default":"v1.13.12"}}},"substrate":{"description":"Which infrastructure provider backs this pool's worker VMs. `kubevirt` runs them inside this cluster on KubeVirt, sized by `instanceType` and booted from a Talos disk image CDI streams from the image factory. `proxmox` runs them on an external Proxmox VE cluster through capmox, sized by `resources`, and cloned from a Talos VM template that already exists on the hypervisor. The two substrates take different Talos platform images and different sizing inputs, so switching an existing pool is refused: the chart reads the live MachineDeployment's template kind and fails the render rather than rolling every worker to the other hypervisor and deleting the template the draining MachineSet still references. Create a new pool on the other substrate and scale this one down.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["network"],"properties":{"dnsServers":{"description":"Nameservers written into the worker machineconfig. On kubevirt the workers use the management cluster's CoreDNS, which they reach over the pod network; an off-cluster Proxmox worker cannot, so it needs reachable resolvers of its own. Required when `substrate` is `proxmox`. Keep in sync with the parent kubernetes chart's `proxmox.dnsServers`.","type":"array","default":[],"items":{"type":"string"}},"full":{"description":"Full clone rather than linked. Default is a linked clone: it costs kilobytes at creation instead of the whole disk, because a ZFS-backed linked clone writes only its own increment (measured: 8K against 10.2G for the same worker full-cloned onto a `sparse 0` pool). The cost is that the clone holds the template's base snapshot, so the template cannot be rotated while any linked clone still references it — which is what the consolidation CronJob resolves 24h after creation. Set true for a pool that must be independent of the template from the first second.","type":"boolean","default":false},"network":{"description":"NIC configuration.","type":"object","default":{},"required":["bridge"],"properties":{"bridge":{"description":"Proxmox bridge the VM NIC attaches to (e.g. `vmbr0`). Required when `substrate` is `proxmox`.","type":"string","default":""},"mtu":{"description":"NIC MTU. Omitted when unset.","type":"integer"},"vlan":{"description":"L2 VLAN tag. Omitted when unset.","type":"integer"}}},"pool":{"description":"Proxmox resource pool the worker VMs are added to. Set the same pool on every node pool of a tenant cluster and grant the tenant's tokens their privileges on `/pool/`: that is the one ACL path that follows every VM capmox creates, replacements included. The pool must exist on the hypervisor; capmox does not create it. Empty adds the workers to no pool.","type":"string","default":""},"storage":{"description":"Proxmox storage for the cloned disk; needs `full: true`. A target storage is a full-clone parameter — a linked clone always lives on the template's storage, and Proxmox refuses the pair — so the render refuses it too. Empty keeps the template's storage.","type":"string","default":""},"templateTags":{"description":"Tags identifying the Talos VM template to clone. capmox matches a template when its tag set is EQUAL to this list, not when it contains it, so every tag on the template must be listed here — a missing one yields `found 0 VM templates with tags ...` while the tags are plainly present. The template has to carry this pool's `talos.schematicID` at `talos.version` in the nocloud flavour, with the Proxmox guest agent enabled for the `qemu-guest-agent` extension of the default schematic; `hack/proxmox-talos-template.sh` builds it from these values and prints the tags to list here. That script tags the template `talos-`, and the render refuses a `talos-vX.Y.Z` tag other than `talos-`, because the template is the boot disk while `talos.version` reaches only the installer, so a pool left on the previous release's tags would roll its workers onto the old kernel. Do not build it from the platform release's `nocloud-amd64.raw.xz`: that is the bare-metal node image, whose `zfs` extension keeps a VM from finishing its boot sequence and reboots it at the Talos boot timeout. Required when `substrate` is `proxmox`.","type":"array","default":[],"items":{"type":"string"}}}}}} release: labels: sharding.fluxcd.io/key: tenants diff --git a/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml b/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml index ec0b8453d..52a6b5a50 100644 --- a/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml +++ b/packages/system/kubernetes-rd/cozyrds/kubernetes.yaml @@ -32,7 +32,7 @@ spec: singular: kubernetes plural: kuberneteses openAPISchema: |- - {"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Cluster name. Each worker pool is a KubernetesNodes release named `kubernetes-nodes--`, which has to fit the 53-character Helm release name limit, so a cluster name of at most 32 characters leaves at least three characters for the pool name.","maxLength":32},"properties":{"storageClass":{"description":"Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name.","type":"string","default":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"Kubernetes major.minor version to deploy","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"host":{"description":"External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty.","type":"string","default":""},"substrate":{"description":"Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"network":{"description":"Runs the whole cluster inside a cozyplane VPC: the control plane, its etcd, and, through the same value on each KubernetesNodes pool, the worker VMs. Set it when the cluster is created; it cannot be changed afterwards. Requires the cozyplane networking variant, `substrate: kubevirt` and the cluster's own etcd.","type":"object","default":{},"properties":{"name":{"description":"Name of the VirtualPrivateCloud (without the \"virtualprivatecloud-\" prefix) in this namespace","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["ipv4Config"],"properties":{"allowedNodes":{"description":"Proxmox nodes capmox may place VMs on. Empty means every node in the Proxmox cluster.","type":"array","default":[],"items":{"type":"string"}},"ccm":{"description":"Proxmox cloud-controller-manager settings.","type":"object","default":{},"required":["credentialsSecretName"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks.","type":"string","default":""}}},"csi":{"description":"Proxmox CSI driver settings.","type":"object","default":{},"required":["credentialsSecretName","enabled"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs.","type":"string","default":""},"enabled":{"description":"Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all.","type":"boolean","default":true},"storageClasses":{"description":"StorageClasses to create in the tenant.","type":"array","default":[],"items":{"type":"object","required":["name","storage"],"properties":{"fstype":{"description":"Filesystem the driver formats volumes with: ext4 or xfs.","type":"string"},"name":{"description":"StorageClass name inside the tenant cluster.","type":"string"},"reclaimPolicy":{"description":"Delete or Retain.","type":"string"},"ssd":{"description":"Mark volumes as SSD-backed, which changes the discard/cache defaults Proxmox applies.","type":"boolean"},"storage":{"description":"Proxmox storage id the volumes are created on (as it appears in `pvesm status`).","type":"string"}}}}}},"dnsServers":{"description":"Nameservers written into each worker's network config. Required by the ProxmoxCluster schema.","type":"array","default":[],"items":{"type":"string"}},"insecure":{"description":"Skip verification of the Proxmox API server certificate in the CCM and the CSI controller, both of which run in the management cluster. Default false: the certificate is verified unless an operator turns that off. A stock Proxmox VE install serves a self-signed one, so set true for it, or install a certificate the management cluster trusts.","type":"boolean","default":false},"ipv4Config":{"description":"Address pool for workers. capmox assigns static addresses and has no DHCP mode, so this is required rather than optional.","type":"object","default":{},"required":["gateway","prefix"],"properties":{"addresses":{"description":"Ranges or CIDRs, e.g. `[\"10.0.0.120-10.0.0.170\"]`. capmox turns these into an InClusterIPPool, so they must not overlap any DHCP range on the same L2 or two workers will answer to one address.","type":"array","default":[],"items":{"type":"string"}},"gateway":{"description":"Default gateway for the workers.","type":"string","default":""},"prefix":{"description":"Netmask prefix length.","type":"integer","default":24}}}}},"addons":{"description":"Cluster addons configuration.","type":"object","default":{},"required":["certManager","cilium","coredns","gatewayAPI","gpuOperator","hami","ingressNginx","monitoringAgents","ouroboros","velero","verticalPodAutoscaler"],"properties":{"certManager":{"description":"Cert-manager addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable cert-manager.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"cilium":{"description":"Cilium CNI plugin. Always installed as the tenant cluster's CNI; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"coredns":{"description":"CoreDNS addon. Always installed as the tenant cluster's DNS; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"gatewayAPI":{"description":"Gateway API addon.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable Gateway API.","type":"boolean","default":false}}},"gpuOperator":{"description":"NVIDIA GPU Operator.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable GPU Operator.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"hami":{"description":"HAMi GPU virtualization middleware.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable HAMi (requires GPU Operator).","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ingressNginx":{"description":"Ingress-NGINX controller.","type":"object","default":{},"required":["enabled","exposeMethod","valuesOverride"],"properties":{"enabled":{"description":"Enable the controller (requires nodes labeled `ingress-nginx`).","type":"boolean","default":false},"exposeMethod":{"description":"Method to expose the controller. Allowed values: `Proxied`, `LoadBalancer`.","type":"string","default":"Proxied","enum":["Proxied","LoadBalancer"]},"hosts":{"description":"Domains routed to this tenant cluster when `exposeMethod` is `Proxied`.","type":"array","default":[],"items":{"type":"string"}},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"monitoringAgents":{"description":"Monitoring agents.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable monitoring agents.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ouroboros":{"description":"Hairpin-NAT fix for ingress-nginx with PROXY-protocol.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable ouroboros. Requires addons.ingressNginx.enabled (chart-render fail otherwise). Only useful when PROXY-protocol is wired on the tenant ingress-nginx via valuesOverride.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides. Operator-key wins over cozystack defaults.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"velero":{"description":"Velero backup/restore addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable Velero.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"verticalPodAutoscaler":{"description":"Vertical Pod Autoscaler. Installed and removed together with addons.monitoringAgents.enabled; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true}}},"controlPlane":{"description":"Kubernetes control-plane configuration.","type":"object","default":{},"required":["apiServer","controllerManager","konnectivity","replicas","scheduler"],"properties":{"apiServer":{"description":"API Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"admissionControllers":{"description":"Admission plugins the tenant kube-apiserver enables, passed through to KamajiControlPlane `spec.admissionControllers`, which the control plane renders as `--enable-admission-plugins`. A non-empty list replaces the control plane's default set instead of adding to it. The kube-apiserver enables these plugins in addition to its own default ones, so leaving a plugin out does not turn it off; to turn one off, name it in `--disable-admission-plugins` in `controlPlane.apiServer.extraArgs` and keep it out of this list, since the apiserver refuses to start with a plugin in both, and the control plane's default set names several. Empty by default, which keeps that default set, taken from the TenantControlPlane CRD: CertificateApproval, CertificateSigning, CertificateSubjectRestriction, DefaultIngressClass, DefaultStorageClass, DefaultTolerationSeconds, LimitRanger, MutatingAdmissionWebhook, NamespaceLifecycle, PersistentVolumeClaimResize, Priority, ResourceQuota, RuntimeClass, ServiceAccount, StorageObjectInUseProtection, TaintNodesByCondition, ValidatingAdmissionWebhook. `NodeRestriction` is not in it.","type":"array","default":[],"items":{"type":"string","enum":["AlwaysAdmit","AlwaysDeny","AlwaysPullImages","CertificateApproval","CertificateSigning","CertificateSubjectRestriction","DefaultIngressClass","DefaultStorageClass","DefaultTolerationSeconds","DenyEscalatingExec","DenyExecOnPrivileged","DenyServiceExternalIPs","EventRateLimit","ExtendedResourceToleration","ImagePolicyWebhook","LimitPodHardAntiAffinityTopology","LimitRanger","MutatingAdmissionWebhook","NamespaceAutoProvision","NamespaceExists","NamespaceLifecycle","NodeRestriction","OwnerReferencesPermissionEnforcement","PersistentVolumeClaimResize","PersistentVolumeLabel","PodNodeSelector","PodSecurity","PodSecurityPolicy","PodTolerationRestriction","Priority","ResourceQuota","RuntimeClass","SecurityContextDeny","ServiceAccount","StorageObjectInUseProtection","TaintNodesByCondition","ValidatingAdmissionWebhook"]}},"extraArgs":{"description":"Extra command-line flags appended to the tenant kube-apiserver, passed through to KamajiControlPlane `spec.apiServer.extraArgs`. For OIDC use `spec.oidc.mode` — this passthrough is the escape hatch for unrelated apiserver flags. The tenant control plane sets each of the following flags itself and drops an entry naming one before the apiserver sees it. The chart moves an `--enable-admission-plugins=` entry into `controlPlane.apiServer.admissionControllers` and a `--kubelet-preferred-address-types=` entry into `controlPlane.kubelet.preferredAddressTypes` while that field is empty, and refuses any other entry naming one of them: `--advertise-address`, `--client-ca-file`, `--enable-admission-plugins`, `--service-cluster-ip-range`, `--kubelet-client-certificate`, `--kubelet-client-key`, `--kubelet-preferred-address-types`, `--proxy-client-cert-file`, `--proxy-client-key-file`, `--requestheader-allowed-names`, `--requestheader-client-ca-file`, `--secure-port`, `--service-account-key-file`, `--service-account-signing-key-file`, `--tls-cert-file`, `--tls-private-key-file`, `--etcd-servers`, `--etcd-cafile`, `--etcd-certfile`, `--etcd-keyfile`, `--etcd-prefix`, `--etcd-compaction-interval`, `--egress-selector-config-file`. When `spec.oidc.mode` is not `None` the chart also renders OIDC flags here, reads what you have written on them, and refuses some combinations outright; the Aggregated API servers section of the Kubernetes OIDC guide on cozystack.io carries which flags, which combinations, and why. Do NOT add legacy `--oidc-*` flags here when `spec.oidc.mode` is not `None`; the chart injects `--authentication-config` and the apiserver refuses to boot with both. Empty by default.","type":"array","default":[],"items":{"type":"string"}},"extraVolumeMounts":{"description":"Extra volume mounts added to the tenant kube-apiserver container, passed through to KamajiControlPlane `spec.apiServer.extraVolumeMounts`. Each `name` must reference a volume declared in `extraVolumes`; the chart-managed talos secret volumes cannot be mounted. Each item is a core/v1 VolumeMount. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"extraVolumes":{"description":"Extra volumes added to the control-plane Deployment, passed through to KamajiControlPlane `spec.deployment.extraVolumes`. Use to mount a ConfigMap or Secret holding an AuthenticationConfiguration file referenced by `extraArgs`. Each item is a core/v1 Volume, but because the control-plane pod runs on the management cluster only `configMap` and `secret` sources are allowed (host-reaching sources like `hostPath`/`csi` and token-projection via `projected` are rejected); each volume must have a unique, non-empty name and exactly one source. The names `talos-ca` and `talos-tls-cert` are reserved by the chart. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"resources":{"description":"CPU and memory resources for API Server.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","type":"string","default":"c1.medium","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"]}}},"controllerManager":{"description":"Controller Manager configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Controller Manager.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}},"konnectivity":{"description":"Konnectivity configuration.","type":"object","default":{},"required":["server"],"properties":{"server":{"description":"Konnectivity Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Konnectivity.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}}}},"kubelet":{"description":"Kubelet connection settings.","type":"object","default":{},"properties":{"preferredAddressTypes":{"description":"Node address types the tenant kube-apiserver tries, in order, when it connects to a kubelet, passed through to KamajiControlPlane `spec.kubelet.preferredAddressTypes`, which the control plane renders as `--kubelet-preferred-address-types`. The KamajiControlPlane CRD rejects a repeated name. Empty by default, which renders `InternalIP`, `ExternalIP`, or the list of a `--kubelet-preferred-address-types=` entry in `controlPlane.apiServer.extraArgs` when there is one.","type":"array","default":[],"items":{"type":"string","enum":["Hostname","InternalIP","ExternalIP","InternalDNS","ExternalDNS"]}}}},"replicas":{"description":"Number of control-plane replicas.","type":"integer","default":2},"scheduler":{"description":"Scheduler configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Scheduler.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}}}},"etcd":{"description":"Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them.","type":"object","default":{},"required":["replicas"],"properties":{"replicas":{"description":"Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it.","type":"integer","default":3,"maximum":3,"minimum":1}}},"oidc":{"description":"OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied AuthenticationConfiguration; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline AuthenticationConfiguration YAML (`apiserver.config.k8s.io/v1beta1`). The chart writes the value verbatim into a Secret mounted at `/etc/kubernetes/authentication-config/config.yaml` on the kube-apiserver. Mutually exclusive with `secretRef.name`.","type":"string","default":""},"secretRef":{"description":"Reference to an existing Secret in the tenant namespace carrying the `AuthenticationConfiguration`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`.","type":"string","default":""}}}},"x-kubernetes-map-type":"atomic"},"mode":{"description":"Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to the tenant cluster; each entry produces one ClusterRoleBinding inside the tenant cluster. Works for both `System` and `CustomConfig` modes.","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. Used verbatim as the `User:` subject in the ClusterRoleBinding inside the tenant cluster. The `email` claim is a built-in OIDC scope requested explicitly by the chart-generated `kubectl oidc-login` kubeconfig; every conformant OIDC provider (cozy realm included) emits it.","type":"string"},"role":{"description":"Role to bind: `admin` maps to `ClusterRole/cluster-admin`, `view` maps to `ClusterRole/view`.","type":"string","enum":["admin","view"]}}}}}},"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","x-cozystack-name":{"type":"string","description":"Cluster name. Each worker pool is a KubernetesNodes release named `kubernetes-nodes--`, which has to fit the 53-character Helm release name limit, so a cluster name of at most 32 characters leaves at least three characters for the pool name.","maxLength":32},"properties":{"storageClass":{"description":"Default StorageClass inside the tenant cluster. Remote-accessible LINSTOR classes are auto-propagated to the tenant under the same name.","type":"string","default":"replicated","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"version":{"description":"Kubernetes major.minor version to deploy","type":"string","default":"v1.35","enum":["v1.35","v1.34","v1.33","v1.32","v1.31"]},"host":{"description":"External hostname for Kubernetes cluster. Defaults to `kubernetes-.` if empty.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"substrate":{"description":"Which infrastructure provider backs this cluster's worker VMs. `kubevirt` runs them inside this cluster; `proxmox` runs them on an external Proxmox VE cluster through capmox. The control plane is Kamaji either way — this selects the infrastructure half only. Every KubernetesNodes pool of this cluster must set the same `substrate`: a pool set to the other one refuses to render once this cluster exists. Switching an existing cluster is not supported; create a new one.","type":"string","default":"kubevirt","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"substrate is immutable"}]},"network":{"description":"Runs the whole cluster inside a cozyplane VPC: the control plane, its etcd, and, through the same value on each KubernetesNodes pool, the worker VMs. Set it when the cluster is created; it cannot be changed afterwards. Requires the cozyplane networking variant, `substrate: kubevirt` and the cluster's own etcd.","type":"object","default":{},"properties":{"name":{"description":"Name of the VirtualPrivateCloud (without the \"virtualprivatecloud-\" prefix) in this namespace","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}},"proxmox":{"description":"Proxmox substrate settings.","type":"object","default":{},"required":["ipv4Config"],"properties":{"allowedNodes":{"description":"Proxmox nodes capmox may place VMs on. Empty means every node in the Proxmox cluster.","type":"array","default":[],"items":{"type":"string"}},"ccm":{"description":"Proxmox cloud-controller-manager settings.","type":"object","default":{},"required":["credentialsSecretName"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the controller's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. May name the same Secret as `csi.credentialsSecretName`; it is a separate knob so the two can hold separate tokens, since this one only reads VM inventory while the driver attaches and detaches disks.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"csi":{"description":"Proxmox CSI driver settings.","type":"object","default":{},"required":["credentialsSecretName","enabled"],"properties":{"credentialsSecretName":{"description":"Secret in THIS namespace holding the driver's Proxmox API credentials under the keys `url`, `token_id`, `token_secret` and `region`. The parent chart composes them into the controller's config file here, in the management cluster; nothing reaches the tenant, and no token is written into a rendered manifest. Distinct from the capmox credentials on purpose: the driver attaches and detaches disks, which is a different blast radius from creating VMs.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"enabled":{"description":"Install the driver. Without it a Proxmox-backed tenant has no way to provision PersistentVolumes at all.","type":"boolean","default":true},"storageClasses":{"description":"StorageClasses to create in the tenant.","type":"array","default":[],"items":{"type":"object","required":["name","storage"],"properties":{"fstype":{"description":"Filesystem the driver formats volumes with: ext4 or xfs.","type":"string"},"name":{"description":"StorageClass name inside the tenant cluster.","type":"string"},"reclaimPolicy":{"description":"Delete or Retain.","type":"string"},"ssd":{"description":"Mark volumes as SSD-backed, which changes the discard/cache defaults Proxmox applies.","type":"boolean"},"storage":{"description":"Proxmox storage id the volumes are created on (as it appears in `pvesm status`).","type":"string"}}}}}},"dnsServers":{"description":"Nameservers written into each worker's network config. Required by the ProxmoxCluster schema.","type":"array","default":[],"items":{"type":"string"}},"insecure":{"description":"Skip verification of the Proxmox API server certificate in the CCM and the CSI controller, both of which run in the management cluster. Default false: the certificate is verified unless an operator turns that off. A stock Proxmox VE install serves a self-signed one, so set true for it, or install a certificate the management cluster trusts.","type":"boolean","default":false},"ipv4Config":{"description":"Address pool for workers. capmox assigns static addresses and has no DHCP mode, so this is required rather than optional.","type":"object","default":{},"required":["gateway","prefix"],"properties":{"addresses":{"description":"Ranges or CIDRs, e.g. `[\"10.0.0.120-10.0.0.170\"]`. capmox turns these into an InClusterIPPool, so they must not overlap any DHCP range on the same L2 or two workers will answer to one address.","type":"array","default":[],"items":{"type":"string"}},"gateway":{"description":"Default gateway for the workers.","type":"string","default":""},"prefix":{"description":"Netmask prefix length.","type":"integer","default":24}}}}},"addons":{"description":"Cluster addons configuration.","type":"object","default":{},"required":["certManager","cilium","coredns","gatewayAPI","gpuOperator","hami","ingressNginx","monitoringAgents","ouroboros","velero","verticalPodAutoscaler"],"properties":{"certManager":{"description":"Cert-manager addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable cert-manager.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"cilium":{"description":"Cilium CNI plugin. Always installed as the tenant cluster's CNI; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"coredns":{"description":"CoreDNS addon. Always installed as the tenant cluster's DNS; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true},"gatewayAPI":{"description":"Gateway API addon.","type":"object","default":{},"required":["enabled"],"properties":{"enabled":{"description":"Enable Gateway API.","type":"boolean","default":false}}},"gpuOperator":{"description":"NVIDIA GPU Operator.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable GPU Operator.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"hami":{"description":"HAMi GPU virtualization middleware.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable HAMi (requires GPU Operator).","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ingressNginx":{"description":"Ingress-NGINX controller.","type":"object","default":{},"required":["enabled","exposeMethod","valuesOverride"],"properties":{"enabled":{"description":"Enable the controller (requires nodes labeled `ingress-nginx`).","type":"boolean","default":false},"exposeMethod":{"description":"Method to expose the controller. Allowed values: `Proxied`, `LoadBalancer`.","type":"string","default":"Proxied","enum":["Proxied","LoadBalancer"]},"hosts":{"description":"Domains routed to this tenant cluster when `exposeMethod` is `Proxied`.","type":"array","default":[],"items":{"type":"string"}},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"monitoringAgents":{"description":"Monitoring agents.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable monitoring agents.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"ouroboros":{"description":"Hairpin-NAT fix for ingress-nginx with PROXY-protocol.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable ouroboros. Requires addons.ingressNginx.enabled (chart-render fail otherwise). Only useful when PROXY-protocol is wired on the tenant ingress-nginx via valuesOverride.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides. Operator-key wins over cozystack defaults.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"velero":{"description":"Velero backup/restore addon.","type":"object","default":{},"required":["enabled","valuesOverride"],"properties":{"enabled":{"description":"Enable Velero.","type":"boolean","default":false},"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"verticalPodAutoscaler":{"description":"Vertical Pod Autoscaler. Installed and removed together with addons.monitoringAgents.enabled; this section only overrides its Helm values.","type":"object","default":{},"required":["valuesOverride"],"properties":{"valuesOverride":{"description":"Custom Helm values overrides.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}},"x-cozystack-no-enable-switch":true}}},"controlPlane":{"description":"Kubernetes control-plane configuration.","type":"object","default":{},"required":["apiServer","controllerManager","konnectivity","replicas","scheduler"],"properties":{"apiServer":{"description":"API Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"admissionControllers":{"description":"Admission plugins the tenant kube-apiserver enables, passed through to KamajiControlPlane `spec.admissionControllers`, which the control plane renders as `--enable-admission-plugins`. A non-empty list replaces the control plane's default set instead of adding to it. The kube-apiserver enables these plugins in addition to its own default ones, so leaving a plugin out does not turn it off; to turn one off, name it in `--disable-admission-plugins` in `controlPlane.apiServer.extraArgs` and keep it out of this list, since the apiserver refuses to start with a plugin in both, and the control plane's default set names several. Empty by default, which keeps that default set, taken from the TenantControlPlane CRD: CertificateApproval, CertificateSigning, CertificateSubjectRestriction, DefaultIngressClass, DefaultStorageClass, DefaultTolerationSeconds, LimitRanger, MutatingAdmissionWebhook, NamespaceLifecycle, PersistentVolumeClaimResize, Priority, ResourceQuota, RuntimeClass, ServiceAccount, StorageObjectInUseProtection, TaintNodesByCondition, ValidatingAdmissionWebhook. `NodeRestriction` is not in it.","type":"array","default":[],"items":{"type":"string","enum":["AlwaysAdmit","AlwaysDeny","AlwaysPullImages","CertificateApproval","CertificateSigning","CertificateSubjectRestriction","DefaultIngressClass","DefaultStorageClass","DefaultTolerationSeconds","DenyEscalatingExec","DenyExecOnPrivileged","DenyServiceExternalIPs","EventRateLimit","ExtendedResourceToleration","ImagePolicyWebhook","LimitPodHardAntiAffinityTopology","LimitRanger","MutatingAdmissionWebhook","NamespaceAutoProvision","NamespaceExists","NamespaceLifecycle","NodeRestriction","OwnerReferencesPermissionEnforcement","PersistentVolumeClaimResize","PersistentVolumeLabel","PodNodeSelector","PodSecurity","PodSecurityPolicy","PodTolerationRestriction","Priority","ResourceQuota","RuntimeClass","SecurityContextDeny","ServiceAccount","StorageObjectInUseProtection","TaintNodesByCondition","ValidatingAdmissionWebhook"]}},"extraArgs":{"description":"Extra command-line flags appended to the tenant kube-apiserver, passed through to KamajiControlPlane `spec.apiServer.extraArgs`. For OIDC use `spec.oidc.mode` — this passthrough is the escape hatch for unrelated apiserver flags. The tenant control plane sets each of the following flags itself and drops an entry naming one before the apiserver sees it. The chart moves an `--enable-admission-plugins=` entry into `controlPlane.apiServer.admissionControllers` and a `--kubelet-preferred-address-types=` entry into `controlPlane.kubelet.preferredAddressTypes` while that field is empty, and refuses any other entry naming one of them: `--advertise-address`, `--client-ca-file`, `--enable-admission-plugins`, `--service-cluster-ip-range`, `--kubelet-client-certificate`, `--kubelet-client-key`, `--kubelet-preferred-address-types`, `--proxy-client-cert-file`, `--proxy-client-key-file`, `--requestheader-allowed-names`, `--requestheader-client-ca-file`, `--secure-port`, `--service-account-key-file`, `--service-account-signing-key-file`, `--tls-cert-file`, `--tls-private-key-file`, `--etcd-servers`, `--etcd-cafile`, `--etcd-certfile`, `--etcd-keyfile`, `--etcd-prefix`, `--etcd-compaction-interval`, `--egress-selector-config-file`. When `spec.oidc.mode` is not `None` the chart also renders OIDC flags here, reads what you have written on them, and refuses some combinations outright; the Aggregated API servers section of the Kubernetes OIDC guide on cozystack.io carries which flags, which combinations, and why. Do NOT add legacy `--oidc-*` flags here when `spec.oidc.mode` is not `None`; the chart injects `--authentication-config` and the apiserver refuses to boot with both. Empty by default.","type":"array","default":[],"items":{"type":"string"}},"extraVolumeMounts":{"description":"Extra volume mounts added to the tenant kube-apiserver container, passed through to KamajiControlPlane `spec.apiServer.extraVolumeMounts`. Each `name` must reference a volume declared in `extraVolumes`; the chart-managed talos secret volumes cannot be mounted. Each item is a core/v1 VolumeMount. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"extraVolumes":{"description":"Extra volumes added to the control-plane Deployment, passed through to KamajiControlPlane `spec.deployment.extraVolumes`. Use to mount a ConfigMap or Secret holding an AuthenticationConfiguration file referenced by `extraArgs`. Each item is a core/v1 Volume, but because the control-plane pod runs on the management cluster only `configMap` and `secret` sources are allowed (host-reaching sources like `hostPath`/`csi` and token-projection via `projected` are rejected); each volume must have a unique, non-empty name and exactly one source. The names `talos-ca` and `talos-tls-cert` are reserved by the chart. Empty by default.","type":"array","default":[],"items":{"type":"object","x-kubernetes-preserve-unknown-fields":true}},"resources":{"description":"CPU and memory resources for API Server.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","type":"string","default":"c1.medium","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"]}}},"controllerManager":{"description":"Controller Manager configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Controller Manager.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}},"konnectivity":{"description":"Konnectivity configuration.","type":"object","default":{},"required":["server"],"properties":{"server":{"description":"Konnectivity Server configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Konnectivity.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}}}},"kubelet":{"description":"Kubelet connection settings.","type":"object","default":{},"properties":{"preferredAddressTypes":{"description":"Node address types the tenant kube-apiserver tries, in order, when it connects to a kubelet, passed through to KamajiControlPlane `spec.kubelet.preferredAddressTypes`, which the control plane renders as `--kubelet-preferred-address-types`. The KamajiControlPlane CRD rejects a repeated name. Empty by default, which renders `InternalIP`, `ExternalIP`, or the list of a `--kubelet-preferred-address-types=` entry in `controlPlane.apiServer.extraArgs` when there is one.","type":"array","default":[],"items":{"type":"string","enum":["Hostname","InternalIP","ExternalIP","InternalDNS","ExternalDNS"]}}}},"replicas":{"description":"Number of control-plane replicas.","type":"integer","default":2},"scheduler":{"description":"Scheduler configuration.","type":"object","default":{},"required":["resources","resourcesPreset"],"properties":{"resources":{"description":"CPU and memory resources for Scheduler.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available.","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.","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":"Preset if `resources` omitted.","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"]}}}}},"etcd":{"description":"Dedicated etcd for this cluster's control plane, rendered with the cluster and deleted with it. Clusters that already run on their tenant's shared etcd keep it, and this section does not apply to them.","type":"object","default":{},"required":["replicas"],"properties":{"replicas":{"description":"Number of etcd members: `3` keeps quorum through the loss of one member, `1` runs a single member with no failover. Only `1` and `3` are accepted. The StorageClass is picked by the platform for each of the two shapes and fixed when the etcd is first created, so changing the count later keeps the class it started with. For that reason going from 3 members to 1 is refused when the etcd is on the class the platform names for 3 members, or off the class it names for 1: a single member would then hold the only copy of the control-plane state on storage that does not replicate it.","type":"integer","default":3,"maximum":3,"minimum":1}}},"oidc":{"description":"OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied AuthenticationConfiguration; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline AuthenticationConfiguration YAML (`apiserver.config.k8s.io/v1beta1`). The chart writes the value verbatim into a Secret mounted at `/etc/kubernetes/authentication-config/config.yaml` on the kube-apiserver. Mutually exclusive with `secretRef.name`.","type":"string","default":""},"secretRef":{"description":"Reference to an existing Secret in the tenant namespace carrying the `AuthenticationConfiguration`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the tenant (release) namespace whose `config.yaml` key holds an `apiserver.config.k8s.io/v1beta1` `AuthenticationConfiguration`. Mutually exclusive with `customConfig.config`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"x-kubernetes-map-type":"atomic"},"mode":{"description":"Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to the tenant cluster; each entry produces one ClusterRoleBinding inside the tenant cluster. Works for both `System` and `CustomConfig` modes.","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. Used verbatim as the `User:` subject in the ClusterRoleBinding inside the tenant cluster. The `email` claim is a built-in OIDC scope requested explicitly by the chart-generated `kubectl oidc-login` kubeconfig; every conformant OIDC provider (cozy realm included) emits it.","type":"string"},"role":{"description":"Role to bind: `admin` maps to `ClusterRole/cluster-admin`, `view` maps to `ClusterRole/view`.","type":"string","enum":["admin","view"]}}}}}},"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: kubernetes- labels: diff --git a/packages/system/mariadb-rd/cozyrds/mariadb.yaml b/packages/system/mariadb-rd/cozyrds/mariadb.yaml index 6ced54c77..a01ee131f 100644 --- a/packages/system/mariadb-rd/cozyrds/mariadb.yaml +++ b/packages/system/mariadb-rd/cozyrds/mariadb.yaml @@ -8,7 +8,7 @@ spec: plural: mariadbs singular: mariadb openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of MariaDB replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each MariaDB 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.nano","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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Selects who issues the certificates and whether plaintext is refused; TLS itself is always served.","type":"object","default":{},"properties":{"issuer":{"description":"Who issues the server certificate: `operator` uses the CA mariadb-operator manages itself, `cert-manager` gives the instance its own CA and is what covers the external hostname. Named for the issuer because TLS is served under both, unlike the similarly-spelled `tls.enabled` in some other charts, which does switch TLS on and off.","type":"string","default":"operator","enum":["operator","cert-manager"]},"required":{"description":"Refuse plaintext connections (sets MariaDB require_secure_transport=ON). Applies under either issuer. Opt-in: turn it on once every client connects over TLS, since it disconnects those that do not.","type":"boolean"}}},"version":{"description":"MariaDB major.minor version to deploy","type":"string","default":"v11.8","enum":["v11.8","v11.4","v10.11","v10.6"]},"users":{"description":"Users configuration map. Each user is a MariaDB account the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once and stores only its `mysql_native_password` hash, and a revoke retires the password without issuing one. A `password` key here is ignored and draws an admission warning. A password set inside MariaDB is reverted by the operator. `root` is the platform's own account: a `root` entry here is ignored, and its password is not readable by tenants.","type":"object","default":{},"additionalProperties":{"type":"object","required":["maxUserConnections"],"properties":{"maxUserConnections":{"description":"Maximum number of connections.","type":"integer"}}}},"databases":{"description":"Databases configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"DEPRECATED: Backup configuration. Prefer the BackupClass / Plan flow under examples/backups/mariadb/.","type":"object","default":{},"required":["cleanupStrategy","enabled","resticPassword","s3AccessKey","s3Bucket","s3Region","s3SecretKey","schedule"],"properties":{"cleanupStrategy":{"description":"DEPRECATED: Retention strategy for cleaning up old backups.","type":"string","default":"--keep-last=3 --keep-daily=3 --keep-within-weekly=1m"},"enabled":{"description":"DEPRECATED: Enable regular backups (default: false).","type":"boolean","default":false},"resticPassword":{"description":"DEPRECATED: Password for Restic backup encryption.","type":"string","default":""},"s3AccessKey":{"description":"DEPRECATED: Access key for S3 authentication.","type":"string","default":""},"s3Bucket":{"description":"DEPRECATED: S3 bucket used for storing backups.","type":"string","default":"s3.example.org/mariadb-backups"},"s3Region":{"description":"DEPRECATED: AWS S3 region where backups are stored.","type":"string","default":"us-east-1"},"s3SecretKey":{"description":"DEPRECATED: Secret key for S3 authentication.","type":"string","default":""},"schedule":{"description":"DEPRECATED: Cron schedule for automated backups.","type":"string","default":"0 2 * * *"}}},"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 MariaDB replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each MariaDB 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.nano","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Selects who issues the certificates and whether plaintext is refused; TLS itself is always served.","type":"object","default":{},"properties":{"issuer":{"description":"Who issues the server certificate: `operator` uses the CA mariadb-operator manages itself, `cert-manager` gives the instance its own CA and is what covers the external hostname. Named for the issuer because TLS is served under both, unlike the similarly-spelled `tls.enabled` in some other charts, which does switch TLS on and off.","type":"string","default":"operator","enum":["operator","cert-manager"]},"required":{"description":"Refuse plaintext connections (sets MariaDB require_secure_transport=ON). Applies under either issuer. Opt-in: turn it on once every client connects over TLS, since it disconnects those that do not.","type":"boolean"}}},"version":{"description":"MariaDB major.minor version to deploy","type":"string","default":"v11.8","enum":["v11.8","v11.4","v10.11","v10.6"]},"users":{"description":"Users configuration map. Each user is a MariaDB account the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once and stores only its `mysql_native_password` hash, and a revoke retires the password without issuing one. A `password` key here is ignored and draws an admission warning. A password set inside MariaDB is reverted by the operator. `root` is the platform's own account: a `root` entry here is ignored, and its password is not readable by tenants.","type":"object","default":{},"additionalProperties":{"type":"object","required":["maxUserConnections"],"properties":{"maxUserConnections":{"description":"Maximum number of connections.","type":"integer"}}}},"databases":{"description":"Databases configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"DEPRECATED: Backup configuration. Prefer the BackupClass / Plan flow under examples/backups/mariadb/.","type":"object","default":{},"required":["cleanupStrategy","enabled","resticPassword","s3AccessKey","s3Bucket","s3Region","s3SecretKey","schedule"],"properties":{"cleanupStrategy":{"description":"DEPRECATED: Retention strategy for cleaning up old backups.","type":"string","default":"--keep-last=3 --keep-daily=3 --keep-within-weekly=1m","pattern":"^( *(--keep-(last|hourly|daily|weekly|monthly|yearly|tag|within|within-hourly|within-daily|within-weekly|within-monthly|within-yearly)(=| +)|-[lHdwmy](=| *))[A-Za-z0-9:_,./-]+)* *$"},"enabled":{"description":"DEPRECATED: Enable regular backups (default: false).","type":"boolean","default":false},"resticPassword":{"description":"DEPRECATED: Password for Restic backup encryption.","type":"string","default":""},"s3AccessKey":{"description":"DEPRECATED: Access key for S3 authentication.","type":"string","default":""},"s3Bucket":{"description":"DEPRECATED: S3 bucket used for storing backups.","type":"string","default":"s3.example.org/mariadb-backups","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"s3Region":{"description":"DEPRECATED: AWS S3 region where backups are stored.","type":"string","default":"us-east-1","pattern":"^[A-Za-z0-9_.-]*$"},"s3SecretKey":{"description":"DEPRECATED: Secret key for S3 authentication.","type":"string","default":""},"schedule":{"description":"DEPRECATED: Cron schedule for automated backups.","type":"string","default":"0 2 * * *","pattern":"^[-0-9A-Za-z*/,@? ]*$"}}},"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: mariadb- labels: diff --git a/packages/system/mongodb-rd/cozyrds/mongodb.yaml b/packages/system/mongodb-rd/cozyrds/mongodb.yaml index 4c4da37e7..0da05dfc1 100644 --- a/packages/system/mongodb-rd/cozyrds/mongodb.yaml +++ b/packages/system/mongodb-rd/cozyrds/mongodb.yaml @@ -8,7 +8,7 @@ spec: singular: mongodb plural: mongodbs openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of MongoDB replicas in replica set.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each MongoDB 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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"version":{"description":"MongoDB major version to deploy.","type":"string","default":"v8","enum":["v8","v7","v6"]},"sharding":{"description":"Enable sharded cluster mode. When disabled, deploys a replica set.","type":"boolean","default":false},"shardingConfig":{"description":"Configuration for sharded cluster mode.","type":"object","default":{},"required":["configServerSize","configServers","mongos"],"properties":{"configServerSize":{"description":"PVC size for config servers.","default":"3Gi","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},"configServers":{"description":"Number of config server replicas.","type":"integer","default":3},"mongos":{"description":"Number of mongos router replicas.","type":"integer","default":2},"shards":{"description":"List of shard configurations.","type":"array","default":[{"name":"rs0","replicas":3,"size":"10Gi"}],"items":{"type":"object","required":["name","replicas","size"],"properties":{"name":{"description":"Shard name.","type":"string"},"replicas":{"description":"Number of replicas in this shard.","type":"integer"},"size":{"description":"PVC size for this shard.","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}}}}}},"users":{"description":"Users configuration map. Each user is a MongoDB user the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once, and a revoke retires the password without issuing one. A `password` key here is ignored. The names of the MongoDB system users (`backup`, `clusterAdmin`, `clusterMonitor`, `databaseAdmin`, `userAdmin`) are refused.","type":"object","default":{},"additionalProperties":{"type":"object"}},"databases":{"description":"Databases configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges (readWrite + dbAdmin).","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"destinationPath":{"description":"Destination path for backups (e.g. s3://bucket/path/). Ignored when useSystemBucket is true (the driver injects the platform bucket).","type":"string","default":"s3://bucket/path/to/folder/"},"enabled":{"description":"Enable regular backups.","type":"boolean","default":false},"endpointURL":{"description":"S3 endpoint URL for uploads. Ignored when useSystemBucket is true (the strategy supplies the platform endpoint).","type":"string","default":"http://minio-gateway-service:9000"},"insecureSkipTLSVerify":{"description":"Skip TLS verification for the S3 endpoint (self-signed, e.g. in-cluster seaweedfs). Ignored when useSystemBucket is true (the platform backupStorage knob applies instead).","type":"boolean","default":false},"retentionPolicy":{"description":"Retention policy (e.g. \"30d\"). Ignored when useSystemBucket is true (no engine-side retention on that flow).","type":"string","default":"30d"},"s3AccessKey":{"description":"Access key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds).","type":"string","default":""},"s3SecretKey":{"description":"Secret key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds).","type":"string","default":""},"schedule":{"description":"Cron schedule for automated backups. Ignored when useSystemBucket is true (scheduling moves to the BackupClass Plan).","type":"string","default":"0 2 * * *"},"useSystemBucket":{"description":"Opt-in: back up to the platform system bucket without supplying S3 credentials. The cozy-default MongoDB BackupClass injects the storage at BackupJob time; tenants do not set s3AccessKey/s3SecretKey/destinationPath/endpointURL, and backups scope to `/`. Scheduling moves to a BackupClass Plan; `schedule`, `retentionPolicy` and PITR are ignored while this is on, and this flow has no retention yet (see https://cozystack.io/docs/v1/operations/services/backup-classes/). Requires `backup.enabled: true` (the pbm agents run on that flag); the chart refuses the combination with `enabled: false` at render time; the schema carries the same rule as a marker for the UI and for the day the apiserver enforces CEL on application schemas (cozystack/cozystack#2657), which it does not yet. A release that has not yet rendered this flag (its cluster still carries the chart's scheduled tasks and PITR) holds a BackupJob until it does, so the tenant's own storage is never injected over.","type":"boolean","default":false}},"x-kubernetes-validations":[{"message":"backup.useSystemBucket requires backup.enabled: the percona-backup-mongodb agents only run when backups are enabled","rule":"!(has(self.useSystemBucket) && self.useSystemBucket) || (has(self.enabled) && self.enabled)"}]},"bootstrap":{"description":"Bootstrap configuration.","type":"object","default":{},"required":["backupName","enabled"],"properties":{"backupName":{"description":"Name of backup to restore from.","type":"string","default":""},"enabled":{"description":"Whether to restore from a backup.","type":"boolean","default":false},"recoveryTime":{"description":"Timestamp for point-in-time recovery; empty means latest.","type":"string","default":""}}},"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 MongoDB replicas in replica set.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each MongoDB 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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"version":{"description":"MongoDB major version to deploy.","type":"string","default":"v8","enum":["v8","v7","v6"]},"sharding":{"description":"Enable sharded cluster mode. When disabled, deploys a replica set.","type":"boolean","default":false},"shardingConfig":{"description":"Configuration for sharded cluster mode.","type":"object","default":{},"required":["configServerSize","configServers","mongos"],"properties":{"configServerSize":{"description":"PVC size for config servers.","default":"3Gi","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},"configServers":{"description":"Number of config server replicas.","type":"integer","default":3},"mongos":{"description":"Number of mongos router replicas.","type":"integer","default":2},"shards":{"description":"List of shard configurations.","type":"array","default":[{"name":"rs0","replicas":3,"size":"10Gi"}],"items":{"type":"object","required":["name","replicas","size"],"properties":{"name":{"description":"Shard name.","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"replicas":{"description":"Number of replicas in this shard.","type":"integer"},"size":{"description":"PVC size for this shard.","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}}}}}},"users":{"description":"Users configuration map. Each user is a MongoDB user the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once, and a revoke retires the password without issuing one. A `password` key here is ignored. The names of the MongoDB system users (`backup`, `clusterAdmin`, `clusterMonitor`, `databaseAdmin`, `userAdmin`) are refused.","type":"object","default":{},"additionalProperties":{"type":"object"}},"databases":{"description":"Databases configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges (readWrite + dbAdmin).","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"destinationPath":{"description":"Destination path for backups (e.g. s3://bucket/path/). Ignored when useSystemBucket is true (the driver injects the platform bucket).","type":"string","default":"s3://bucket/path/to/folder/","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"enabled":{"description":"Enable regular backups.","type":"boolean","default":false},"endpointURL":{"description":"S3 endpoint URL for uploads. Ignored when useSystemBucket is true (the strategy supplies the platform endpoint).","type":"string","default":"http://minio-gateway-service:9000","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"insecureSkipTLSVerify":{"description":"Skip TLS verification for the S3 endpoint (self-signed, e.g. in-cluster seaweedfs). Ignored when useSystemBucket is true (the platform backupStorage knob applies instead).","type":"boolean","default":false},"retentionPolicy":{"description":"Retention policy (e.g. \"30d\"). Ignored when useSystemBucket is true (no engine-side retention on that flow).","type":"string","default":"30d"},"s3AccessKey":{"description":"Access key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds).","type":"string","default":""},"s3SecretKey":{"description":"Secret key for S3 authentication. Ignored when useSystemBucket is true (credentials come from the projected cozy-backups-creds).","type":"string","default":""},"schedule":{"description":"Cron schedule for automated backups. Ignored when useSystemBucket is true (scheduling moves to the BackupClass Plan).","type":"string","default":"0 2 * * *","pattern":"^[-0-9A-Za-z*/,@? ._=]*$"},"useSystemBucket":{"description":"Opt-in: back up to the platform system bucket without supplying S3 credentials. The cozy-default MongoDB BackupClass injects the storage at BackupJob time; tenants do not set s3AccessKey/s3SecretKey/destinationPath/endpointURL, and backups scope to `/`. Scheduling moves to a BackupClass Plan; `schedule`, `retentionPolicy` and PITR are ignored while this is on, and this flow has no retention yet (see https://cozystack.io/docs/v1/operations/services/backup-classes/). Requires `backup.enabled: true` (the pbm agents run on that flag); the chart refuses the combination with `enabled: false` at render time; the schema carries the same rule as a marker for the UI and for the day the apiserver enforces CEL on application schemas (cozystack/cozystack#2657), which it does not yet. A release that has not yet rendered this flag (its cluster still carries the chart's scheduled tasks and PITR) holds a BackupJob until it does, so the tenant's own storage is never injected over.","type":"boolean","default":false}},"x-kubernetes-validations":[{"message":"backup.useSystemBucket requires backup.enabled: the percona-backup-mongodb agents only run when backups are enabled","rule":"!(has(self.useSystemBucket) && self.useSystemBucket) || (has(self.enabled) && self.enabled)"}]},"bootstrap":{"description":"Bootstrap configuration.","type":"object","default":{},"required":["backupName","enabled"],"properties":{"backupName":{"description":"Name of backup to restore from.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"enabled":{"description":"Whether to restore from a backup.","type":"boolean","default":false},"recoveryTime":{"description":"Timestamp for point-in-time recovery; empty means latest.","type":"string","default":"","pattern":"^[0-9TZtz:.+ -]*$"}}},"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: mongodb- labels: diff --git a/packages/system/monitoring-agents/templates/vmagent.yaml b/packages/system/monitoring-agents/templates/vmagent.yaml index 51ed777ca..2d0ea5a20 100644 --- a/packages/system/monitoring-agents/templates/vmagent.yaml +++ b/packages/system/monitoring-agents/templates/vmagent.yaml @@ -9,7 +9,7 @@ metadata: spec: shardCount: 1 externalLabels: - cluster: {{ .Values.vmagent.externalLabels.cluster }} + cluster: {{ .Values.vmagent.externalLabels.cluster | quote }} tenant: {{ .Values.vmagent.externalLabels.tenant | default .Values.global.target | quote }} extraArgs: {{- toYaml (deepCopy .Values.vmagent.extraArgs | mergeOverwrite (fromYaml (include "monitoring-agents.vmagent.defaultExtraArgs" .))) | nindent 4 }} diff --git a/packages/system/monitoring-agents/tests/vmagent_external_labels_test.yaml b/packages/system/monitoring-agents/tests/vmagent_external_labels_test.yaml new file mode 100644 index 000000000..71f17a5fc --- /dev/null +++ b/packages/system/monitoring-agents/tests/vmagent_external_labels_test.yaml @@ -0,0 +1,17 @@ +suite: vmagent external labels +# A label value may be any UTF-8, and the cluster label comes from the tenant's +# values, so it is written as a quoted string rather than validated. +templates: + - templates/vmagent.yaml +tests: + - it: writes a cluster label of any characters as one string + set: + vmagent: + externalLabels: + cluster: "prod: eu/west #1\nextra: field" + asserts: + - isKind: + of: VMAgent + - equal: + path: spec.externalLabels.cluster + value: "prod: eu/west #1\nextra: field" diff --git a/packages/system/monitoring-rd/cozyrds/monitoring.yaml b/packages/system/monitoring-rd/cozyrds/monitoring.yaml index 97e292200..99ad61780 100644 --- a/packages/system/monitoring-rd/cozyrds/monitoring.yaml +++ b/packages/system/monitoring-rd/cozyrds/monitoring.yaml @@ -20,7 +20,7 @@ spec: singular: monitoring plural: monitorings openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host).","type":"string","default":""},"metricsStorages":{"description":"Configuration of metrics storage instances.","type":"array","default":[{"deduplicationInterval":"15s","name":"shortterm","retentionPeriod":"3d","storage":"10Gi","storageClassName":""},{"deduplicationInterval":"5m","name":"longterm","retentionPeriod":"14d","storage":"10Gi","storageClassName":""}],"items":{"type":"object","required":["deduplicationInterval","name","retentionPeriod","storage"],"properties":{"deduplicationInterval":{"description":"Deduplication interval for metrics.","type":"string"},"name":{"description":"Name of the storage instance.","type":"string"},"retentionPeriod":{"description":"Retention period for metrics.","type":"string"},"storage":{"description":"Persistent volume size.","type":"string","default":"10Gi"},"storageClassName":{"description":"StorageClass used for the data.","type":"string"},"vminsert":{"description":"Configuration for vminsert.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"vmselect":{"description":"Configuration for vmselect.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"vmstorage":{"description":"Configuration for vmstorage.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}}}}},"logsStorages":{"description":"Configuration of logs storage instances.","type":"array","default":[{"name":"generic","retentionPeriod":"1","storage":"10Gi","storageClassName":"replicated"}],"items":{"type":"object","required":["name","retentionPeriod","storage","storageClassName"],"properties":{"name":{"description":"Name of the storage instance.","type":"string"},"retentionPeriod":{"description":"Retention period for logs.","type":"string","default":"1"},"storage":{"description":"Persistent volume size.","type":"string","default":"10Gi"},"storageClassName":{"description":"StorageClass used to store the data.","type":"string","default":"replicated"}}}},"tracingStorages":{"description":"Configuration of traces storage instances. Empty by default (tracing off): no backend and no trace collector are rendered. Adding an entry provisions a VictoriaTraces backend and, while tracingCollector.enabled is true, deploys the OTLP collector in front of it. A tenant with shared-central tracing (the Tenant's tracingCentral) gets the collector, while tracingCollector.enabled is true, without an entry, which then exports to the shared store; entries still listed keep their store and datasource, so traces stored before the switch stay readable until the entry is removed.","type":"array","default":[],"items":{"type":"object","required":["mode","name","retentionPeriod","storage","storageClassName"],"properties":{"mode":{"description":"Deployment mode: \"cluster\" renders a VTCluster; \"single\" renders a single-binary VTSingle for edge/dev/small clusters. Treat as immutable once a backend exists: mode selects which Kind is rendered under the same name, so changing it on a running backend re-identifies the object rather than reconfiguring it. Switching from \"single\" to \"cluster\" prunes the VTSingle and the operator garbage-collects its PVC (stored traces are lost); switching from \"cluster\" to \"single\" (or removing the entry) leaves the vtstorage PVCs Bound and billed until the whole Monitoring release is deleted. The API cannot guard this (transition rules are not available on an array-item field), so this note is the only guard: migrate deliberately, accepting the loss.","type":"string","default":"cluster","enum":["cluster","single"]},"name":{"description":"Name of the storage instance: a lowercase RFC 1123 label of at most 42 characters. Treat as immutable once a backend exists: the VTCluster/VTSingle, its Services, PVCs and Grafana datasource are all named after it, so renaming an entry deploys a new, empty backend and removes the old one, the same way changing mode does (single mode loses the old PVC, cluster mode leaves the old vtstorage PVCs Bound until the whole Monitoring release is deleted).","type":"string"},"retentionDiskUsageBytes":{"description":"Optional disk-usage cap as a VictoriaMetrics BytesString (e.g. \"8GB\" or \"8GiB\"), bounding disk use on top of the age-based retentionPeriod. Uses byte-suffix grammar (kb/mb/gb/tb, KiB/MiB/GiB/TiB), NOT the Kubernetes-quantity grammar of the sibling storage field, so \"8Gi\" is rejected by the operator. In cluster mode the cap is per vtstorage replica (replicaCount 2), so the effective total is twice the value. Unset, the store drops its oldest day once its filesystem is 80% full instead, so every store is disk-bounded. Either way VictoriaTraces keeps the last two days, so spans arriving faster than the cap allows for two days can still fill the disk.","type":"string"},"retentionPeriod":{"description":"Retention period for traces.","type":"string","default":"14d"},"storage":{"description":"Persistent volume size.","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},"storageClassName":{"description":"StorageClass used to store the data.","type":"string","default":"replicated"}}}},"tracingCentralHost":{"description":"tenant-root only: accept spans from tenants that turned on shared-central tracing (the Tenant's tracingCentral) into this Monitoring's tracingStorages entry named `generic`, which must be in `cluster` mode. Every central tenant then shares that store's disk and retention with tenant-root, and nothing reserves space per tenant: once the store's disk cap is reached (retentionDiskUsageBytes, or 80% of its filesystem) the oldest spans of all of them are evicted together. Each tenant is held to the platform's monitoring.tracingCentralTenantBytesPerSecond, which by default lets one tenant write at most the cap of a default 10Gi store, counted uncompressed and before the tenant's sampling, over the two days VictoriaTraces always keeps, so raise it with the store; several tenants writing at their limit together still can fill it. That bound holds for a tenant whose collector keeps running: each collector pod starts with a full bucket, up to 5 MiB or one second of its share of the rate when that is larger, and any change to the tenant's Monitoring rolls every collector pod, so a tenant that keeps changing it writes that much more on each rollout, for up to ten replicas; closing that needs a limiter with shared state, which the collector does not run. Ignored outside tenant-root. The tenant-root namespace is inside the trust boundary of the shared store, as it is for the metrics of tenants that rely on a parent's monitoring: vmauth pins each central tenant to its own account, but workloads in tenant-root reach the store directly, and one that learns a tenant's account ID (a hash of its namespace name and UID, which its VMUsers carry) can read and write that account. Whoever tenant-root admits to its Grafana is inside it too, since tenant-root's own datasource for the store reaches vtselect without vmauth; who that is follows its Grafana's oidc mode (with System, tenant-root's own groups, which already hold the same access level in every tenant under tenant-root). The render refuses to stop hosting while central tenants remain, but removing the tenant-root Monitoring altogether is not a render and is not refused: turn tracingCentral off on the central tenants first, since until then every Monitoring render of theirs fails, their metrics, logs and alerting changes included. The refusals read each other's objects when they render, so a tenant turning tracingCentral on while tenant-root stops hosting can pass both: that tenant's collector then exports to a vmauth that is gone while every release reports Ready, until its Monitoring renders again. Recover by hosting again; turning that tenant's tracingCentral off instead ends the silent drop, and turning it on again is then refused until tenant-root hosts.","type":"boolean","default":false},"tracingCollector":{"description":"OpenTelemetry Collector for trace ingestion. With shared-central tracing it refuses spans above the platform's per-tenant write rate: OTLP/HTTP senders retry them, OTLP/gRPC senders drop them, so export over HTTP. It also refuses a request larger than 3 MiB (decompressed) with a 400, which senders do not retry, so keep export batches below that.","type":"object","default":{},"required":["enabled","replicas","samplingPercentage"],"properties":{"enabled":{"description":"Deploy the OTLP collector. When disabled, applications must send OTLP straight to the traces backend (no central sampling/redaction); with shared-central tracing they have no path to it, so no new spans arrive, while the traces already stored stay readable. The collector fronts a single backend, and the limit holds with shared-central tracing too, since turning that off makes it export to the local entry again: while it is enabled, tracingStorages must hold at most one entry, and adding a second one fails the whole Monitoring render until the extra entry is removed or the collector is disabled.","type":"boolean","default":true},"redactAttributes":{"description":"Span attribute keys to drop before export (the PII/secret control point, e.g. db.statement).","type":"array","default":[],"items":{"type":"string"}},"replicas":{"description":"Number of collector replicas. Head sampling is trace-id-deterministic, so replicas>1 are safe and remove the single-ingest-path SPOF. With shared-central tracing each replica sends up to two requests at a time against this tenant's write limit of four per vmauth replica, so more replicas do not raise the tenant's throughput; the tenant's write rate (the platform's monitoring.tracingCentralTenantBytesPerSecond) is split across them as well, so a sender whose connection stays on one replica gets that replica's share, and each replica that starts lets through above the rate up to 5 MiB, or one second of its share when that is larger, which is why shared-central tracing allows at most 10 replicas and fails the render above that.","type":"integer","default":1,"minimum":1},"resources":{"description":"Resource configuration for the collector.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"samplingPercentage":{"description":"Head-sampling percentage applied at the collector before export.","type":"integer","default":10,"maximum":100,"minimum":0}}},"alerta":{"description":"Configuration for the Alerta service.","type":"object","default":{},"properties":{"alerts":{"description":"Alert routing configuration.","type":"object","default":{},"properties":{"email":{"description":"Configuration for email alerts. Alerts carrying the label notify_email with the string value true are emailed when their severity is in the severities list (default critical and major). A bare YAML boolean does not match. Alerts listed in alertnames are emailed unless matched by an earlier platform route.","type":"object","default":{},"required":["from","smarthost","to"],"properties":{"alertnames":{"description":"Alert names emailed whether or not the rule carries the notify_email label, with no severity filter. Earlier platform routes still take precedence. Alerts with `event=\"Heartbeat\"`, including `Watchdog`, go only to Alerta, and alerts with severity `none`, `CDIDefaultStorageClassDegraded` and `CDINoDefaultStorageClass` are blackholed and never reach email. This is the way to opt in alerts the platform ships, since their helm-owned rule definitions cannot be labelled per cluster. Entries must be plain Prometheus alert names such as `KubeAPIDown`, and anything else fails the render. Empty adds no extra route.","type":"array","default":[],"items":{"type":"string"}},"authUsername":{"description":"Username for SMTP LOGIN/PLAIN authentication. The password is read from the `password` key of a Secret named `alertmanager-email-password` in the release namespace, which the platform operator creates. The name is fixed and the Secret is mounted into Alertmanager, so a missing Secret blocks the whole Alertmanager rollout, not only email delivery. The credential in it must belong to this tenant alone. `smarthost` is chosen by whoever writes the Monitoring, so one relay credential provisioned under the same name in every namespace can be collected by pointing `smarthost` at a host the tenant controls.","type":"string","default":""},"from":{"description":"Sender address, one only. A display name is accepted. It takes the same narrower form as `to`, and an address outside it fails the render.","type":"string","default":""},"repeatInterval":{"description":"Minimum time before a still-firing alert is emailed again, as an Alertmanager duration with units `y`, `w`, `d`, `h`, `m`, `s`, `ms` in descending order, each at most once, such as `5m`, `12h` or `1h30m`. Delivery is evaluated every 5m, so shorter intervals take effect at 5m and other intervals round up to a multiple of 5m. Zero, a unit out of order and a total beyond what Alertmanager accepts fail the render. Empty keeps the 12h default.","type":"string","default":""},"severities":{"description":"Severities the notify_email route accepts (e.g. [\"critical\",\"major\",\"warning\"]). Empty keeps the default of critical and major. List every severity in use to email opted-in alerts regardless of severity. Entries must be plain severity names, and anything else fails the render.","type":"array","default":[],"items":{"type":"string"}},"smarthost":{"description":"SMTP server as `host:port` (e.g. \"smtp.example.com:465\"). A value without a port, an invalid bracketed IP address or a port with leading zeros fails the render. Port 465 uses implicit TLS, other ports use STARTTLS.","type":"string","default":""},"template":{"description":"Text of an Alertmanager template file that changes how the emails look. Define `email.default.subject` and `email.default.html` in it to replace the subject and the HTML body Alertmanager uses for every email, for example to mark the severity or to link to Alerta. The chart stores the text in a ConfigMap named `alertmanager-email-template` and lists it among the Alertmanager templates, so Alertmanager parses it together with its configuration. A template that does not parse fails that load, a running Alertmanager keeps the configuration it already has and a pod that starts with it does not come up. A template that parses but fails on a notification, for example on a missing key, drops that email. The text must contain at least one `define` action. Empty keeps the Alertmanager defaults.","type":"string","default":""},"to":{"description":"Recipient address, or several separated by commas. A display name is accepted, such as `Oncall `, as long as it carries no comma. Quote display names containing punctuation such as `:`, `@`, parentheses or `?`. RFC 2047 encoded words are not accepted. IP domain literals accept dotted-quad IPv4 only. IPv6 literals are rejected because Go mail parsers disagree on their syntax across versions. ASCII control characters are rejected. Addresses must be literal, so Alertmanager template actions are rejected. The accepted form is deliberately narrower than RFC 5322. The local part must be a dot-atom, with no leading, trailing or doubled dot, and quoted local parts, comments and a `mailto:` prefix are rejected. An address outside that form fails the render, because Alertmanager parses addresses only when it sends and drops the notification with no record a tenant can read.","type":"string","default":""}}},"slack":{"description":"Configuration for Slack alerts.","type":"object","default":{},"required":["url"],"properties":{"disabledSeverity":{"description":"List of severities without alerts (e.g. [\"informational\",\"warning\"]).","type":"array","default":[],"items":{"type":"string"}},"url":{"description":"Configuration uri for Slack alerts.","type":"string","default":""}}},"telegram":{"description":"Configuration for Telegram alerts.","type":"object","default":{},"required":["chatID","token"],"properties":{"chatID":{"description":"Telegram chat ID(s), separated by commas.","type":"string","default":""},"disabledSeverity":{"description":"List of severities without alerts (e.g. [\"informational\",\"warning\"]).","type":"array","default":[],"items":{"type":"string"}},"token":{"description":"Telegram bot token.","type":"string","default":""}}}}},"resources":{"description":"Resource configuration.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"storage":{"description":"Persistent volume size for the database.","type":"string","default":"10Gi"},"storageClassName":{"description":"StorageClass used for the database.","type":"string","default":""}}},"grafana":{"description":"Configuration for Grafana.","type":"object","default":{},"properties":{"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"size":{"description":"Persistent volume size for the database.","type":"string","default":"10Gi"}}},"resources":{"description":"Resource configuration.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}}}},"vmagent":{"description":"Configuration for VictoriaMetrics Agent.","type":"object","default":{},"properties":{"externalLabels":{"description":"External labels applied to all metrics.","type":"object","default":{"cluster":"cozystack"}},"remoteWrite":{"description":"Remote write configuration.","type":"object","default":{"urls":["http://vminsert-shortterm:8480/insert/0/prometheus","http://vminsert-longterm:8480/insert/0/prometheus"]}}}},"oidc":{"description":"OIDC authentication for the Grafana instance. See https://cozystack.io/docs/v1.6/operations/services/monitoring/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`.","type":"object","default":{}},"secretRef":{"description":"Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`. With shared-central tracing only its `auth.ini` key is mounted, so the fragment cannot read another key of the Secret with `$__file{}`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`.","type":"string","default":""}}}},"x-kubernetes-map-type":"atomic"},"mode":{"description":"Identity mode. `None`: no OIDC, only the `grafana-admin-password` Secret works. `System`: trust the platform `cozy` realm via a per-instance confidential client and audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to this Grafana instance's org. Each entry is reconciled into Grafana org membership + role by a chart-owned post-install/post-upgrade Job. Works for both `System` and `CustomConfig` modes; ignored when `mode: None`. Users not listed here get nothing (no default org role from group mapping).","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. The chart pre-provisions a Grafana account with this email so the users-Job can set the org role before the operator's first login (`oauth_allow_insecure_email_lookup = true` glues the two together). Must match a conservative pattern: local part is `[A-Za-z0-9._%+-]+`, domain is `[A-Za-z0-9.-]+\\.[A-Za-z]{2,}`. Whitespace, quoted literals, and unusual URL-reserved characters are rejected on schema level so the reconcile-Job's shell handling never has to defend against malformed input.","type":"string"},"role":{"description":"Grafana org role to bind: `Admin`, `Editor`, or `Viewer`. Applied to the release's Grafana org (`Main Org.`); server-level `GrafanaAdmin` promotion is out of scope for Phase 1. Required — the users-Job POSTs `{loginOrEmail, role}` to `/api/orgs/1/users` and PATCHes `{role}` to converge across re-runs; omitting the field would render `role: \"null\"` into the body and fail with HTTP 400.","type":"string","enum":["Admin","Editor","Viewer"]}}}}}},"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":{"host":{"description":"The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"metricsStorages":{"description":"Configuration of metrics storage instances.","type":"array","default":[{"deduplicationInterval":"15s","name":"shortterm","retentionPeriod":"3d","storage":"10Gi","storageClassName":""},{"deduplicationInterval":"5m","name":"longterm","retentionPeriod":"14d","storage":"10Gi","storageClassName":""}],"items":{"type":"object","required":["deduplicationInterval","name","retentionPeriod","storage"],"properties":{"deduplicationInterval":{"description":"Deduplication interval for metrics.","type":"string"},"name":{"description":"Name of the storage instance.","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"retentionPeriod":{"description":"Retention period for metrics.","type":"string"},"storage":{"description":"Persistent volume size.","type":"string","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"},"storageClassName":{"description":"StorageClass used for the data.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"vminsert":{"description":"Configuration for vminsert.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"vmselect":{"description":"Configuration for vmselect.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"vmstorage":{"description":"Configuration for vmstorage.","type":"object","properties":{"maxAllowed":{"description":"Maximum allowed resources.","type":"object","properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"minAllowed":{"description":"Minimum guaranteed resources.","type":"object","properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}}}}},"logsStorages":{"description":"Configuration of logs storage instances.","type":"array","default":[{"name":"generic","retentionPeriod":"1","storage":"10Gi","storageClassName":"replicated"}],"items":{"type":"object","required":["name","retentionPeriod","storage","storageClassName"],"properties":{"name":{"description":"Name of the storage instance.","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"retentionPeriod":{"description":"Retention period for logs.","type":"string","default":"1"},"storage":{"description":"Persistent volume size.","type":"string","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"},"storageClassName":{"description":"StorageClass used to store the data.","type":"string","default":"replicated","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"tracingStorages":{"description":"Configuration of traces storage instances. Empty by default (tracing off): no backend and no trace collector are rendered. Adding an entry provisions a VictoriaTraces backend and, while tracingCollector.enabled is true, deploys the OTLP collector in front of it. A tenant with shared-central tracing (the Tenant's tracingCentral) gets the collector, while tracingCollector.enabled is true, without an entry, which then exports to the shared store; entries still listed keep their store and datasource, so traces stored before the switch stay readable until the entry is removed.","type":"array","default":[],"items":{"type":"object","required":["mode","name","retentionPeriod","storage","storageClassName"],"properties":{"mode":{"description":"Deployment mode: \"cluster\" renders a VTCluster; \"single\" renders a single-binary VTSingle for edge/dev/small clusters. Treat as immutable once a backend exists: mode selects which Kind is rendered under the same name, so changing it on a running backend re-identifies the object rather than reconfiguring it. Switching from \"single\" to \"cluster\" prunes the VTSingle and the operator garbage-collects its PVC (stored traces are lost); switching from \"cluster\" to \"single\" (or removing the entry) leaves the vtstorage PVCs Bound and billed until the whole Monitoring release is deleted. The API cannot guard this (transition rules are not available on an array-item field), so this note is the only guard: migrate deliberately, accepting the loss.","type":"string","default":"cluster","enum":["cluster","single"]},"name":{"description":"Name of the storage instance: a lowercase RFC 1123 label of at most 42 characters. Treat as immutable once a backend exists: the VTCluster/VTSingle, its Services, PVCs and Grafana datasource are all named after it, so renaming an entry deploys a new, empty backend and removes the old one, the same way changing mode does (single mode loses the old PVC, cluster mode leaves the old vtstorage PVCs Bound until the whole Monitoring release is deleted).","type":"string","maxLength":42,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"retentionDiskUsageBytes":{"description":"Optional disk-usage cap as a VictoriaMetrics BytesString (e.g. \"8GB\" or \"8GiB\"), bounding disk use on top of the age-based retentionPeriod. Uses byte-suffix grammar (kb/mb/gb/tb, KiB/MiB/GiB/TiB), NOT the Kubernetes-quantity grammar of the sibling storage field, so \"8Gi\" is rejected by the operator. In cluster mode the cap is per vtstorage replica (replicaCount 2), so the effective total is twice the value. Unset, the store drops its oldest day once its filesystem is 80% full instead, so every store is disk-bounded. Either way VictoriaTraces keeps the last two days, so spans arriving faster than the cap allows for two days can still fill the disk.","type":"string"},"retentionPeriod":{"description":"Retention period for traces.","type":"string","default":"14d"},"storage":{"description":"Persistent volume size.","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},"storageClassName":{"description":"StorageClass used to store the data.","type":"string","default":"replicated","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"tracingCentralHost":{"description":"tenant-root only: accept spans from tenants that turned on shared-central tracing (the Tenant's tracingCentral) into this Monitoring's tracingStorages entry named `generic`, which must be in `cluster` mode. Every central tenant then shares that store's disk and retention with tenant-root, and nothing reserves space per tenant: once the store's disk cap is reached (retentionDiskUsageBytes, or 80% of its filesystem) the oldest spans of all of them are evicted together. Each tenant is held to the platform's monitoring.tracingCentralTenantBytesPerSecond, which by default lets one tenant write at most the cap of a default 10Gi store, counted uncompressed and before the tenant's sampling, over the two days VictoriaTraces always keeps, so raise it with the store; several tenants writing at their limit together still can fill it. That bound holds for a tenant whose collector keeps running: each collector pod starts with a full bucket, up to 5 MiB or one second of its share of the rate when that is larger, and any change to the tenant's Monitoring rolls every collector pod, so a tenant that keeps changing it writes that much more on each rollout, for up to ten replicas; closing that needs a limiter with shared state, which the collector does not run. Ignored outside tenant-root. The tenant-root namespace is inside the trust boundary of the shared store, as it is for the metrics of tenants that rely on a parent's monitoring: vmauth pins each central tenant to its own account, but workloads in tenant-root reach the store directly, and one that learns a tenant's account ID (a hash of its namespace name and UID, which its VMUsers carry) can read and write that account. Whoever tenant-root admits to its Grafana is inside it too, since tenant-root's own datasource for the store reaches vtselect without vmauth; who that is follows its Grafana's oidc mode (with System, tenant-root's own groups, which already hold the same access level in every tenant under tenant-root). The render refuses to stop hosting while central tenants remain, but removing the tenant-root Monitoring altogether is not a render and is not refused: turn tracingCentral off on the central tenants first, since until then every Monitoring render of theirs fails, their metrics, logs and alerting changes included. The refusals read each other's objects when they render, so a tenant turning tracingCentral on while tenant-root stops hosting can pass both: that tenant's collector then exports to a vmauth that is gone while every release reports Ready, until its Monitoring renders again. Recover by hosting again; turning that tenant's tracingCentral off instead ends the silent drop, and turning it on again is then refused until tenant-root hosts.","type":"boolean","default":false},"tracingCollector":{"description":"OpenTelemetry Collector for trace ingestion. With shared-central tracing it refuses spans above the platform's per-tenant write rate: OTLP/HTTP senders retry them, OTLP/gRPC senders drop them, so export over HTTP. It also refuses a request larger than 3 MiB (decompressed) with a 400, which senders do not retry, so keep export batches below that.","type":"object","default":{},"required":["enabled","replicas","samplingPercentage"],"properties":{"enabled":{"description":"Deploy the OTLP collector. When disabled, applications must send OTLP straight to the traces backend (no central sampling/redaction); with shared-central tracing they have no path to it, so no new spans arrive, while the traces already stored stay readable. The collector fronts a single backend, and the limit holds with shared-central tracing too, since turning that off makes it export to the local entry again: while it is enabled, tracingStorages must hold at most one entry, and adding a second one fails the whole Monitoring render until the extra entry is removed or the collector is disabled.","type":"boolean","default":true},"redactAttributes":{"description":"Span attribute keys to drop before export (the PII/secret control point, e.g. db.statement).","type":"array","default":[],"items":{"type":"string"}},"replicas":{"description":"Number of collector replicas. Head sampling is trace-id-deterministic, so replicas>1 are safe and remove the single-ingest-path SPOF. With shared-central tracing each replica sends up to two requests at a time against this tenant's write limit of four per vmauth replica, so more replicas do not raise the tenant's throughput; the tenant's write rate (the platform's monitoring.tracingCentralTenantBytesPerSecond) is split across them as well, so a sender whose connection stays on one replica gets that replica's share, and each replica that starts lets through above the rate up to 5 MiB, or one second of its share when that is larger, which is why shared-central tracing allows at most 10 replicas and fails the render above that.","type":"integer","default":1,"minimum":1},"resources":{"description":"Resource configuration for the collector.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"samplingPercentage":{"description":"Head-sampling percentage applied at the collector before export.","type":"integer","default":10,"maximum":100,"minimum":0}}},"alerta":{"description":"Configuration for the Alerta service.","type":"object","default":{},"properties":{"alerts":{"description":"Alert routing configuration.","type":"object","default":{},"properties":{"email":{"description":"Configuration for email alerts. Alerts carrying the label notify_email with the string value true are emailed when their severity is in the severities list (default critical and major). A bare YAML boolean does not match. Alerts listed in alertnames are emailed unless matched by an earlier platform route.","type":"object","default":{},"required":["from","smarthost","to"],"properties":{"alertnames":{"description":"Alert names emailed whether or not the rule carries the notify_email label, with no severity filter. Earlier platform routes still take precedence. Alerts with `event=\"Heartbeat\"`, including `Watchdog`, go only to Alerta, and alerts with severity `none`, `CDIDefaultStorageClassDegraded` and `CDINoDefaultStorageClass` are blackholed and never reach email. This is the way to opt in alerts the platform ships, since their helm-owned rule definitions cannot be labelled per cluster. Entries must be plain Prometheus alert names such as `KubeAPIDown`, and anything else fails the render. Empty adds no extra route.","type":"array","default":[],"items":{"type":"string"}},"authUsername":{"description":"Username for SMTP LOGIN/PLAIN authentication. The password is read from the `password` key of a Secret named `alertmanager-email-password` in the release namespace, which the platform operator creates. The name is fixed and the Secret is mounted into Alertmanager, so a missing Secret blocks the whole Alertmanager rollout, not only email delivery. The credential in it must belong to this tenant alone. `smarthost` is chosen by whoever writes the Monitoring, so one relay credential provisioned under the same name in every namespace can be collected by pointing `smarthost` at a host the tenant controls.","type":"string","default":""},"from":{"description":"Sender address, one only. A display name is accepted. It takes the same narrower form as `to`, and an address outside it fails the render.","type":"string","default":""},"repeatInterval":{"description":"Minimum time before a still-firing alert is emailed again, as an Alertmanager duration with units `y`, `w`, `d`, `h`, `m`, `s`, `ms` in descending order, each at most once, such as `5m`, `12h` or `1h30m`. Delivery is evaluated every 5m, so shorter intervals take effect at 5m and other intervals round up to a multiple of 5m. Zero, a unit out of order and a total beyond what Alertmanager accepts fail the render. Empty keeps the 12h default.","type":"string","default":""},"severities":{"description":"Severities the notify_email route accepts (e.g. [\"critical\",\"major\",\"warning\"]). Empty keeps the default of critical and major. List every severity in use to email opted-in alerts regardless of severity. Entries must be plain severity names, and anything else fails the render.","type":"array","default":[],"items":{"type":"string"}},"smarthost":{"description":"SMTP server as `host:port` (e.g. \"smtp.example.com:465\"). A value without a port, an invalid bracketed IP address or a port with leading zeros fails the render. Port 465 uses implicit TLS, other ports use STARTTLS.","type":"string","default":""},"template":{"description":"Text of an Alertmanager template file that changes how the emails look. Define `email.default.subject` and `email.default.html` in it to replace the subject and the HTML body Alertmanager uses for every email, for example to mark the severity or to link to Alerta. The chart stores the text in a ConfigMap named `alertmanager-email-template` and lists it among the Alertmanager templates, so Alertmanager parses it together with its configuration. A template that does not parse fails that load, a running Alertmanager keeps the configuration it already has and a pod that starts with it does not come up. A template that parses but fails on a notification, for example on a missing key, drops that email. The text must contain at least one `define` action. Empty keeps the Alertmanager defaults.","type":"string","default":""},"to":{"description":"Recipient address, or several separated by commas. A display name is accepted, such as `Oncall `, as long as it carries no comma. Quote display names containing punctuation such as `:`, `@`, parentheses or `?`. RFC 2047 encoded words are not accepted. IP domain literals accept dotted-quad IPv4 only. IPv6 literals are rejected because Go mail parsers disagree on their syntax across versions. ASCII control characters are rejected. Addresses must be literal, so Alertmanager template actions are rejected. The accepted form is deliberately narrower than RFC 5322. The local part must be a dot-atom, with no leading, trailing or doubled dot, and quoted local parts, comments and a `mailto:` prefix are rejected. An address outside that form fails the render, because Alertmanager parses addresses only when it sends and drops the notification with no record a tenant can read.","type":"string","default":""}}},"slack":{"description":"Configuration for Slack alerts.","type":"object","default":{},"required":["url"],"properties":{"disabledSeverity":{"description":"List of severities without alerts (e.g. [\"informational\",\"warning\"]).","type":"array","default":[],"items":{"type":"string"}},"url":{"description":"Configuration uri for Slack alerts.","type":"string","default":"","pattern":"^(https?://[^\\s\"\\\\]*)?$"}}},"telegram":{"description":"Configuration for Telegram alerts.","type":"object","default":{},"required":["chatID","token"],"properties":{"chatID":{"description":"Telegram chat ID(s), separated by commas.","type":"string","default":"","pattern":"^[-@A-Za-z0-9_, ]*$"},"disabledSeverity":{"description":"List of severities without alerts (e.g. [\"informational\",\"warning\"]).","type":"array","default":[],"items":{"type":"string"}},"token":{"description":"Telegram bot token.","type":"string","default":"","pattern":"^([0-9]+:[A-Za-z0-9_-]+)?$"}}}}},"resources":{"description":"Resource configuration.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}},"storage":{"description":"Persistent volume size for the database.","type":"string","default":"10Gi","pattern":"^((\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?)?$"},"storageClassName":{"description":"StorageClass used for the database.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"grafana":{"description":"Configuration for Grafana.","type":"object","default":{},"properties":{"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"size":{"description":"Persistent volume size for the database.","type":"string","default":"10Gi","pattern":"^((\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?)?$"}}},"resources":{"description":"Resource configuration.","type":"object","default":{},"properties":{"limits":{"description":"Resource limits.","type":"object","default":{},"properties":{"cpu":{"description":"CPU limit.","default":1,"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 limit.","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}}},"requests":{"description":"Resource requests.","type":"object","default":{},"properties":{"cpu":{"description":"CPU request.","default":"100m","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 request.","default":"256Mi","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}}}}}}},"vmagent":{"description":"Configuration for VictoriaMetrics Agent.","type":"object","default":{},"properties":{"externalLabels":{"description":"External labels applied to all metrics.","type":"object","default":{"cluster":"cozystack"}},"remoteWrite":{"description":"Remote write configuration.","type":"object","default":{"urls":["http://vminsert-shortterm:8480/insert/0/prometheus","http://vminsert-longterm:8480/insert/0/prometheus"]}}}},"oidc":{"description":"OIDC authentication for the Grafana instance. See https://cozystack.io/docs/v1.6/operations/services/monitoring/oidc-authentication/ for the operator guide.","type":"object","default":{},"required":["mode"],"properties":{"customConfig":{"description":"Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`.","type":"object","default":{},"properties":{"config":{"description":"Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`.","type":"object","default":{}},"secretRef":{"description":"Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`. With shared-central tracing only its `auth.ini` key is mounted, so the fragment cannot read another key of the Secret with `$__file{}`.","type":"object","default":{},"properties":{"name":{"description":"Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"x-kubernetes-map-type":"atomic"},"mode":{"description":"Identity mode. `None`: no OIDC, only the `grafana-admin-password` Secret works. `System`: trust the platform `cozy` realm via a per-instance confidential client and audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.","type":"string","default":"None","enum":["None","System","CustomConfig"]},"users":{"description":"Users granted access to this Grafana instance's org. Each entry is reconciled into Grafana org membership + role by a chart-owned post-install/post-upgrade Job. Works for both `System` and `CustomConfig` modes; ignored when `mode: None`. Users not listed here get nothing (no default org role from group mapping).","type":"array","default":[],"items":{"type":"object","required":["email","role"],"properties":{"email":{"description":"Email address matched against the `email` claim from the issuer. The chart pre-provisions a Grafana account with this email so the users-Job can set the org role before the operator's first login (`oauth_allow_insecure_email_lookup = true` glues the two together). Must match a conservative pattern: local part is `[A-Za-z0-9._%+-]+`, domain is `[A-Za-z0-9.-]+\\.[A-Za-z]{2,}`. Whitespace, quoted literals, and unusual URL-reserved characters are rejected on schema level so the reconcile-Job's shell handling never has to defend against malformed input.","type":"string"},"role":{"description":"Grafana org role to bind: `Admin`, `Editor`, or `Viewer`. Applied to the release's Grafana org (`Main Org.`); server-level `GrafanaAdmin` promotion is out of scope for Phase 1. Required — the users-Job POSTs `{loginOrEmail, role}` to `/api/orgs/1/users` and PATCHes `{role}` to converge across re-runs; omitting the field would render `role: \"null\"` into the body and fail with HTTP 400.","type":"string","enum":["Admin","Editor","Viewer"]}}}}}},"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: "" labels: diff --git a/packages/system/monitoring/templates/vm/vmagent.yaml b/packages/system/monitoring/templates/vm/vmagent.yaml index 919fdef63..6a2f93ef2 100644 --- a/packages/system/monitoring/templates/vm/vmagent.yaml +++ b/packages/system/monitoring/templates/vm/vmagent.yaml @@ -9,7 +9,7 @@ spec: policy.cozystack.io/allow-to-apiserver: "true" shardCount: 1 externalLabels: - cluster: {{ .Values.vmagent.externalLabels.cluster }} + cluster: {{ .Values.vmagent.externalLabels.cluster | quote }} tenant: {{ .Release.Namespace }} {{- if .Values.vmagent.externalLabels.environment }} environment: {{ .Values.vmagent.externalLabels.environment | quote }} diff --git a/packages/system/monitoring/tests/vmagent_external_labels_test.yaml b/packages/system/monitoring/tests/vmagent_external_labels_test.yaml new file mode 100644 index 000000000..ee6b20609 --- /dev/null +++ b/packages/system/monitoring/tests/vmagent_external_labels_test.yaml @@ -0,0 +1,19 @@ +suite: vmagent external labels +# A label value may be any UTF-8, and the cluster label comes from the tenant's +# Monitoring values, so it is written as a quoted string rather than validated. +templates: + - templates/vm/vmagent.yaml +release: + namespace: tenant-test +tests: + - it: writes a cluster label of any characters as one string + set: + vmagent: + externalLabels: + cluster: "prod: eu/west #1\nextra: field" + asserts: + - isKind: + of: VMAgent + - equal: + path: spec.externalLabels.cluster + value: "prod: eu/west #1\nextra: field" diff --git a/packages/system/nats-rd/cozyrds/nats.yaml b/packages/system/nats-rd/cozyrds/nats.yaml index f48dc9201..9683fd2ea 100644 --- a/packages/system/nats-rd/cozyrds/nats.yaml +++ b/packages/system/nats-rd/cozyrds/nats.yaml @@ -8,7 +8,7 @@ spec: plural: natses singular: nats openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each NATS 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.nano","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"]},"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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. When omitted, TLS follows the `external` flag.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS. When omitted, TLS is enabled automatically when `external` is true.","type":"boolean"}}},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user.","type":"string"}}}},"jetstream":{"description":"Jetstream configuration.","type":"object","default":{},"required":["enabled","size"],"properties":{"enabled":{"description":"Enable or disable Jetstream for persistent messaging in NATS.","type":"boolean","default":true},"size":{"description":"Jetstream persistent storage size.","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}}},"config":{"description":"NATS configuration.","type":"object","default":{},"properties":{"merge":{"description":"Additional configuration to merge into NATS config.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"resolver":{"description":"Additional resolver configuration to merge into NATS config.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":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 replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each NATS 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.nano","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"]},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. When omitted, TLS follows the `external` flag.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS. When omitted, TLS is enabled automatically when `external` is true.","type":"boolean"}}},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user.","type":"string"}}}},"jetstream":{"description":"Jetstream configuration.","type":"object","default":{},"required":["enabled","size"],"properties":{"enabled":{"description":"Enable or disable Jetstream for persistent messaging in NATS.","type":"boolean","default":true},"size":{"description":"Jetstream persistent storage size.","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}}},"config":{"description":"NATS configuration.","type":"object","default":{},"properties":{"merge":{"description":"Additional configuration to merge into NATS config.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"resolver":{"description":"Additional resolver configuration to merge into NATS config.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":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: nats- labels: diff --git a/packages/system/openbao-rd/cozyrds/openbao.yaml b/packages/system/openbao-rd/cozyrds/openbao.yaml index 6272e8582..6eb6a3b96 100644 --- a/packages/system/openbao-rd/cozyrds/openbao.yaml +++ b/packages/system/openbao-rd/cozyrds/openbao.yaml @@ -8,7 +8,7 @@ spec: plural: openbaos singular: openbao openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of OpenBAO replicas. HA with Raft is automatically enabled when replicas > 1. Switching between standalone (file storage) and HA (Raft storage) modes requires data migration.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each OpenBAO 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 for data storage.","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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"ui":{"description":"Enable the OpenBAO web UI.","type":"boolean","default":true},"seal":{"description":"Seal configuration. The default is Shamir key shares. Set `type: static` for auto-unseal.","type":"object","default":{},"required":["keyId","secretName","type"],"properties":{"allowMigration":{"description":"Acknowledge a seal migration. The chart refuses to change `type` on an existing instance unless this is `true`. Set it only while running `bao operator unseal -migrate`, then remove it.","type":"boolean","default":false},"keyId":{"description":"Permanent identifier of the current key. OpenBAO stores it with the data the key wraps and picks the key by it, so change it whenever the key material changes. Lowercase alphanumerics, `-`, `.` and `_`, starting and ending with an alphanumeric, because the upstream chart evaluates the server config as a template and rewrites upper case placeholders such as `HOSTNAME` in it. Required when `type` is `static`.","type":"string","default":"","pattern":"^([a-z0-9]([-a-z0-9._]*[a-z0-9])?)?$"},"previousKeyId":{"description":"Identifier of the previous key, with the same character constraints as `keyId`. Required when `previousSecretName` is set.","type":"string","default":"","pattern":"^([a-z0-9]([-a-z0-9._]*[a-z0-9])?)?$"},"previousSecretName":{"description":"Secret holding the previous key during an n-1 key rotation, with the same name constraints as `secretName`. Keep it until the pods have been replaced and the active node has logged `upgrading stored keys`, see the README.","type":"string","default":"","maxLength":52,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"},"secretName":{"description":"Existing Secret in the tenant namespace whose key `key` holds the base64 text of 32 random bytes (for example `openssl rand -base64 32`). A cluster administrator creates it, because tenant roles cannot create Secrets. Lowercase alphanumerics and hyphens, at most 52 characters, because the pod volume is named `userconfig-` and a volume name is a DNS label. Required when `type` is `static`.","type":"string","default":"","maxLength":52,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"},"type":{"description":"Seal type. `shamir` keeps the current behaviour, `static` enables auto-unseal from `secretName`.","type":"string","default":"shamir","enum":["shamir","static"]}}},"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 OpenBAO replicas. HA with Raft is automatically enabled when replicas > 1. Switching between standalone (file storage) and HA (Raft storage) modes requires data migration.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each OpenBAO 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 for data storage.","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"ui":{"description":"Enable the OpenBAO web UI.","type":"boolean","default":true},"seal":{"description":"Seal configuration. The default is Shamir key shares. Set `type: static` for auto-unseal.","type":"object","default":{},"required":["keyId","secretName","type"],"properties":{"allowMigration":{"description":"Acknowledge a seal migration. The chart refuses to change `type` on an existing instance unless this is `true`. Set it only while running `bao operator unseal -migrate`, then remove it.","type":"boolean","default":false},"keyId":{"description":"Permanent identifier of the current key. OpenBAO stores it with the data the key wraps and picks the key by it, so change it whenever the key material changes. Lowercase alphanumerics, `-`, `.` and `_`, starting and ending with an alphanumeric, because the upstream chart evaluates the server config as a template and rewrites upper case placeholders such as `HOSTNAME` in it. Required when `type` is `static`.","type":"string","default":"","pattern":"^([a-z0-9]([-a-z0-9._]*[a-z0-9])?)?$"},"previousKeyId":{"description":"Identifier of the previous key, with the same character constraints as `keyId`. Required when `previousSecretName` is set.","type":"string","default":"","pattern":"^([a-z0-9]([-a-z0-9._]*[a-z0-9])?)?$"},"previousSecretName":{"description":"Secret holding the previous key during an n-1 key rotation, with the same name constraints as `secretName`. Keep it until the pods have been replaced and the active node has logged `upgrading stored keys`, see the README.","type":"string","default":"","maxLength":52,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"},"secretName":{"description":"Existing Secret in the tenant namespace whose key `key` holds the base64 text of 32 random bytes (for example `openssl rand -base64 32`). A cluster administrator creates it, because tenant roles cannot create Secrets. Lowercase alphanumerics and hyphens, at most 52 characters, because the pod volume is named `userconfig-` and a volume name is a DNS label. Required when `type` is `static`.","type":"string","default":"","maxLength":52,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"},"type":{"description":"Seal type. `shamir` keeps the current behaviour, `static` enables auto-unseal from `secretName`.","type":"string","default":"shamir","enum":["shamir","static"]}}},"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: openbao- labels: diff --git a/packages/system/opensearch-rd/cozyrds/opensearch.yaml b/packages/system/opensearch-rd/cozyrds/opensearch.yaml index c968974d5..e0f75547b 100644 --- a/packages/system/opensearch-rd/cozyrds/opensearch.yaml +++ b/packages/system/opensearch-rd/cozyrds/opensearch.yaml @@ -8,7 +8,7 @@ spec: singular: opensearch plural: opensearches openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of OpenSearch nodes in the cluster.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each OpenSearch node. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each node.","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 node.","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. OpenSearch requires minimum 2Gi memory.","type":"string","default":"c1.medium","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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"topologySpreadPolicy":{"description":"How strictly to enforce pod distribution across nodes and zones.","type":"string","default":"soft","enum":["soft","hard"]},"version":{"description":"OpenSearch major version to deploy.","type":"string","default":"v2","enum":["v3","v2","v1"]},"tls":{"description":"HTTP-layer TLS configuration. Selects who issues the HTTP server certificate; TLS itself is always served.","type":"object","default":{},"properties":{"issuer":{"description":"Who issues the HTTP server certificate: `operator` uses the CA the opster operator manages itself, `cert-manager` gives the release its own CA, covers the external hostname and publishes a trust anchor the tenant can verify against. Unset follows external: `cert-manager` when it is true, `operator` when it is false. Named for the issuer because TLS is served under both, unlike the similarly-spelled `tls.enabled` in some other charts, which does switch TLS on and off.","type":"string","enum":["operator","cert-manager"]}}},"nodeRoles":{"description":"Node roles configuration.","type":"object","default":{},"required":["data","ingest","master","ml"],"properties":{"data":{"description":"Enable data role.","type":"boolean","default":true},"ingest":{"description":"Enable ingest role.","type":"boolean","default":true},"master":{"description":"Enable cluster_manager role.","type":"boolean","default":true},"ml":{"description":"Enable machine learning role.","type":"boolean","default":false}}},"users":{"description":"Custom OpenSearch users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user (auto-generated if omitted).","type":"string"},"roles":{"description":"List of OpenSearch roles.","type":"array","items":{"type":"string"}}}}},"dashboards":{"description":"OpenSearch Dashboards configuration.","type":"object","default":{},"required":["enabled","replicas","resourcesPreset"],"properties":{"enabled":{"description":"Enable OpenSearch Dashboards deployment. The application name is then limited to 41 characters, and to 32 when external access is also on, because the Dashboards Service the operator creates would otherwise exceed the 63-character DNS label limit, and the operator stops upgrading and restarting the release for as long as that Service is refused.","type":"boolean","default":false},"replicas":{"description":"Number of Dashboards replicas.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for Dashboards.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each node.","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 node.","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 for Dashboards.","type":"string","default":"c1.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"]}}},"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 OpenSearch nodes in the cluster.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each OpenSearch node. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each node.","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 node.","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. OpenSearch requires minimum 2Gi memory.","type":"string","default":"c1.medium","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"topologySpreadPolicy":{"description":"How strictly to enforce pod distribution across nodes and zones.","type":"string","default":"soft","enum":["soft","hard"]},"version":{"description":"OpenSearch major version to deploy.","type":"string","default":"v2","enum":["v3","v2","v1"]},"tls":{"description":"HTTP-layer TLS configuration. Selects who issues the HTTP server certificate; TLS itself is always served.","type":"object","default":{},"properties":{"issuer":{"description":"Who issues the HTTP server certificate: `operator` uses the CA the opster operator manages itself, `cert-manager` gives the release its own CA, covers the external hostname and publishes a trust anchor the tenant can verify against. Unset follows external: `cert-manager` when it is true, `operator` when it is false. Named for the issuer because TLS is served under both, unlike the similarly-spelled `tls.enabled` in some other charts, which does switch TLS on and off.","type":"string","enum":["operator","cert-manager"]}}},"nodeRoles":{"description":"Node roles configuration.","type":"object","default":{},"required":["data","ingest","master","ml"],"properties":{"data":{"description":"Enable data role.","type":"boolean","default":true},"ingest":{"description":"Enable ingest role.","type":"boolean","default":true},"master":{"description":"Enable cluster_manager role.","type":"boolean","default":true},"ml":{"description":"Enable machine learning role.","type":"boolean","default":false}}},"users":{"description":"Custom OpenSearch users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user (auto-generated if omitted).","type":"string"},"roles":{"description":"List of OpenSearch roles.","type":"array","items":{"type":"string"}}}}},"dashboards":{"description":"OpenSearch Dashboards configuration.","type":"object","default":{},"required":["enabled","replicas","resourcesPreset"],"properties":{"enabled":{"description":"Enable OpenSearch Dashboards deployment. The application name is then limited to 41 characters, and to 32 when external access is also on, because the Dashboards Service the operator creates would otherwise exceed the 63-character DNS label limit, and the operator stops upgrading and restarting the release for as long as that Service is refused.","type":"boolean","default":false},"replicas":{"description":"Number of Dashboards replicas.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for Dashboards.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each node.","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 node.","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 for Dashboards.","type":"string","default":"c1.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"]}}},"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: opensearch- labels: diff --git a/packages/system/postgres-rd/cozyrds/postgres.yaml b/packages/system/postgres-rd/cozyrds/postgres.yaml index 98a804932..a121d16c8 100644 --- a/packages/system/postgres-rd/cozyrds/postgres.yaml +++ b/packages/system/postgres-rd/cozyrds/postgres.yaml @@ -30,7 +30,7 @@ spec: singular: postgres plural: postgreses openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Postgres replicas. Under active autoscaling this is the resting/seed count, not the live count — KEDA drives the live count via `/scale`. Disabling autoscaling does NOT automatically bring the live count back to `replicas`: the client-side merge writes `instances` only when the rendered value changes, so a cluster KEDA grew past `replicas` stays there with no autoscaler left to reduce it — lower `replicas` to the count you want and it rebases down (shedding the surplus replicas + PVCs). Lowering it below the live count, or disabling/dry-running while it sits below the live count, sheds in one step past the scaleDown pacing; stage it to the live count first (suspend the HelmRelease and `kubectl scale` if needed) to avoid a transient. Must stay greater than `quorum.maxSyncReplicas`.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each PostgreSQL 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.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":"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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"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},"version":{"description":"PostgreSQL major version to deploy","type":"string","default":"v18","enum":["v18","v17","v16","v15","v14","v13"]},"flavor":{"description":"PostgreSQL image flavor, fixed when the cluster is created. `postgresql` uses the CloudNativePG PostgreSQL image. `postgis` uses the CloudNativePG PostGIS image, which adds postgis, postgis_raster, postgis_topology, postgis_sfcgal, postgis_tiger_geocoder and address_standardizer; enable them per database in `databases..extensions`. Changing the flavor of an existing cluster is refused, and a backup restores only into a cluster of the flavor it was taken from: to change flavor, create a new cluster and move the data with a logical dump (pg_dump / pg_restore).","type":"string","default":"postgresql","enum":["postgresql","postgis"]},"allowCollationChange":{"description":"Allow a cluster created on a Debian bullseye image (before the move to standard-trixie) to move to the new image without a clean locale check. Such a cluster is checked before each upgrade, except while `bootstrap.enabled` is set (set it back to false once a restore set up by hand has finished), and stays on its current image until the check finds nothing that depends on a collation other than C, POSIX or builtin: while this is false, a cluster the check found affected (an ICU or libc locale, or C.UTF-8) or could not finish on stays put, because glibc and ICU on the new image sort text differently and every index on such text must be rebuilt. A held cluster runs the bare bullseye tag it has, gets no further PostgreSQL minors and so none of their security fixes, and refuses a change of `version`, since new majors are built only on the new images. To leave that state, either remove the dependency (move such columns and indexes to C, or to the builtin `pg_c_utf8` on PostgreSQL 17 and later) and let the next upgrade check again, or set this to true in a maintenance window: the cluster moves on the next upgrade, replicas restart on the new image first and can return wrong results through `-ro`, and unique indexes can accept duplicates, until the indexes are rebuilt on the primary. The collation repair Job, which a post-upgrade hook starts once the init Job is done, rebuilds the indexes on such text after the rollout, those on C.UTF-8 and other C.* locales included, and its log reports a rebuild that failed; check range partitions, CHECK constraints and materialized views on it, which a rebuild does not fix. A held cluster shows the hold only as an unchanged image; the result and the objects found are in the `postgres.cozystack.io/locale-data` and `postgres.cozystack.io/locale-data-objects` annotations of the cnpg.io Cluster, which an administrator can read. A restore of a backup taken on one of those bullseye images comes back on that image and is checked by the next upgrade.","type":"boolean","default":false},"tls":{"description":"TLS configuration for server connections.","type":"object","default":{},"properties":{"enabled":{"description":"Tri-state switch controlling whether the chart injects the external hostnames into the operator-managed CNPG cert via spec.certificates.serverAltDNSNames. When omitted, the chart injects them if `external: true` and skips them otherwise. Set explicitly to `true` to inject regardless of `external` (no-op when `external: false` since there is no external hostname to add). Set to `false` to skip injection. Note that CNPG keeps its built-in TLS on the wire regardless of this flag — this toggle only controls the chart-side SAN injection; to disable PostgreSQL TLS entirely set `postgresql.parameters.ssl = \"off\"` at the CNPG layer.","type":"boolean"},"required":{"description":"Tri-state switch controlling whether the server refuses sessions that are not encrypted. When omitted, it is on if `external: true` and off otherwise. When on, the chart renders `spec.postgresql.pg_hba` with `hostssl all all all scram-sha-256` (`md5` on PostgreSQL 13, matching CloudNativePG's default rule) followed by `host all all all reject`, so a client that connects with `sslmode=disable` is refused instead of getting a plaintext session; in-cluster clients are held to the same rule, since the pod network cannot be told apart from an external client. Set to `false` to keep accepting plaintext sessions on an external instance, or to `true` to require TLS on an in-cluster one. Rendering fails if `postgresql.parameters.ssl` is off while this is in effect.","type":"boolean"}}},"postgresql":{"description":"PostgreSQL server configuration.","type":"object","default":{},"properties":{"parameters":{"description":"PostgreSQL server parameters. Values may be strings or integers; integers are coerced to strings by the template (e.g. both `max_connections: 100` and `max_connections: \"100\"` are accepted). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.","type":"object","default":{"max_connections":"100"},"additionalProperties":{"anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}},"sharedPreloadLibraries":{"description":"Libraries loaded at server start, restricted to an allowlist of modules already shipped in the PostgreSQL image. CloudNativePG also preloads `pg_stat_statements`, `auto_explain` and `pgaudit` by itself whenever `parameters` sets a key under their prefix (e.g. `pg_stat_statements.track`), so removing one of them from this list does not unload it while such a key is set; `pg_prewarm` is preloaded only through this list. Changing the list restarts PostgreSQL on every instance, the primary included, so writes pause briefly.","type":"array","items":{"type":"string","enum":["pg_stat_statements","auto_explain","pgaudit","pg_prewarm"]}}}},"audit":{"description":"PostgreSQL audit configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring.","type":"boolean","default":false},"log":{"description":"pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing.","type":"string","default":"write, ddl, role","pattern":"^(\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*(,\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*)*)?$"}}},"quorum":{"description":"Quorum configuration for synchronous replication.","type":"object","default":{},"required":["maxSyncReplicas","minSyncReplicas"],"properties":{"maxSyncReplicas":{"description":"Maximum number of synchronous replicas allowed (must be less than total replicas). Under autoscaling it also sets the scale-down floor (the effective minimum is `max(minReplicas, maxSyncReplicas+1, 2)`); the chart fails to render if that floor exceeds `autoscaling.maxReplicas`.","type":"integer","default":0},"minSyncReplicas":{"description":"Minimum number of synchronous replicas required for commit.","type":"integer","default":0}}},"autoscaling":{"description":"Read-replica autoscaling configuration.","type":"object","default":{},"required":["dryRun","enabled","maxReplicas","maxReplicationLagSeconds","metric","minReplicas","serverAddress","target","transition"],"properties":{"dryRun":{"description":"Recommendation mode: keep the static count and render the ScaledObject with both scaling directions paused, so KEDA keeps the HPA and keeps serving its trigger metric but actuates neither way. Note both scaling policies are disabled, so the HPA's desiredReplicas is frozen to the current count - read the recommendation from the matching read-load dashboard panel for your metric (connections or CPU): desired = 1 + ceil(read load / target), clamped to [effectiveMin..maxReplicas] where effectiveMin = max(minReplicas, maxSyncReplicas+1, 2), not from the desired-replicas line. Like disabling, flipping a LIVE autoscaled cluster into dryRun re-renders `instances: replicas` (the raw static value, which can be below the autoscaling floor); if `replicas` is below the live count, stage it to the live count first (see the enablement note) or the cluster sheds down to `replicas`. No shed occurs when the rendered value is unchanged (replicas already equals the active seed) — client-side merge is then a no-op and the live count is preserved. Permanent, unlike `transition`.","type":"boolean","default":false},"enabled":{"description":"Enable horizontal autoscaling of read replicas. Requires the platform `keda` package to be enabled by an administrator first; the chart fails to render (rather than break the release) if KEDA is not installed. Prerequisite: the queried vmselect must hold BOTH the CNPG metrics (cnpg_backends_total / container CPU) AND kube_pod_labels (kube-state-metrics). This holds for a tenant on the shared root monitoring stack (`monitoring: false`, both land in tenant-root). A tenant running its OWN Monitoring app (`monitoring: true`) has the CNPG metrics but not kube_pod_labels (KSM is root-only), so it must set `serverAddress` to a vmselect carrying both series or autoscaling never actuates.","type":"boolean","default":false},"maxReplicas":{"description":"Maximum total instances. Must be >= minReplicas and >= the synchronous-quorum floor (maxSyncReplicas+1); the chart fails to render (rather than silently run an unbounded instance count) if the effective floor exceeds it - raise maxReplicas. HAZARD: lowering maxReplicas below the live count makes the HPA cut straight to the new maximum in one step (the current>max branch bypasses the scale-down pacing), shedding the surplus replicas + PVCs at once; to lower it deliberately, suspend the HelmRelease and pin the live count with `kubectl scale` first.","type":"integer","default":6},"maxReplicationLagSeconds":{"description":"Freeze scaling while replication lag exceeds this (seconds) and the primary is writing. 0 disables the brake. Default 0: the freeze branch has only been validated on a live cluster in its non-braking (pass-through) form, so the lag brake is opt-in until the braking path is exercised under load; set a positive value (e.g. 30) to enable it.","type":"integer","default":0},"metric":{"description":"Read-load signal to scale on.","type":"string","default":"ReadConnections","enum":["ReadConnections","ReadCPUUtilization"]},"minReplicas":{"description":"Minimum total instances; raised to the synchronous-quorum floor (`maxSyncReplicas + 1`) and to 2 when either is higher.","type":"integer","default":2},"serverAddress":{"description":"Override the Prometheus/vmselect URL the ScaledObject queries. Empty (default) derives `http://vmselect-shortterm..svc:8481/select/0/prometheus`. Set it when the derived vmselect does not hold both the CNPG metrics and kube_pod_labels (e.g. `monitoring: true` tenants, or a non-default `metricsStorages` name). SSRF constraint: the host must be an in-cluster Service DNS name (`..svc[.]`) whose namespace is within the tenant's own subtree (its namespace, its parents, or `tenant-root`) — the cluster-privileged KEDA operator fetches this URL every poll, so it is refused a metadata endpoint, an external host, or a sibling/system namespace. Residual surface (accepted trade-off): `tenant-root` is always allowed because the derived default points there, so a tenant can still aim the operator at any Service in `tenant-root` on any port/path (a blind in-cluster reachability probe — the operator reads no response body back to the tenant); the egress NetworkPolicy does not narrow that.","type":"string","default":""},"target":{"description":"Target read load per read-serving replica (unit depends on `metric`: active connections, or CPU millicores). Dimensionless integer - a resource.Quantity here would accept `150m`, which PromQL reads as 150 minutes and KEDA cannot use as a threshold.","type":"integer","default":150},"transition":{"description":"Migration phase 1: render `.spec.instances` from `replicas` (which the operator stages to the current live count) AND pause the ScaledObject in both directions, so KEDA stands up with its HPA present but not actuating. Flip to false (phase 2) to hand the runtime count to KEDA. Because the both-direction pause keeps the HPA (not the HPA-deleting full pause), KEDA is genuinely warm at phase 2 — no HPA recreate — and because the active seed is max(replicas, effectiveMin), phase 2 re-renders the same instance count phase 1 did (when `replicas` is staged at/above the floor), so the flip is a merge no-op with no dip. The HPA's scaleUp stabilization window still smooths the first actuation.","type":"boolean","default":false}}},"users":{"description":"Users configuration map. Each user is a PostgreSQL role the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SCRAM verifier, and a revoke retires the password without issuing one. A `password` key here is ignored and draws an admission warning. A password set inside PostgreSQL is reverted by the operator.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"bypassRls":{"description":"Whether the user can bypass row-level security policies (BYPASSRLS). A role can only create other roles carrying BYPASSRLS if it holds the attribute itself.","type":"boolean"},"createRole":{"description":"Not supported while users are CloudNativePG managed roles: the chart refuses to render when it is true, and a release that sets it keeps its previous chart version until it is false. CloudNativePG revokes every membership a managed role is not declared to hold, including the one PostgreSQL gives a CREATEROLE user in each role it creates. Setting it to false withdraws CREATEROLE from a role that held it.","type":"boolean"},"replication":{"description":"Whether the user has replication privileges.","type":"boolean"}}}},"databases":{"description":"Databases configuration map. The PostgreSQL system databases `postgres`, `template0` and `template1` are refused.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"extensions":{"description":"List of enabled PostgreSQL extensions.","type":"array","items":{"type":"string"}},"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"destinationPath":{"description":"DEPRECATED. Per-tenant S3 configuration is superseded by the platform-managed `cozy-default` BackupClass and the `cozy-backups` system bucket. Leave empty for new installations; the BackupClass driver picks up the system-managed coordinates. Kept for in-place upgrade compatibility.","type":"string","default":"s3://bucket/path/to/folder/"},"enabled":{"description":"Enable regular backups.","type":"boolean","default":false},"endpointCA":{"description":"DEPRECATED. Pre-existing Secret with the CA bundle the barman-cloud plugin should trust when reaching a self-signed S3 endpoint. Used for both backup and bootstrap recovery in the legacy chart-managed flow.","type":"object","default":{},"properties":{"key":{"description":"Key within the Secret containing the CA bundle. Defaults to `ca.crt`.","type":"string","default":""},"name":{"description":"Name of the Secret in the application namespace. Empty means no endpointCA is emitted (the plugin uses the system trust store).","type":"string","default":""}}},"endpointURL":{"description":"DEPRECATED. See `destinationPath`.","type":"string","default":"http://minio-gateway-service:9000"},"retentionPolicy":{"description":"Retention policy (e.g. \"30d\").","type":"string","default":"30d"},"s3AccessKey":{"description":"DEPRECATED. Tenants no longer supply S3 keys; the system Bucket Secret is projected into the tenant namespace by the backup controller. Ignored when `s3CredentialsSecret.name` is set or `useSystemBucket` is true. The chart skips materialising `-s3-creds` whenever this field is empty so a default install does not leak placeholder credentials into the tenant namespace.","type":"string","default":""},"s3CredentialsSecret":{"description":"DEPRECATED. Pre-existing Secret with S3 credentials. Use the platform-managed `cozy-default` BackupClass instead. When set, the chart references this Secret directly (legacy chart-managed flow). The CNPG backup driver writes this field on restore so credentials never land in the CR `.spec`.","type":"object","default":{},"properties":{"accessKeyIDKey":{"description":"Key in the Secret holding the access key ID. Defaults to `AWS_ACCESS_KEY_ID`.","type":"string","default":""},"name":{"description":"Name of the Secret in the application namespace. Empty means the chart materialises `-s3-creds` from `s3AccessKey`/`s3SecretKey`.","type":"string","default":""},"secretAccessKeyKey":{"description":"Key in the Secret holding the secret access key. Defaults to `AWS_SECRET_ACCESS_KEY`.","type":"string","default":""}}},"s3SecretKey":{"description":"DEPRECATED. See `s3AccessKey`.","type":"string","default":""},"schedule":{"description":"Legacy. Cron schedule for the chart-emitted ScheduledBackup, either a standard five-field cron such as `0 2 * * *` for every day at 02:00, or six fields with leading seconds such as `0 0 2 * * *` for the same time. Empty means no chart-managed schedule, which is the recommended setup when a `BackupClass` from `backups.cozystack.io` already drives backup orchestration. In the legacy chart-managed flow `spec.plugins` plus the barman-cloud ObjectStore is rendered when `backup.enabled=true` AND `useSystemBucket=false` AND `destinationPath` is non-empty AND inline-or-external creds are supplied; in the platform `useSystemBucket=true` flow the chart skips emitting `spec.plugins` and the CNPG driver SSA-applies the ObjectStore and patches `spec.plugins` onto the live Cluster at first BackupJob time.","type":"string","default":""},"useSystemBucket":{"description":"Opt-in: when true, the chart-emitted `-s3-creds` Secret is skipped AND `spec.plugins` (plus the barman-cloud ObjectStore) is left UNSET in the chart-rendered Cluster — the cozy-default BackupClass driver SSA-applies an ObjectStore (carrying destinationPath/endpointURL/credentials) and patches `spec.plugins` on the live Cluster when the first BackupJob runs. Consequence: plugin WAL archiving is NOT active until that first BackupJob fires; WAL accumulates on the PVC in the meantime, so fire an ad-hoc BackupJob immediately after enabling the flag on existing releases. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill `s3AccessKey`/`s3SecretKey` or `destinationPath`/`endpointURL`. The destination path automatically scopes to `s3://cozy-backups///`.","type":"boolean","default":false}}},"bootstrap":{"description":"Bootstrap configuration.","type":"object","default":{},"required":["enabled","oldName"],"properties":{"backupID":{"description":"Barman ID of the base backup to recover from, passed as `recoveryTarget.backupID`. Empty lets the barman-cloud plugin pick one: the newest backup when `recoveryTime` is empty, otherwise the newest one ending at or before it, on any timeline. The CNPG backup driver sets this on restore.","type":"string","default":""},"enabled":{"description":"Whether to restore from a backup.","type":"boolean","default":false},"newServerName":{"description":"WAL-archive server name (S3 path prefix) the RESTORED cluster writes to. Must differ from `serverName` (the recovery source) so a restored cluster archives to a fresh, empty prefix and barman-cloud-check-wal-archive passes while it recovers from the source's prefix. The CNPG backup driver sets this on restore; empty means the cluster archives under its own name.","type":"string","default":""},"oldName":{"description":"Previous cluster name before deletion.","type":"string","default":""},"recoveryTime":{"description":"Timestamp (RFC3339) for point-in-time recovery; empty means latest.","type":"string","default":""},"serverName":{"description":"Server name (S3 path prefix) used by the original cluster when writing backups; passed to the barman-cloud plugin via `externalClusters[].plugin.parameters.serverName`. Defaults to `bootstrap.oldName`. Set this only when the original cluster wrote backups under an explicit server name that differed from its Kubernetes resource name.","type":"string","default":""},"sourceImageName":{"description":"Image of the cluster the backup was taken from. A restore of a backup taken on one of the bare Debian bullseye tags the chart used before standard-trixie comes back on that image (see `allowCollationChange`); any other value is ignored. The CNPG backup driver sets this on restore and clears it with `enabled`.","type":"string","default":""}}}}} + {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Postgres replicas. Under active autoscaling this is the resting/seed count, not the live count — KEDA drives the live count via `/scale`. Disabling autoscaling does NOT automatically bring the live count back to `replicas`: the client-side merge writes `instances` only when the rendered value changes, so a cluster KEDA grew past `replicas` stays there with no autoscaler left to reduce it — lower `replicas` to the count you want and it rebases down (shedding the surplus replicas + PVCs). Lowering it below the live count, or disabling/dry-running while it sits below the live count, sheds in one step past the scaleDown pacing; stage it to the live count first (suspend the HelmRelease and `kubectl scale` if needed) to avoid a transient. Must stay greater than `quorum.maxSyncReplicas`.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each PostgreSQL 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.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":"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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"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},"version":{"description":"PostgreSQL major version to deploy","type":"string","default":"v18","enum":["v18","v17","v16","v15","v14","v13"]},"flavor":{"description":"PostgreSQL image flavor, fixed when the cluster is created. `postgresql` uses the CloudNativePG PostgreSQL image. `postgis` uses the CloudNativePG PostGIS image, which adds postgis, postgis_raster, postgis_topology, postgis_sfcgal, postgis_tiger_geocoder and address_standardizer; enable them per database in `databases..extensions`. Changing the flavor of an existing cluster is refused, and a backup restores only into a cluster of the flavor it was taken from: to change flavor, create a new cluster and move the data with a logical dump (pg_dump / pg_restore).","type":"string","default":"postgresql","enum":["postgresql","postgis"]},"allowCollationChange":{"description":"Allow a cluster created on a Debian bullseye image (before the move to standard-trixie) to move to the new image without a clean locale check. Such a cluster is checked before each upgrade, except while `bootstrap.enabled` is set (set it back to false once a restore set up by hand has finished), and stays on its current image until the check finds nothing that depends on a collation other than C, POSIX or builtin: while this is false, a cluster the check found affected (an ICU or libc locale, or C.UTF-8) or could not finish on stays put, because glibc and ICU on the new image sort text differently and every index on such text must be rebuilt. A held cluster runs the bare bullseye tag it has, gets no further PostgreSQL minors and so none of their security fixes, and refuses a change of `version`, since new majors are built only on the new images. To leave that state, either remove the dependency (move such columns and indexes to C, or to the builtin `pg_c_utf8` on PostgreSQL 17 and later) and let the next upgrade check again, or set this to true in a maintenance window: the cluster moves on the next upgrade, replicas restart on the new image first and can return wrong results through `-ro`, and unique indexes can accept duplicates, until the indexes are rebuilt on the primary. The collation repair Job, which a post-upgrade hook starts once the init Job is done, rebuilds the indexes on such text after the rollout, those on C.UTF-8 and other C.* locales included, and its log reports a rebuild that failed; check range partitions, CHECK constraints and materialized views on it, which a rebuild does not fix. A held cluster shows the hold only as an unchanged image; the result and the objects found are in the `postgres.cozystack.io/locale-data` and `postgres.cozystack.io/locale-data-objects` annotations of the cnpg.io Cluster, which an administrator can read. A restore of a backup taken on one of those bullseye images comes back on that image and is checked by the next upgrade.","type":"boolean","default":false},"tls":{"description":"TLS configuration for server connections.","type":"object","default":{},"properties":{"enabled":{"description":"Tri-state switch controlling whether the chart injects the external hostnames into the operator-managed CNPG cert via spec.certificates.serverAltDNSNames. When omitted, the chart injects them if `external: true` and skips them otherwise. Set explicitly to `true` to inject regardless of `external` (no-op when `external: false` since there is no external hostname to add). Set to `false` to skip injection. Note that CNPG keeps its built-in TLS on the wire regardless of this flag — this toggle only controls the chart-side SAN injection; to disable PostgreSQL TLS entirely set `postgresql.parameters.ssl = \"off\"` at the CNPG layer.","type":"boolean"},"required":{"description":"Tri-state switch controlling whether the server refuses sessions that are not encrypted. When omitted, it is on if `external: true` and off otherwise. When on, the chart renders `spec.postgresql.pg_hba` with `hostssl all all all scram-sha-256` (`md5` on PostgreSQL 13, matching CloudNativePG's default rule) followed by `host all all all reject`, so a client that connects with `sslmode=disable` is refused instead of getting a plaintext session; in-cluster clients are held to the same rule, since the pod network cannot be told apart from an external client. Set to `false` to keep accepting plaintext sessions on an external instance, or to `true` to require TLS on an in-cluster one. Rendering fails if `postgresql.parameters.ssl` is off while this is in effect.","type":"boolean"}}},"postgresql":{"description":"PostgreSQL server configuration.","type":"object","default":{},"properties":{"parameters":{"description":"PostgreSQL server parameters. Values may be strings or integers; integers are coerced to strings by the template (e.g. both `max_connections: 100` and `max_connections: \"100\"` are accepted). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.","type":"object","default":{"max_connections":"100"},"additionalProperties":{"anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}},"sharedPreloadLibraries":{"description":"Libraries loaded at server start, restricted to an allowlist of modules already shipped in the PostgreSQL image. CloudNativePG also preloads `pg_stat_statements`, `auto_explain` and `pgaudit` by itself whenever `parameters` sets a key under their prefix (e.g. `pg_stat_statements.track`), so removing one of them from this list does not unload it while such a key is set; `pg_prewarm` is preloaded only through this list. Changing the list restarts PostgreSQL on every instance, the primary included, so writes pause briefly.","type":"array","items":{"type":"string","enum":["pg_stat_statements","auto_explain","pgaudit","pg_prewarm"]}}}},"audit":{"description":"PostgreSQL audit configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring.","type":"boolean","default":false},"log":{"description":"pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing.","type":"string","default":"write, ddl, role","pattern":"^(\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*(,\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*)*)?$"}}},"quorum":{"description":"Quorum configuration for synchronous replication.","type":"object","default":{},"required":["maxSyncReplicas","minSyncReplicas"],"properties":{"maxSyncReplicas":{"description":"Maximum number of synchronous replicas allowed (must be less than total replicas). Under autoscaling it also sets the scale-down floor (the effective minimum is `max(minReplicas, maxSyncReplicas+1, 2)`); the chart fails to render if that floor exceeds `autoscaling.maxReplicas`.","type":"integer","default":0},"minSyncReplicas":{"description":"Minimum number of synchronous replicas required for commit.","type":"integer","default":0}}},"autoscaling":{"description":"Read-replica autoscaling configuration.","type":"object","default":{},"required":["dryRun","enabled","maxReplicas","maxReplicationLagSeconds","metric","minReplicas","serverAddress","target","transition"],"properties":{"dryRun":{"description":"Recommendation mode: keep the static count and render the ScaledObject with both scaling directions paused, so KEDA keeps the HPA and keeps serving its trigger metric but actuates neither way. Note both scaling policies are disabled, so the HPA's desiredReplicas is frozen to the current count - read the recommendation from the matching read-load dashboard panel for your metric (connections or CPU): desired = 1 + ceil(read load / target), clamped to [effectiveMin..maxReplicas] where effectiveMin = max(minReplicas, maxSyncReplicas+1, 2), not from the desired-replicas line. Like disabling, flipping a LIVE autoscaled cluster into dryRun re-renders `instances: replicas` (the raw static value, which can be below the autoscaling floor); if `replicas` is below the live count, stage it to the live count first (see the enablement note) or the cluster sheds down to `replicas`. No shed occurs when the rendered value is unchanged (replicas already equals the active seed) — client-side merge is then a no-op and the live count is preserved. Permanent, unlike `transition`.","type":"boolean","default":false},"enabled":{"description":"Enable horizontal autoscaling of read replicas. Requires the platform `keda` package to be enabled by an administrator first; the chart fails to render (rather than break the release) if KEDA is not installed. Prerequisite: the queried vmselect must hold BOTH the CNPG metrics (cnpg_backends_total / container CPU) AND kube_pod_labels (kube-state-metrics). This holds for a tenant on the shared root monitoring stack (`monitoring: false`, both land in tenant-root). A tenant running its OWN Monitoring app (`monitoring: true`) has the CNPG metrics but not kube_pod_labels (KSM is root-only), so it must set `serverAddress` to a vmselect carrying both series or autoscaling never actuates.","type":"boolean","default":false},"maxReplicas":{"description":"Maximum total instances. Must be >= minReplicas and >= the synchronous-quorum floor (maxSyncReplicas+1); the chart fails to render (rather than silently run an unbounded instance count) if the effective floor exceeds it - raise maxReplicas. HAZARD: lowering maxReplicas below the live count makes the HPA cut straight to the new maximum in one step (the current>max branch bypasses the scale-down pacing), shedding the surplus replicas + PVCs at once; to lower it deliberately, suspend the HelmRelease and pin the live count with `kubectl scale` first.","type":"integer","default":6},"maxReplicationLagSeconds":{"description":"Freeze scaling while replication lag exceeds this (seconds) and the primary is writing. 0 disables the brake. Default 0: the freeze branch has only been validated on a live cluster in its non-braking (pass-through) form, so the lag brake is opt-in until the braking path is exercised under load; set a positive value (e.g. 30) to enable it.","type":"integer","default":0},"metric":{"description":"Read-load signal to scale on.","type":"string","default":"ReadConnections","enum":["ReadConnections","ReadCPUUtilization"]},"minReplicas":{"description":"Minimum total instances; raised to the synchronous-quorum floor (`maxSyncReplicas + 1`) and to 2 when either is higher.","type":"integer","default":2},"serverAddress":{"description":"Override the Prometheus/vmselect URL the ScaledObject queries. Empty (default) derives `http://vmselect-shortterm..svc:8481/select/0/prometheus`. Set it when the derived vmselect does not hold both the CNPG metrics and kube_pod_labels (e.g. `monitoring: true` tenants, or a non-default `metricsStorages` name). SSRF constraint: the host must be an in-cluster Service DNS name (`..svc[.]`) whose namespace is within the tenant's own subtree (its namespace, its parents, or `tenant-root`) — the cluster-privileged KEDA operator fetches this URL every poll, so it is refused a metadata endpoint, an external host, or a sibling/system namespace. Residual surface (accepted trade-off): `tenant-root` is always allowed because the derived default points there, so a tenant can still aim the operator at any Service in `tenant-root` on any port/path (a blind in-cluster reachability probe — the operator reads no response body back to the tenant); the egress NetworkPolicy does not narrow that.","type":"string","default":""},"target":{"description":"Target read load per read-serving replica (unit depends on `metric`: active connections, or CPU millicores). Dimensionless integer - a resource.Quantity here would accept `150m`, which PromQL reads as 150 minutes and KEDA cannot use as a threshold.","type":"integer","default":150},"transition":{"description":"Migration phase 1: render `.spec.instances` from `replicas` (which the operator stages to the current live count) AND pause the ScaledObject in both directions, so KEDA stands up with its HPA present but not actuating. Flip to false (phase 2) to hand the runtime count to KEDA. Because the both-direction pause keeps the HPA (not the HPA-deleting full pause), KEDA is genuinely warm at phase 2 — no HPA recreate — and because the active seed is max(replicas, effectiveMin), phase 2 re-renders the same instance count phase 1 did (when `replicas` is staged at/above the floor), so the flip is a merge no-op with no dip. The HPA's scaleUp stabilization window still smooths the first actuation.","type":"boolean","default":false}}},"users":{"description":"Users configuration map. Each user is a PostgreSQL role the operator manages from an account Secret the platform keeps. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once and stores only its SCRAM verifier, and a revoke retires the password without issuing one. A `password` key here is ignored and draws an admission warning. A password set inside PostgreSQL is reverted by the operator.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"bypassRls":{"description":"Whether the user can bypass row-level security policies (BYPASSRLS). A role can only create other roles carrying BYPASSRLS if it holds the attribute itself.","type":"boolean"},"createRole":{"description":"Not supported while users are CloudNativePG managed roles: the chart refuses to render when it is true, and a release that sets it keeps its previous chart version until it is false. CloudNativePG revokes every membership a managed role is not declared to hold, including the one PostgreSQL gives a CREATEROLE user in each role it creates. Setting it to false withdraws CREATEROLE from a role that held it.","type":"boolean"},"replication":{"description":"Whether the user has replication privileges.","type":"boolean"}}}},"databases":{"description":"Databases configuration map. The PostgreSQL system databases `postgres`, `template0` and `template1` are refused.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"extensions":{"description":"List of enabled PostgreSQL extensions.","type":"array","items":{"type":"string"}},"roles":{"description":"Roles assigned to users.","type":"object","properties":{"admin":{"description":"List of users with admin privileges.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of users with read-only privileges.","type":"array","items":{"type":"string"}}}}}}},"backup":{"description":"Backup configuration.","type":"object","default":{},"required":["enabled"],"properties":{"destinationPath":{"description":"DEPRECATED. Per-tenant S3 configuration is superseded by the platform-managed `cozy-default` BackupClass and the `cozy-backups` system bucket. Leave empty for new installations; the BackupClass driver picks up the system-managed coordinates. Kept for in-place upgrade compatibility.","type":"string","default":"s3://bucket/path/to/folder/","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"enabled":{"description":"Enable regular backups.","type":"boolean","default":false},"endpointCA":{"description":"DEPRECATED. Pre-existing Secret with the CA bundle the barman-cloud plugin should trust when reaching a self-signed S3 endpoint. Used for both backup and bootstrap recovery in the legacy chart-managed flow.","type":"object","default":{},"properties":{"key":{"description":"Key within the Secret containing the CA bundle. Defaults to `ca.crt`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"name":{"description":"Name of the Secret in the application namespace. Empty means no endpointCA is emitted (the plugin uses the system trust store).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"endpointURL":{"description":"DEPRECATED. See `destinationPath`.","type":"string","default":"http://minio-gateway-service:9000","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"retentionPolicy":{"description":"Retention policy (e.g. \"30d\").","type":"string","default":"30d","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"s3AccessKey":{"description":"DEPRECATED. Tenants no longer supply S3 keys; the system Bucket Secret is projected into the tenant namespace by the backup controller. Ignored when `s3CredentialsSecret.name` is set or `useSystemBucket` is true. The chart skips materialising `-s3-creds` whenever this field is empty so a default install does not leak placeholder credentials into the tenant namespace.","type":"string","default":""},"s3CredentialsSecret":{"description":"DEPRECATED. Pre-existing Secret with S3 credentials. Use the platform-managed `cozy-default` BackupClass instead. When set, the chart references this Secret directly (legacy chart-managed flow). The CNPG backup driver writes this field on restore so credentials never land in the CR `.spec`.","type":"object","default":{},"properties":{"accessKeyIDKey":{"description":"Key in the Secret holding the access key ID. Defaults to `AWS_ACCESS_KEY_ID`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"},"name":{"description":"Name of the Secret in the application namespace. Empty means the chart materialises `-s3-creds` from `s3AccessKey`/`s3SecretKey`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"secretAccessKeyKey":{"description":"Key in the Secret holding the secret access key. Defaults to `AWS_SECRET_ACCESS_KEY`.","type":"string","default":"","maxLength":253,"pattern":"^[-._a-zA-Z0-9]*$"}}},"s3SecretKey":{"description":"DEPRECATED. See `s3AccessKey`.","type":"string","default":""},"schedule":{"description":"Legacy. Cron schedule for the chart-emitted ScheduledBackup, either a standard five-field cron such as `0 2 * * *` for every day at 02:00, or six fields with leading seconds such as `0 0 2 * * *` for the same time. Empty means no chart-managed schedule, which is the recommended setup when a `BackupClass` from `backups.cozystack.io` already drives backup orchestration. In the legacy chart-managed flow `spec.plugins` plus the barman-cloud ObjectStore is rendered when `backup.enabled=true` AND `useSystemBucket=false` AND `destinationPath` is non-empty AND inline-or-external creds are supplied; in the platform `useSystemBucket=true` flow the chart skips emitting `spec.plugins` and the CNPG driver SSA-applies the ObjectStore and patches `spec.plugins` onto the live Cluster at first BackupJob time.","type":"string","default":""},"useSystemBucket":{"description":"Opt-in: when true, the chart-emitted `-s3-creds` Secret is skipped AND `spec.plugins` (plus the barman-cloud ObjectStore) is left UNSET in the chart-rendered Cluster — the cozy-default BackupClass driver SSA-applies an ObjectStore (carrying destinationPath/endpointURL/credentials) and patches `spec.plugins` on the live Cluster when the first BackupJob runs. Consequence: plugin WAL archiving is NOT active until that first BackupJob fires; WAL accumulates on the PVC in the meantime, so fire an ad-hoc BackupJob immediately after enabling the flag on existing releases. Use together with the platform `cozy-default` BackupClass — tenants do not need to fill `s3AccessKey`/`s3SecretKey` or `destinationPath`/`endpointURL`. The destination path automatically scopes to `s3://cozy-backups///`.","type":"boolean","default":false}}},"bootstrap":{"description":"Bootstrap configuration.","type":"object","default":{},"required":["enabled","oldName"],"properties":{"backupID":{"description":"Barman ID of the base backup to recover from, passed as `recoveryTarget.backupID`. Empty lets the barman-cloud plugin pick one: the newest backup when `recoveryTime` is empty, otherwise the newest one ending at or before it, on any timeline. The CNPG backup driver sets this on restore.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"enabled":{"description":"Whether to restore from a backup.","type":"boolean","default":false},"newServerName":{"description":"WAL-archive server name (S3 path prefix) the RESTORED cluster writes to. Must differ from `serverName` (the recovery source) so a restored cluster archives to a fresh, empty prefix and barman-cloud-check-wal-archive passes while it recovers from the source's prefix. The CNPG backup driver sets this on restore; empty means the cluster archives under its own name.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"oldName":{"description":"Previous cluster name before deletion.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"recoveryTime":{"description":"Timestamp (RFC3339) for point-in-time recovery; empty means latest.","type":"string","default":"","pattern":"^[0-9TZtz:.+ -]*$"},"serverName":{"description":"Server name (S3 path prefix) used by the original cluster when writing backups; passed to the barman-cloud plugin via `externalClusters[].plugin.parameters.serverName`. Defaults to `bootstrap.oldName`. Set this only when the original cluster wrote backups under an explicit server name that differed from its Kubernetes resource name.","type":"string","default":"","pattern":"^[^\\s\"'$`\\x5c;&|<>(){}]*$"},"sourceImageName":{"description":"Image of the cluster the backup was taken from. A restore of a backup taken on one of the bare Debian bullseye tags the chart used before standard-trixie comes back on that image (see `allowCollationChange`); any other value is ignored. The CNPG backup driver sets this on restore and clears it with `enabled`.","type":"string","default":""}}}}} release: prefix: postgres- labels: diff --git a/packages/system/qdrant-rd/cozyrds/qdrant.yaml b/packages/system/qdrant-rd/cozyrds/qdrant.yaml index fad89e57a..9fe2ffd35 100644 --- a/packages/system/qdrant-rd/cozyrds/qdrant.yaml +++ b/packages/system/qdrant-rd/cozyrds/qdrant.yaml @@ -8,7 +8,7 @@ spec: plural: qdrants singular: qdrant openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Qdrant replicas. Cluster mode is automatically enabled when replicas > 1.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each Qdrant 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 vector data storage.","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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. When omitted, the effective TLS state follows the value of `external`.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS. When unset, inherits the value of `external` (TLS is on when external access is enabled). Set explicitly to `true` or `false` to override.","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":{"replicas":{"description":"Number of Qdrant replicas. Cluster mode is automatically enabled when replicas > 1.","type":"integer","default":1},"resources":{"description":"Explicit CPU and memory configuration for each Qdrant 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 vector data storage.","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. When omitted, the effective TLS state follows the value of `external`.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS. When unset, inherits the value of `external` (TLS is on when external access is enabled). Set explicitly to `true` or `false` to override.","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: qdrant- labels: diff --git a/packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml b/packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml index f731dbc84..8613f427f 100644 --- a/packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml +++ b/packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml @@ -8,7 +8,7 @@ spec: plural: rabbitmqs singular: rabbitmq openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of RabbitMQ replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each RabbitMQ replica. Every resource left unset here is taken from `resourcesPreset`.","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. It supplies every resource `resources` does not set, not only a `resources` left empty entirely.","type":"string","default":"s1.nano","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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"affinity":{"description":"Pod affinity applied to RabbitMQ pods (standard Kubernetes corev1.Affinity). Use podAntiAffinity with topologyKey `kubernetes.io/hostname` to spread RabbitMQ pods across nodes.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"tls":{"description":"TLS configuration. TLS is off unless `tls.enabled` is set to true.","type":"object","default":{},"properties":{"disableNonTLSListeners":{"description":"Close the plaintext AMQP (5672) and management (15672) listeners. This is a broker-level switch: it drops in-cluster clients as well as external ones, and it cannot be combined with `users` or `vhosts`. Erlang distribution (25672) and epmd (4369) stay plaintext regardless. Defaults to false.","type":"boolean"},"enabled":{"description":"Enable TLS for AMQPS (5671) and Management HTTPS (15671). Applies whether or not `external` is set. Plaintext AMQP (5672) and management (15672) keep serving unless `disableNonTLSListeners` is set as well. Moves the `port` key of the `-default-user` Secret from 5672 to 5671, and the metrics port from 15692 to 15691. Defaults to false.","type":"boolean"}}},"version":{"description":"RabbitMQ major.minor version to deploy","type":"string","default":"v4.2","enum":["v4.2","v4.1","v4.0","v3.13"]},"users":{"description":"Users configuration map. Each user is a RabbitMQ user that messaging-topology-operator keeps from an account Secret the platform holds. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once, and a revoke retires the password without issuing one. The operator applies either to the broker within seconds. A `password` key here is ignored. The administrator in `-default-user` belongs to the platform and is not shown to tenants.","type":"object","default":{},"additionalProperties":{"type":"object"}},"vhosts":{"description":"Virtual hosts configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","required":["roles"],"properties":{"roles":{"description":"Virtual host roles list.","type":"object","properties":{"admin":{"description":"List of admin users.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of readonly users.","type":"array","items":{"type":"string"}}}}}}},"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 RabbitMQ replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration for each RabbitMQ replica. Every resource left unset here is taken from `resourcesPreset`.","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. It supplies every resource `resources` does not set, not only a `resources` left empty entirely.","type":"string","default":"s1.nano","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"affinity":{"description":"Pod affinity applied to RabbitMQ pods (standard Kubernetes corev1.Affinity). Use podAntiAffinity with topologyKey `kubernetes.io/hostname` to spread RabbitMQ pods across nodes.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"tls":{"description":"TLS configuration. TLS is off unless `tls.enabled` is set to true.","type":"object","default":{},"properties":{"disableNonTLSListeners":{"description":"Close the plaintext AMQP (5672) and management (15672) listeners. This is a broker-level switch: it drops in-cluster clients as well as external ones, and it cannot be combined with `users` or `vhosts`. Erlang distribution (25672) and epmd (4369) stay plaintext regardless. Defaults to false.","type":"boolean"},"enabled":{"description":"Enable TLS for AMQPS (5671) and Management HTTPS (15671). Applies whether or not `external` is set. Plaintext AMQP (5672) and management (15672) keep serving unless `disableNonTLSListeners` is set as well. Moves the `port` key of the `-default-user` Secret from 5672 to 5671, and the metrics port from 15692 to 15691. Defaults to false.","type":"boolean"}}},"version":{"description":"RabbitMQ major.minor version to deploy","type":"string","default":"v4.2","enum":["v4.2","v4.1","v4.0","v3.13"]},"users":{"description":"Users configuration map. Each user is a RabbitMQ user that messaging-topology-operator keeps from an account Secret the platform holds. Passwords are issued through the Cozystack credentials API: a mint on the account's `Credential` (`core.cozystack.io`) returns a new password once, and a revoke retires the password without issuing one. The operator applies either to the broker within seconds. A `password` key here is ignored. The administrator in `-default-user` belongs to the platform and is not shown to tenants.","type":"object","default":{},"additionalProperties":{"type":"object"}},"vhosts":{"description":"Virtual hosts configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","required":["roles"],"properties":{"roles":{"description":"Virtual host roles list.","type":"object","properties":{"admin":{"description":"List of admin users.","type":"array","items":{"type":"string"}},"readonly":{"description":"List of readonly users.","type":"array","items":{"type":"string"}}}}}}},"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: rabbitmq- labels: diff --git a/packages/system/redis-rd/cozyrds/redis.yaml b/packages/system/redis-rd/cozyrds/redis.yaml index 768fd25b1..b42e781bc 100644 --- a/packages/system/redis-rd/cozyrds/redis.yaml +++ b/packages/system/redis-rd/cozyrds/redis.yaml @@ -8,7 +8,7 @@ spec: plural: redises singular: redis openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Redis replicas. Three Sentinels watch them, or a single one when `replicas` is 1, since a lone pod has no replica to fail over to.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each Redis 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.nano","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"]},"affinity":{"description":"Kubernetes affinity configuration for Redis and Sentinel pods.","type":"object","default":{},"properties":{"redis":{"description":"Kubernetes Affinity for Redis pods. When set, redis-operator uses it verbatim and does not add its default soft podAntiAffinity; include podAntiAffinity unless replica co-location is intended.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"sentinel":{"description":"Kubernetes Affinity for Sentinel pods. When set, redis-operator uses it verbatim and does not add its default soft podAntiAffinity; include podAntiAffinity unless replica co-location is intended.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"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},"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"}},"external":{"description":"Enable external access from outside the cluster. Can be enabled only when the instance is created, together with `tls.enabled: true`; turning it on for an existing instance, or changing `tls.enabled` while it is on, is refused at admission.","type":"boolean","default":false},"version":{"description":"Redis major version to deploy. The Redis and Sentinel pods run the same image.","type":"string","default":"v8","enum":["v8","v7"]},"tls":{"description":"TLS configuration. TLS is opt-in and is not inferred from `external`.","type":"object","default":{},"properties":{"authClients":{"description":"Maps to the Redis `tls-auth-clients` directive. Defaults to `no` — the server certificate is presented but client certificates are not validated. `yes` requires a client certificate signed by this release's CA, which the platform does not issue. Changing it restarts the Redis and Sentinel pods, because the directive is read from the config file once at startup.","type":"string","enum":["no","optional","yes"]},"enabled":{"description":"Enable TLS for Redis and Sentinel connections. Disabled unless set. Enabling it moves Redis and Sentinel to a TLS-only listener, so existing plaintext clients must be migrated at the same time. Encryption is provided by the redis-operator fork that mounts the certificate Secret into both Redis and Sentinel pods at `/tls`.","type":"boolean"}}},"authEnabled":{"description":"Require a password. The password of the `default` user is issued through the credentials API, and issuing a new one takes effect without restarting anything. Replication, the Sentinels and the metrics exporter use an internal account of their own; backups use the `default` password.","type":"boolean","default":true},"minReplicasToWrite":{"description":"Redis `min-replicas-to-write`: the master refuses writes unless at least this many replicas are connected and within `minReplicasMaxLag`. Unset by default, which leaves the Redis default (disabled). With `replicas: 2` and a value of 1 the master rejects writes while its only replica is down, trading availability for a bound on the writes lost if an isolated master is failed over. Replication stays asynchronous, so this bounds the loss, it does not remove it. Must be 0 or more and below `replicas` (a master with `replicas` pods has `replicas - 1` replicas), otherwise every write is refused; the chart refuses such a value.","type":"integer","minimum":0},"minReplicasMaxLag":{"description":"Redis `min-replicas-max-lag`, in seconds: a replica whose last acknowledgement is older than this does not count towards `minReplicasToWrite`. Unset by default, which leaves the Redis default (10). Has no effect unless `minReplicasToWrite` is set. Must be at least 1 when `minReplicasToWrite` is set: Redis treats 0 as disabling the check, so the chart refuses it.","type":"integer","minimum":0},"maxmemory":{"description":"Redis `maxmemory`: the dataset size at which Redis applies `maxmemoryPolicy`. Unset by default, which renders `maxmemory 0` (no limit, the Redis default), so a value set by hand with `CONFIG SET` is reset on the next reconcile. Must be at most 90% of the memory request of each Redis pod (from `resources` or `resourcesPreset`): the operator silently drops a larger value, so the chart refuses it. Leave headroom below that for replication and snapshot buffers.","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},"maxmemoryPolicy":{"description":"Redis `maxmemory-policy`: what Redis does once `maxmemory` is reached. `noeviction` refuses writes; `allkeys-lru` evicts the least recently used keys, which suits an instance used purely as a cache. Has no effect while `maxmemory` is unset.","type":"string","default":"noeviction","enum":["noeviction","allkeys-lru","allkeys-lfu","allkeys-random","volatile-lru","volatile-lfu","volatile-random","volatile-ttl"]},"snapshots":{"description":"Write RDB snapshots to the persistent volume (the Redis `save` directive, with the Redis default schedule). Set to `false` for an instance used purely as a cache: `save \"\"` is rendered and the volume is kept, so no further scheduled snapshot is written while replicas still have room for the full-sync RDB they write to disk. An RDB file already on the volume is not removed, and Redis loads it on restart, so turning snapshots off does not by itself empty the dataset. Always off when `size` is empty.","type":"boolean","default":true},"sentinel":{"description":"Sentinel configuration. When `sentinel.resources` is empty and `sentinel.resourcesPreset` is unset, the Sentinel pods are sized like the Redis pods (`resources` and `resourcesPreset`). An empty `sentinel.resources` map counts as unset, as an empty top-level `resources` does.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration for each Sentinel pod. Keys left out are filled from the preset in `sentinel.resourcesPreset`.","type":"object","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":"Sizing preset for the Sentinel pods. Defaults to `resourcesPreset`.","type":"string","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"]}}},"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 Redis replicas. Three Sentinels watch them, or a single one when `replicas` is 1, since a lone pod has no replica to fail over to.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each Redis 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.nano","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"]},"affinity":{"description":"Kubernetes affinity configuration for Redis and Sentinel pods.","type":"object","default":{},"properties":{"redis":{"description":"Kubernetes Affinity for Redis pods. When set, redis-operator uses it verbatim and does not add its default soft podAntiAffinity; include podAntiAffinity unless replica co-location is intended.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true},"sentinel":{"description":"Kubernetes Affinity for Sentinel pods. When set, redis-operator uses it verbatim and does not add its default soft podAntiAffinity; include podAntiAffinity unless replica co-location is intended.","type":"object","default":{},"x-kubernetes-preserve-unknown-fields":true}}},"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},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster. Can be enabled only when the instance is created, together with `tls.enabled: true`; turning it on for an existing instance, or changing `tls.enabled` while it is on, is refused at admission.","type":"boolean","default":false},"version":{"description":"Redis major version to deploy. The Redis and Sentinel pods run the same image.","type":"string","default":"v8","enum":["v8","v7"]},"tls":{"description":"TLS configuration. TLS is opt-in and is not inferred from `external`.","type":"object","default":{},"properties":{"authClients":{"description":"Maps to the Redis `tls-auth-clients` directive. Defaults to `no` — the server certificate is presented but client certificates are not validated. `yes` requires a client certificate signed by this release's CA, which the platform does not issue. Changing it restarts the Redis and Sentinel pods, because the directive is read from the config file once at startup.","type":"string","enum":["no","optional","yes"]},"enabled":{"description":"Enable TLS for Redis and Sentinel connections. Disabled unless set. Enabling it moves Redis and Sentinel to a TLS-only listener, so existing plaintext clients must be migrated at the same time. Encryption is provided by the redis-operator fork that mounts the certificate Secret into both Redis and Sentinel pods at `/tls`.","type":"boolean"}}},"authEnabled":{"description":"Require a password. The password of the `default` user is issued through the credentials API, and issuing a new one takes effect without restarting anything. Replication, the Sentinels and the metrics exporter use an internal account of their own; backups use the `default` password.","type":"boolean","default":true},"minReplicasToWrite":{"description":"Redis `min-replicas-to-write`: the master refuses writes unless at least this many replicas are connected and within `minReplicasMaxLag`. Unset by default, which leaves the Redis default (disabled). With `replicas: 2` and a value of 1 the master rejects writes while its only replica is down, trading availability for a bound on the writes lost if an isolated master is failed over. Replication stays asynchronous, so this bounds the loss, it does not remove it. Must be 0 or more and below `replicas` (a master with `replicas` pods has `replicas - 1` replicas), otherwise every write is refused; the chart refuses such a value.","type":"integer","minimum":0},"minReplicasMaxLag":{"description":"Redis `min-replicas-max-lag`, in seconds: a replica whose last acknowledgement is older than this does not count towards `minReplicasToWrite`. Unset by default, which leaves the Redis default (10). Has no effect unless `minReplicasToWrite` is set. Must be at least 1 when `minReplicasToWrite` is set: Redis treats 0 as disabling the check, so the chart refuses it.","type":"integer","minimum":0},"maxmemory":{"description":"Redis `maxmemory`: the dataset size at which Redis applies `maxmemoryPolicy`. Unset by default, which renders `maxmemory 0` (no limit, the Redis default), so a value set by hand with `CONFIG SET` is reset on the next reconcile. Must be at most 90% of the memory request of each Redis pod (from `resources` or `resourcesPreset`): the operator silently drops a larger value, so the chart refuses it. Leave headroom below that for replication and snapshot buffers.","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},"maxmemoryPolicy":{"description":"Redis `maxmemory-policy`: what Redis does once `maxmemory` is reached. `noeviction` refuses writes; `allkeys-lru` evicts the least recently used keys, which suits an instance used purely as a cache. Has no effect while `maxmemory` is unset.","type":"string","default":"noeviction","enum":["noeviction","allkeys-lru","allkeys-lfu","allkeys-random","volatile-lru","volatile-lfu","volatile-random","volatile-ttl"]},"snapshots":{"description":"Write RDB snapshots to the persistent volume (the Redis `save` directive, with the Redis default schedule). Set to `false` for an instance used purely as a cache: `save \"\"` is rendered and the volume is kept, so no further scheduled snapshot is written while replicas still have room for the full-sync RDB they write to disk. An RDB file already on the volume is not removed, and Redis loads it on restart, so turning snapshots off does not by itself empty the dataset. Always off when `size` is empty.","type":"boolean","default":true},"sentinel":{"description":"Sentinel configuration. When `sentinel.resources` is empty and `sentinel.resourcesPreset` is unset, the Sentinel pods are sized like the Redis pods (`resources` and `resourcesPreset`). An empty `sentinel.resources` map counts as unset, as an empty top-level `resources` does.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration for each Sentinel pod. Keys left out are filled from the preset in `sentinel.resourcesPreset`.","type":"object","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":"Sizing preset for the Sentinel pods. Defaults to `resourcesPreset`.","type":"string","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"]}}},"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: redis- labels: diff --git a/packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml b/packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml index 05fe76b0c..b769e254d 100644 --- a/packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml +++ b/packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml @@ -8,7 +8,7 @@ spec: singular: seaweedfs plural: seaweedfses openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":""},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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 size.","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":""}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]},"topologySpreadPolicy":{"description":"How strictly the masters are kept one per node. `hard` keeps them apart through a drain, but counts every node, including one the masters cannot run on such as a tainted control plane, so with such a node the masters need as many usable nodes as replicas. `soft` drops the spread constraint and keeps only the preferred anti-affinity, for clusters with fewer usable nodes than masters.","type":"string","default":"hard","enum":["hard","soft"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"The hostname used to expose or access the filer service externally.","type":"string","default":""},"grpcPort":{"description":"The port used to access the filer service externally.","type":"integer","default":443},"replicas":{"description":"Number of filer replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]},"whitelist":{"description":"A list of IP addresses or CIDR ranges that are allowed to access the filer service.","type":"array","default":[],"items":{"type":"string"}}}},"volume":{"description":"Volume service configuration.","type":"object","default":{},"properties":{"diskType":{"description":"SeaweedFS disk type tag for the default volume servers (e.g., \"hdd\", \"ssd\").","type":"string","default":""},"pools":{"description":"A map of storage pools. Each pool creates a separate Volume StatefulSet with its own disk type.","type":"object","default":{},"additionalProperties":{"type":"object","required":["diskType"],"properties":{"diskType":{"description":"SeaweedFS disk type tag (e.g., \"ssd\", \"hdd\", \"nvme\").","type":"string"},"replicas":{"description":"Number of volume replicas. Defaults to volume.replicas (Simple) or zone.replicas/volume.replicas (MultiZone).","type":"integer"},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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. Defaults to volume.resourcesPreset.","type":"string","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 size. Defaults to volume.size (Simple) or zone.size/volume.size (MultiZone).","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":"Kubernetes StorageClass for the pool. Defaults to volume.storageClass.","type":"string"}}}},"replicas":{"description":"Number of volume replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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 size.","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":""},"zones":{"description":"A map of zones for MultiZone topology. Each zone can have its own number of replicas and size.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"dataCenter":{"description":"SeaweedFS data center name for this zone. Defaults to the zone name.","type":"string"},"nodeSelector":{"description":"YAML nodeSelector for this zone (default: topology.kubernetes.io/zone: ).","type":"string"},"pools":{"description":"A map of storage pools for this zone. Each pool creates a separate Volume StatefulSet per zone.","type":"object","additionalProperties":{"type":"object","required":["diskType"],"properties":{"diskType":{"description":"SeaweedFS disk type tag (e.g., \"ssd\", \"hdd\", \"nvme\").","type":"string"},"replicas":{"description":"Number of volume replicas. Defaults to volume.replicas (Simple) or zone.replicas/volume.replicas (MultiZone).","type":"integer"},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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. Defaults to volume.resourcesPreset.","type":"string","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 size. Defaults to volume.size (Simple) or zone.size/volume.size (MultiZone).","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":"Kubernetes StorageClass for the pool. Defaults to volume.storageClass.","type":"string"}}}},"replicas":{"description":"Number of replicas in the zone.","type":"integer"},"size":{"description":"Zone storage size.","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 zone data. Defaults to volume.storageClass.","type":"string"}}}}}},"s3":{"description":"S3 service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of S3 replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"lifecycle":{"description":"S3 bucket lifecycle configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new.","type":"boolean","default":false},"storageClass":{"description":"StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"cosi":{"description":"Bucket provisioning configuration.","type":"object","default":{},"properties":{"orphanIdentities":{"description":"What installs and upgrades do with S3 identities left behind by deleted BucketAccesses: `delete` removes them, `report` only lists them in an Event, `auto` reports when `filer.grpcHost` is set (other clusters may use this filer) and removes them otherwise. Set `report` if the filer is reachable from other clusters some other way. Ignored with the Client topology, whose identities live on the filer of the instance it connects to.","type":"string","default":"auto","enum":["auto","report","delete"]}}},"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":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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 size.","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]},"topologySpreadPolicy":{"description":"How strictly the masters are kept one per node. `hard` keeps them apart through a drain, but counts every node, including one the masters cannot run on such as a tainted control plane, so with such a node the masters need as many usable nodes as replicas. `soft` drops the spread constraint and keeps only the preferred anti-affinity, for clusters with fewer usable nodes than masters.","type":"string","default":"hard","enum":["hard","soft"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"The hostname used to expose or access the filer service externally.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"grpcPort":{"description":"The port used to access the filer service externally.","type":"integer","default":443},"replicas":{"description":"Number of filer replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]},"whitelist":{"description":"A list of IP addresses or CIDR ranges that are allowed to access the filer service.","type":"array","default":[],"items":{"type":"string"}}}},"volume":{"description":"Volume service configuration.","type":"object","default":{},"properties":{"diskType":{"description":"SeaweedFS disk type tag for the default volume servers (e.g., \"hdd\", \"ssd\").","type":"string","default":""},"pools":{"description":"A map of storage pools. Each pool creates a separate Volume StatefulSet with its own disk type.","type":"object","default":{},"additionalProperties":{"type":"object","required":["diskType"],"properties":{"diskType":{"description":"SeaweedFS disk type tag (e.g., \"ssd\", \"hdd\", \"nvme\").","type":"string"},"replicas":{"description":"Number of volume replicas. Defaults to volume.replicas (Simple) or zone.replicas/volume.replicas (MultiZone).","type":"integer"},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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. Defaults to volume.resourcesPreset.","type":"string","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 size. Defaults to volume.size (Simple) or zone.size/volume.size (MultiZone).","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":"Kubernetes StorageClass for the pool. Defaults to volume.storageClass.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"replicas":{"description":"Number of volume replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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 size.","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":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"zones":{"description":"A map of zones for MultiZone topology. Each zone can have its own number of replicas and size.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"dataCenter":{"description":"SeaweedFS data center name for this zone. Defaults to the zone name.","type":"string","maxLength":63,"pattern":"^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$"},"nodeSelector":{"description":"YAML nodeSelector for this zone (default: topology.kubernetes.io/zone: ).","type":"string"},"pools":{"description":"A map of storage pools for this zone. Each pool creates a separate Volume StatefulSet per zone.","type":"object","additionalProperties":{"type":"object","required":["diskType"],"properties":{"diskType":{"description":"SeaweedFS disk type tag (e.g., \"ssd\", \"hdd\", \"nvme\").","type":"string"},"replicas":{"description":"Number of volume replicas. Defaults to volume.replicas (Simple) or zone.replicas/volume.replicas (MultiZone).","type":"integer"},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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. Defaults to volume.resourcesPreset.","type":"string","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 size. Defaults to volume.size (Simple) or zone.size/volume.size (MultiZone).","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":"Kubernetes StorageClass for the pool. Defaults to volume.storageClass.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}},"replicas":{"description":"Number of replicas in the zone.","type":"integer"},"size":{"description":"Zone storage size.","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 zone data. Defaults to volume.storageClass.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}}}}},"s3":{"description":"S3 service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of S3 replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","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":"Amount of memory allocated.","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"]}}},"lifecycle":{"description":"S3 bucket lifecycle configuration.","type":"object","default":{},"properties":{"enabled":{"description":"Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new.","type":"boolean","default":false},"storageClass":{"description":"StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"}}},"cosi":{"description":"Bucket provisioning configuration.","type":"object","default":{},"properties":{"orphanIdentities":{"description":"What installs and upgrades do with S3 identities left behind by deleted BucketAccesses: `delete` removes them, `report` only lists them in an Event, `auto` reports when `filer.grpcHost` is set (other clusters may use this filer) and removes them otherwise. Set `report` if the filer is reachable from other clusters some other way. Ignored with the Client topology, whose identities live on the filer of the instance it connects to.","type":"string","default":"auto","enum":["auto","report","delete"]}}},"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: "" labels: diff --git a/packages/system/tenant-rd/cozyrds/tenant.yaml b/packages/system/tenant-rd/cozyrds/tenant.yaml index b6b7c8699..4a190ce7e 100644 --- a/packages/system/tenant-rd/cozyrds/tenant.yaml +++ b/packages/system/tenant-rd/cozyrds/tenant.yaml @@ -21,7 +21,7 @@ spec: singular: tenant plural: tenants openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access tenant services (defaults to using the tenant name as a subdomain for its parent tenant host).","type":"string","default":""},"etcd":{"description":"Deploy own Etcd cluster.","type":"boolean","default":false},"monitoring":{"description":"Deploy own Monitoring Stack.","type":"boolean","default":false},"tracingCentral":{"description":"Send this tenant's traces to the shared VictoriaTraces store in tenant-root instead of a per-tenant backend; its Grafana reads them through a vmauth there that pins the tenant's own account, so tenants sharing the store cannot read each other's traces. It needs the tenant's own Monitoring (`monitoring: true`) and tenant-root hosting the store (`tracingCentralHost: true` on its Monitoring, with a `cluster`-mode tracingStorages entry named `generic`); without that the tenant's monitoring render fails rather than dropping spans. tenant-root, and whoever it admits to its Grafana, are inside the store's trust boundary. Applications should export over OTLP/HTTP, in requests below 3 MiB: spans above the platform's per-tenant write rate are retried over HTTP but dropped over gRPC, and a larger request is refused and not retried.","type":"boolean","default":false},"ingress":{"description":"Deploy own Ingress Controller.","type":"boolean","default":false},"gateway":{"description":"Deploy own Gateway API Gateway (backed by Cilium Gateway API controller). When `false` (the default), the tenant does not own a Gateway and instead publishes through the nearest ancestor tenant that owns one, regardless of whether `host` is empty or custom. Set to `true` to give the tenant its own Gateway with its own LoadBalancer IP and Certificate. A tenant with a custom (non-derived) `host` that needs its apex publicly reachable must set `true` explicitly, because an ancestor's TLS certificate does not cover a custom apex.","type":"boolean","default":false},"gatewayClass":{"description":"GatewayClass for this tenant's own Gateway. Empty uses the platform default (`gateway.className`). Only the classes the operator lists in the platform's `gateway.tenantSelectableClasses`, plus that default, may be named here — anything else fails this tenant's own gateway release and reaches no other tenant. Read only when this tenant owns a Gateway; an inheriting tenant uses its ancestor's. Whether a class terminates TLS itself or at its provider's edge is declared once per class on the platform, not here.","type":"string","default":""},"seaweedfs":{"description":"Deploy own SeaweedFS.","type":"boolean","default":false},"computeplane":{"description":"Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. The tenant receives no admin kubeconfig for it. Automatic routing of catalog applications onto it (placement: ComputePlane) is a planned follow-up and is not available yet; until it lands, external catalogs target the cluster via its computeplane-cluster-admin-kubeconfig Secret. See design-proposals/compute-plane in cozystack/community.","type":"boolean","default":false},"schedulingClass":{"description":"The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads.","type":"string","default":""},"allowedSchedulingClasses":{"description":"SchedulingClasses an application in this tenant may select through its own `schedulingClass`, in place of the tenant's. Empty allows none, so every application runs under the tenant's class. Inherited from the parent tenant, and not settable here, when the parent has a `schedulingClass` or a non-empty list.","type":"array","default":[],"items":{"type":"string"}},"resourceQuotas":{"description":"Define resource quotas for the tenant.","type":"object","default":{},"additionalProperties":{"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}}}} + {"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access tenant services (defaults to using the tenant name as a subdomain for its parent tenant host).","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"etcd":{"description":"Deploy own Etcd cluster.","type":"boolean","default":false},"monitoring":{"description":"Deploy own Monitoring Stack.","type":"boolean","default":false},"tracingCentral":{"description":"Send this tenant's traces to the shared VictoriaTraces store in tenant-root instead of a per-tenant backend; its Grafana reads them through a vmauth there that pins the tenant's own account, so tenants sharing the store cannot read each other's traces. It needs the tenant's own Monitoring (`monitoring: true`) and tenant-root hosting the store (`tracingCentralHost: true` on its Monitoring, with a `cluster`-mode tracingStorages entry named `generic`); without that the tenant's monitoring render fails rather than dropping spans. tenant-root, and whoever it admits to its Grafana, are inside the store's trust boundary. Applications should export over OTLP/HTTP, in requests below 3 MiB: spans above the platform's per-tenant write rate are retried over HTTP but dropped over gRPC, and a larger request is refused and not retried.","type":"boolean","default":false},"ingress":{"description":"Deploy own Ingress Controller.","type":"boolean","default":false},"gateway":{"description":"Deploy own Gateway API Gateway (backed by Cilium Gateway API controller). When `false` (the default), the tenant does not own a Gateway and instead publishes through the nearest ancestor tenant that owns one, regardless of whether `host` is empty or custom. Set to `true` to give the tenant its own Gateway with its own LoadBalancer IP and Certificate. A tenant with a custom (non-derived) `host` that needs its apex publicly reachable must set `true` explicitly, because an ancestor's TLS certificate does not cover a custom apex.","type":"boolean","default":false},"gatewayClass":{"description":"GatewayClass for this tenant's own Gateway. Empty uses the platform default (`gateway.className`). Only the classes the operator lists in the platform's `gateway.tenantSelectableClasses`, plus that default, may be named here — anything else fails this tenant's own gateway release and reaches no other tenant. Read only when this tenant owns a Gateway; an inheriting tenant uses its ancestor's. Whether a class terminates TLS itself or at its provider's edge is declared once per class on the platform, not here.","type":"string","default":""},"seaweedfs":{"description":"Deploy own SeaweedFS.","type":"boolean","default":false},"computeplane":{"description":"Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. The tenant receives no admin kubeconfig for it. Automatic routing of catalog applications onto it (placement: ComputePlane) is a planned follow-up and is not available yet; until it lands, external catalogs target the cluster via its computeplane-cluster-admin-kubeconfig Secret. See design-proposals/compute-plane in cozystack/community.","type":"boolean","default":false},"schedulingClass":{"description":"The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads.","type":"string","default":"","maxLength":63,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"allowedSchedulingClasses":{"description":"SchedulingClasses an application in this tenant may select through its own `schedulingClass`, in place of the tenant's. Empty allows none, so every application runs under the tenant's class. Inherited from the parent tenant, and not settable here, when the parent has a `schedulingClass` or a non-empty list.","type":"array","default":[],"items":{"type":"string"}},"resourceQuotas":{"description":"Define resource quotas for the tenant.","type":"object","default":{},"additionalProperties":{"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}}}} release: prefix: tenant- labels: diff --git a/packages/system/valkey-rd/cozyrds/valkey.yaml b/packages/system/valkey-rd/cozyrds/valkey.yaml index a621a3b03..eec981ab9 100644 --- a/packages/system/valkey-rd/cozyrds/valkey.yaml +++ b/packages/system/valkey-rd/cozyrds/valkey.yaml @@ -8,7 +8,7 @@ spec: plural: valkeys singular: valkey openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Valkey replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each Valkey 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.nano","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},"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"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"version":{"description":"Valkey major version to deploy","type":"string","default":"v8","enum":["v8","v7"]},"authEnabled":{"description":"Require a password. The password of the `default` user is issued through the credentials API, and issuing a new one takes effect without restarting anything. Replication, the Sentinels and the metrics exporter use an internal account of their own; backups use the `default` password.","type":"boolean","default":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 Valkey replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each Valkey 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.nano","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},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"version":{"description":"Valkey major version to deploy","type":"string","default":"v8","enum":["v8","v7"]},"authEnabled":{"description":"Require a password. The password of the `default` user is issued through the credentials API, and issuing a new one takes effect without restarting anything. Replication, the Sentinels and the metrics exporter use an internal account of their own; backups use the `default` password.","type":"boolean","default":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: valkey- labels: diff --git a/packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml b/packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml index e39933bd3..021a575b9 100644 --- a/packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml +++ b/packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml @@ -8,7 +8,7 @@ spec: plural: virtualprivateclouds singular: virtualprivatecloud openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"subnets":{"description":"Subnets of a VPC","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"allowSubnets":{"description":"Additional source CIDRs admitted into this private subnet, such as remote networks routed in through a gateway VM","type":"array","items":{"type":"string"}},"cidr":{"description":"IP address range","type":"string"},"name":{"description":"Subnet name","type":"string"}}}},"peers":{"description":"VPC peering connections (bidirectional declaration required)","type":"array","default":[],"items":{"type":"object","required":["tenantNamespace","vpcName"],"properties":{"tenantNamespace":{"description":"Namespace of the remote tenant","type":"string"},"vpcName":{"description":"Logical name of the remote VPC (without \"virtualprivatecloud-\" prefix)","type":"string"}}}},"routes":{"description":"Static routes for the VPC","type":"array","default":[],"items":{"type":"object","required":["cidr","nextHopIP"],"properties":{"cidr":{"description":"Destination CIDR","type":"string"},"nextHopIP":{"description":"Next hop IP address","type":"string"}}}}}} + {"title":"Chart Values","type":"object","properties":{"subnets":{"description":"Subnets of a VPC","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"allowSubnets":{"description":"Additional source CIDRs admitted into this private subnet, such as remote networks routed in through a gateway VM","type":"array","items":{"type":"string"}},"cidr":{"description":"IP address range","type":"string","pattern":"^[0-9A-Fa-f.:/,]*$"},"name":{"description":"Subnet name","type":"string","maxLength":63,"pattern":"^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$"}}}},"peers":{"description":"VPC peering connections (bidirectional declaration required)","type":"array","default":[],"items":{"type":"object","required":["tenantNamespace","vpcName"],"properties":{"tenantNamespace":{"description":"Namespace of the remote tenant","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"vpcName":{"description":"Logical name of the remote VPC (without \"virtualprivatecloud-\" prefix)","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}}},"routes":{"description":"Static routes for the VPC","type":"array","default":[],"items":{"type":"object","required":["cidr","nextHopIP"],"properties":{"cidr":{"description":"Destination CIDR","type":"string","pattern":"^[0-9A-Fa-f.:/,]*$"},"nextHopIP":{"description":"Next hop IP address","type":"string","pattern":"^[0-9A-Fa-f.:]*$"}}}}}} release: prefix: "virtualprivatecloud-" labels: diff --git a/packages/system/vm-disk-rd/cozyrds/vm-disk.yaml b/packages/system/vm-disk-rd/cozyrds/vm-disk.yaml index b9148da89..4258dfec5 100644 --- a/packages/system/vm-disk-rd/cozyrds/vm-disk.yaml +++ b/packages/system/vm-disk-rd/cozyrds/vm-disk.yaml @@ -8,7 +8,7 @@ spec: singular: vmdisk plural: vmdisks openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"source":{"description":"The source image location used to create a disk.","type":"object","default":{},"properties":{"disk":{"description":"Clone an existing vm-disk.","type":"object","required":["name"],"properties":{"name":{"description":"Name of the vm-disk to clone.","type":"string"}}},"http":{"description":"Download image from an HTTP source.","type":"object","required":["url"],"properties":{"url":{"description":"URL to download the image.","type":"string"}}},"image":{"description":"Use image by name from default collection.","type":"object","required":["name"],"properties":{"name":{"description":"Name of the image to use.","type":"string","x-cozystack-options":{"source":"image"}}}},"upload":{"description":"Upload local image.","type":"object"}},"x-kubernetes-validations":[{"rule":"self == oldSelf","message":"source is immutable"}],"x-kubernetes-map-type":"atomic"},"optical":{"description":"Defines if disk should be considered optical.","type":"boolean","default":false},"storage":{"description":"The size of the disk allocated for the virtual machine.","default":"5Gi","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":"replicated","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"bindImmediately":{"description":"Provision the volume at disk creation instead of waiting for a consumer.","type":"boolean","default":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":{"source":{"description":"The source image location used to create a disk.","type":"object","default":{},"properties":{"disk":{"description":"Clone an existing vm-disk.","type":"object","required":["name"],"properties":{"name":{"description":"Name of the vm-disk to clone.","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}},"http":{"description":"Download image from an HTTP source.","type":"object","required":["url"],"properties":{"url":{"description":"URL to download the image.","type":"string"}}},"image":{"description":"Use image by name from default collection.","type":"object","required":["name"],"properties":{"name":{"description":"Name of the image to use.","type":"string","maxLength":235,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$","x-cozystack-options":{"source":"image"}}}},"upload":{"description":"Upload local image.","type":"object"}},"x-kubernetes-validations":[{"rule":"self == oldSelf","message":"source is immutable"}],"x-kubernetes-map-type":"atomic"},"optical":{"description":"Defines if disk should be considered optical.","type":"boolean","default":false},"storage":{"description":"The size of the disk allocated for the virtual machine.","default":"5Gi","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":"replicated","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"bindImmediately":{"description":"Provision the volume at disk creation instead of waiting for a consumer.","type":"boolean","default":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: vm-disk- labels: diff --git a/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml b/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml index 439d712d8..c045a0314 100644 --- a/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml +++ b/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml @@ -12,7 +12,7 @@ spec: singular: vminstance plural: vminstances openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"externalMethod":{"description":"Method to pass through traffic to the VM.","type":"string","default":"PortList","enum":["PortList","WholeIP"]},"externalPorts":{"description":"Ports to forward from outside the cluster.","type":"array","default":[22],"items":{"type":"integer"}},"externalAllowICMP":{"description":"Whether to accept ICMP traffic to the VM in PortList mode (preserves ping and PMTU discovery). No effect in WholeIP mode. Default true so ping behaves as users expect even when port filtering is in effect.","type":"boolean","default":true},"runStrategy":{"description":"Requested running state of the VirtualMachineInstance","type":"string","default":"Always","enum":["Always","Halted","Manual","RerunOnFailure","Once"]},"instanceType":{"description":"Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.","type":"string","default":"u1.medium","x-cozystack-options":{"source":"instancetype"}},"instanceProfile":{"description":"Virtual Machine preferences profile.","type":"string","default":"ubuntu","x-cozystack-options":{"source":"instanceprofile"}},"disks":{"description":"List of disks to attach.","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"bootOrder":{"description":"Boot priority of the disk, 1 being tried first. Unset falls back to the disk's position in `disks` (the first disk gets 1), so set it to boot from a disk other than the first, such as an attached installer or rescue ISO, without reordering the list. Effective boot orders must be unique across disks: when one disk is given a value that another takes from its position, set both.","type":"integer","minimum":1},"bus":{"description":"Disk bus type (e.g. \"sata\").","type":"string"},"name":{"description":"Disk name.","type":"string","x-cozystack-options":{"source":"vmdisk"}}}}},"networks":{"description":"Networks to attach the VM to. On the cozyplane networking variant the single entry names the VirtualPrivateCloud the VM joins (at most one; the VM keeps its one pod interface).","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"subnets":{"description":"Deprecated: use networks instead.","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VM's namespace that routes the VM's traffic. Empty uses the VPC's default table. Requires the cozyplane networking variant and a VPC in `networks`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"name":{"description":"The name of the GPU resource to attach.","type":"string","x-cozystack-options":{"source":"gpu"}}}}},"cpuModel":{"description":"Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map","type":"string","default":""},"firmware":{"description":"Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).","type":"object","default":{},"properties":{"bootloader":{"description":"Bootloader to boot the VM with: \"uefi\" (OVMF) or \"bios\" (SeaBIOS). Empty inherits the instanceProfile default.","type":"string"},"efiPersistent":{"description":"Persist EFI NVRAM (e.g. enrolled Secure Boot keys, such as an updated Microsoft UEFI CA) across reboots. Only applies when bootloader is \"uefi\".","type":"boolean"},"secureBoot":{"description":"Enable UEFI Secure Boot. Only applies when bootloader is \"uefi\".","type":"boolean"}}},"resources":{"description":"Resource configuration for the virtual machine. Set whole-number cpu and sockets together with memory to size the VM directly, which overrides `instanceType`. Alongside an `instanceType`, a block that sizes only part of the VM is rejected; a whole-number cpu or sockets on its own sizes nothing and is ignored.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated, as a positive whole number such as `2`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.cores`.","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":"Amount of memory allocated, as a quantity of at least `1M` such as `8Gi`. Less than 1M is rejected at render time, because KubeVirt refuses a non-zero amount below 1M and a zero or negative amount sizes nothing.","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},"sockets":{"description":"Number of CPU sockets (vCPU topology), as a positive whole number such as `1`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.sockets`.","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}}},"sshKeys":{"description":"List of SSH public keys for authentication.","type":"array","default":[],"items":{"type":"string"}},"cloudInit":{"description":"Cloud-init user data.","type":"string","default":""},"netplanDhcp":{"description":"Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.","type":"boolean","default":false},"cloudInitSeed":{"description":"Seed string to generate SMBIOS UUID for the VM.","type":"string","default":""},"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":{"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"externalMethod":{"description":"Method to pass through traffic to the VM.","type":"string","default":"PortList","enum":["PortList","WholeIP"]},"externalPorts":{"description":"Ports to forward from outside the cluster.","type":"array","default":[22],"items":{"type":"integer"}},"externalAllowICMP":{"description":"Whether to accept ICMP traffic to the VM in PortList mode (preserves ping and PMTU discovery). No effect in WholeIP mode. Default true so ping behaves as users expect even when port filtering is in effect.","type":"boolean","default":true},"runStrategy":{"description":"Requested running state of the VirtualMachineInstance","type":"string","default":"Always","enum":["Always","Halted","Manual","RerunOnFailure","Once"]},"instanceType":{"description":"Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.","type":"string","default":"u1.medium","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-cozystack-options":{"source":"instancetype"}},"instanceProfile":{"description":"Virtual Machine preferences profile.","type":"string","default":"ubuntu","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-cozystack-options":{"source":"instanceprofile"}},"disks":{"description":"List of disks to attach.","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"bootOrder":{"description":"Boot priority of the disk, 1 being tried first. Unset falls back to the disk's position in `disks` (the first disk gets 1), so set it to boot from a disk other than the first, such as an attached installer or rescue ISO, without reordering the list. Effective boot orders must be unique across disks: when one disk is given a value that another takes from its position, set both.","type":"integer","minimum":1},"bus":{"description":"Disk bus type (e.g. \"sata\").","type":"string","maxLength":16,"pattern":"^[a-z0-9]*$"},"name":{"description":"Disk name.","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$","x-cozystack-options":{"source":"vmdisk"}}}}},"networks":{"description":"Networks to attach the VM to. On the cozyplane networking variant the single entry names the VirtualPrivateCloud the VM joins (at most one; the VM keeps its one pod interface).","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-cozystack-options":{"source":"network"}}}}},"subnets":{"description":"Deprecated: use networks instead.","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$","x-cozystack-options":{"source":"network"}}}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VM's namespace that routes the VM's traffic. Empty uses the VPC's default table. Requires the cozyplane networking variant and a VPC in `networks`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"name":{"description":"The name of the GPU resource to attach.","type":"string","maxLength":317,"pattern":"^(([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$","x-cozystack-options":{"source":"gpu"}}}}},"cpuModel":{"description":"Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map","type":"string","default":"","maxLength":128,"pattern":"^([A-Za-z0-9][-A-Za-z0-9_.+]*)?$"},"firmware":{"description":"Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).","type":"object","default":{},"properties":{"bootloader":{"description":"Bootloader to boot the VM with: \"uefi\" (OVMF) or \"bios\" (SeaBIOS). Empty inherits the instanceProfile default.","type":"string"},"efiPersistent":{"description":"Persist EFI NVRAM (e.g. enrolled Secure Boot keys, such as an updated Microsoft UEFI CA) across reboots. Only applies when bootloader is \"uefi\".","type":"boolean"},"secureBoot":{"description":"Enable UEFI Secure Boot. Only applies when bootloader is \"uefi\".","type":"boolean"}}},"resources":{"description":"Resource configuration for the virtual machine. Set whole-number cpu and sockets together with memory to size the VM directly, which overrides `instanceType`. Alongside an `instanceType`, a block that sizes only part of the VM is rejected; a whole-number cpu or sockets on its own sizes nothing and is ignored.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated, as a positive whole number such as `2`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.cores`.","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":"Amount of memory allocated, as a quantity of at least `1M` such as `8Gi`. Less than 1M is rejected at render time, because KubeVirt refuses a non-zero amount below 1M and a zero or negative amount sizes nothing.","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},"sockets":{"description":"Number of CPU sockets (vCPU topology), as a positive whole number such as `1`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.sockets`.","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}}},"sshKeys":{"description":"List of SSH public keys for authentication.","type":"array","default":[],"items":{"type":"string"}},"cloudInit":{"description":"Cloud-init user data.","type":"string","default":""},"netplanDhcp":{"description":"Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.","type":"boolean","default":false},"cloudInitSeed":{"description":"Seed string to generate SMBIOS UUID for the VM.","type":"string","default":""},"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: vm-instance- labels: diff --git a/packages/system/vpn-rd/cozyrds/vpn.yaml b/packages/system/vpn-rd/cozyrds/vpn.yaml index e6b010882..3647b950e 100644 --- a/packages/system/vpn-rd/cozyrds/vpn.yaml +++ b/packages/system/vpn-rd/cozyrds/vpn.yaml @@ -8,7 +8,7 @@ spec: plural: vpns singular: vpn openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of VPN server replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each VPN server 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.nano","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"]},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"host":{"description":"Host used to substitute into generated URLs.","type":"string","default":""},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user (autogenerated if not provided).","type":"string"}}}},"externalIPs":{"description":"List of externalIPs for service. Optional. If not specified, will use LoadBalancer service by default.","type":"array","default":[],"items":{"type":"string"}},"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 VPN server replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each VPN server 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.nano","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"]},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"host":{"description":"Host used to substitute into generated URLs: a DNS name, an IPv4 address or an IPv6 address.","type":"string","default":"","maxLength":253,"pattern":"^(([A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*)|[0-9A-Fa-f.]*:[0-9A-Fa-f:.]*)?$"},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"password":{"description":"Password for the user (autogenerated if not provided).","type":"string"}}}},"externalIPs":{"description":"List of externalIPs for service. Optional. If not specified, will use LoadBalancer service by default.","type":"array","default":[],"items":{"type":"string"}},"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: vpn- labels: diff --git a/packages/tests/cozy-lib-tests/templates/tests/yaml.yaml b/packages/tests/cozy-lib-tests/templates/tests/yaml.yaml new file mode 100644 index 000000000..fc3106b4b --- /dev/null +++ b/packages/tests/cozy-lib-tests/templates/tests/yaml.yaml @@ -0,0 +1,35 @@ +{{- /* + The inputs are built here rather than passed in: helm-unittest + re-encodes the values it is given, and the round trip folds U+0085 into a + space or refuses a "<<" key before the chart sees either. +*/}} +{{- $nelKey := dict "a\u0085extra: field" "1" }} +{{- $delValue := dict "a" "b\u007f" }} +{{- $case := .Values.case | default "" }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-yaml +data: + {{- if eq $case "toYaml" }} + out: {{ include "cozy-lib.yaml.toYaml" (list (dict "a" (list 1 "b") "c" dict) "affinity") | quote }} + null: {{ include "cozy-lib.yaml.toYaml" (list .Values.nothing "affinity") | quote }} + empty: {{ include "cozy-lib.yaml.toYaml" (list "" "affinity") | quote }} + {{- else if eq $case "toYaml-nel-key" }} + out: {{ include "cozy-lib.yaml.toYaml" (list $nelKey "affinity") | quote }} + {{- else if eq $case "toYaml-del-value" }} + out: {{ include "cozy-lib.yaml.toYaml" (list $delValue "affinity") | quote }} + {{- else if eq $case "fromYaml" }} + out: {{ include "cozy-lib.yaml.fromYaml" (list "a: [1, b]\nc: {}" "resources") | fromJson | toJson | quote }} + empty: {{ include "cozy-lib.yaml.fromYaml" (list "" "resources") | quote }} + {{- else if eq $case "fromYaml-merge-key" }} + out: {{ include "cozy-lib.yaml.fromYaml" (list "<<: x" "resources") | quote }} + {{- else if eq $case "flatten-nel-key" }} + out: {{ include "cozy-lib.resources.flatten" (list (dict "cpu\u0085extra: field" "1") $) | quote }} + {{- else if eq $case "flatten-merge-key" }} + out: {{ include "cozy-lib.resources.flatten" (list (dict "<<" "1") $) | quote }} + {{- else if eq $case "assertNoTemplateKeys" }} + out: {{ include "cozy-lib.yaml.assertNoTemplateKeys" (list "valuesOverride" .Values.input) | quote }} + {{- else if eq $case "affinity" }} + out: {{ include "cozy-lib.affinity.toYaml" (list .Values.input "affinity") | quote }} + {{- end }} diff --git a/packages/tests/cozy-lib-tests/tests/yaml_test.yaml b/packages/tests/cozy-lib-tests/tests/yaml_test.yaml new file mode 100644 index 000000000..6ec252941 --- /dev/null +++ b/packages/tests/cozy-lib-tests/tests/yaml_test.yaml @@ -0,0 +1,111 @@ +# ./tests/yaml_test.yaml +suite: cozy-lib.yaml helpers fail where Helm's toYaml and fromYaml fall silent + +templates: + - templates/tests/yaml.yaml + +# Helm's toYaml returns "" for a value it cannot marshal and its fromYaml a +# map holding only "Error", and a template that goes on from either renders +# the object it was building empty. These helpers fail the render instead. + +set: + _cluster: {} + _namespace: {} + +tests: + - it: writes a value that marshals, null and the empty string included + set: + case: toYaml + asserts: + - equal: {path: data.out, value: "a:\n- 1\n- b\nc: {}"} + - equal: {path: data.null, value: "null"} + - equal: {path: data.empty, value: '""'} + + - it: fails on a map key holding U+0085 + set: + case: toYaml-nel-key + asserts: + - failedTemplate: + errorPattern: 'affinity cannot be written as YAML: remove control characters from it, and U\+0085 from its keys' + + - it: fails on a value holding a control character + set: + case: toYaml-del-value + asserts: + - failedTemplate: + errorPattern: 'affinity cannot be written as YAML' + + - it: reads back text that parses, the empty text included + set: + case: fromYaml + asserts: + - equal: {path: data.out, value: '{"a":[1,"b"],"c":{}}'} + - equal: {path: data.empty, value: '{}'} + + - it: fails on text that does not parse + set: + case: fromYaml-merge-key + asserts: + - failedTemplate: + errorPattern: 'resources cannot be read back from YAML: error converting YAML to JSON: .*map merge requires map' + + - it: fails a quota whose resource name holds U+0085 instead of rendering it empty + set: + case: flatten-nel-key + asserts: + - failedTemplate: + errorPattern: 'resources cannot be written as YAML' + + - it: fails a quota whose resource name is a YAML merge key instead of rendering it empty + set: + case: flatten-merge-key + asserts: + - failedTemplate: + errorPattern: 'resources cannot be read back from YAML' + + - it: lets a map through that holds no $tplYaml key + set: + case: assertNoTemplateKeys + input: + controller: + extraArgs: [{"tplYaml": "x"}] + annotations: {"example.com/$tplYaml": "x"} + asserts: + - equal: {path: data.out, value: ""} + + - it: fails on a $tplYaml key however deep it sits + set: + case: assertNoTemplateKeys + input: + controller: + extraArgs: + - {"$tplYamlSpread": "{{ print \"x\" }}"} + asserts: + - failedTemplate: + errorPattern: 'valuesOverride.controller.extraArgs\[0\]: key "\$tplYamlSpread" is not allowed' + + - it: writes an affinity holding only the fields of one + set: + case: affinity + input: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: [] + asserts: + - equal: {path: data.out, value: "podAntiAffinity:\n preferredDuringSchedulingIgnoredDuringExecution: []"} + + - it: fails on an affinity key that is not a field of one + set: + case: affinity + input: + $tplYaml: "x" + asserts: + - failedTemplate: + errorPattern: 'affinity.\$tplYaml is not a field of an affinity: use nodeAffinity, podAffinity or podAntiAffinity' + + - it: fails on an affinity that is not an object + set: + case: affinity + input: "nodeAffinity: {}" + asserts: + - failedTemplate: + errorPattern: 'affinity must be an object holding nodeAffinity, podAffinity or podAntiAffinity'