mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-06 07:03:45 +09:00
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 <lllamnyp@gmail.com> Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
1 parent
8e430c011f
commit
4b8eaffa53
220 files changed
+2897
-663
No files matched your search
Generated
+2
@@ -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 `<bucket>.<tenant host>`. Set to `false` to run the bucket without them.
|
||||
// +kubebuilder:default:=true
|
||||
|
||||
Generated
+22
@@ -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 `<release>-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:="<your-secret-key>"
|
||||
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 `<release>-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 `<namespace>/<release>` 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 `<release>-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"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+9
@@ -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"`
|
||||
}
|
||||
|
||||
Generated
+4
@@ -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.
|
||||
|
||||
Generated
+4
@@ -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"`
|
||||
|
||||
Generated
+10
@@ -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-<cluster-name>.<tenant-host>` 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
|
||||
|
||||
+4
@@ -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 `<installerRepository>/<schematicID>:<version>` 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:={}
|
||||
|
||||
Generated
+6
@@ -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:="<your-secret-key>"
|
||||
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"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+9
@@ -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 `<namespace>/<application>`. 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"`
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+21
@@ -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 `<release>-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 `<release>-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"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+4
@@ -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:={}
|
||||
|
||||
Generated
+2
@@ -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.
|
||||
|
||||
Generated
+6
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+14
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+9
@@ -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"`
|
||||
}
|
||||
Generated
+3
-1
@@ -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:={}
|
||||
|
||||
@@ -32,16 +32,22 @@ QDRANT_CHART=packages/apps/qdrant
|
||||
HARBOR_CHART=packages/apps/harbor
|
||||
|
||||
# render_hook <chart> <release> <namespace> <job-name> <out> [extra helm args…]
|
||||
# Extract the named Job's shell script from the rendered chart into <out>. 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 <out>,
|
||||
# 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 <dir>
|
||||
@@ -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.
|
||||
|
||||
@@ -15,16 +15,24 @@ load test_helper
|
||||
|
||||
CHART=packages/apps/kafka
|
||||
|
||||
# render_script <out> [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
|
||||
|
||||
@@ -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 <<EOF$' "$work/heredoc.sh" || { echo "could not extract the kubernetes-nodes heredoc" >&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 <<EOF/ { print "cat <<EOF"; inblock=1; next }
|
||||
inblock && /^EOF$/ { print "EOF"; inblock=0; next }
|
||||
inblock { print }
|
||||
' "$work/cmd.sh" > "$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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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: {}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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: ""
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
<table>query_log</table>
|
||||
<engine>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
|
||||
</engine>
|
||||
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
|
||||
</query_log>
|
||||
@@ -88,7 +93,7 @@ spec:
|
||||
<table>query_thread_log</table>
|
||||
<engine>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
|
||||
</engine>
|
||||
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
|
||||
</query_thread_log>
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -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.",
|
||||
|
||||
@@ -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 `<release>-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 `<release>-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.<tenant>: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 `<release>-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 `<release>-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 `<namespace>/<release>` 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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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",
|
||||
|
||||
@@ -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: ""
|
||||
|
||||
@@ -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 <<MANIFEST
|
||||
apiVersion: kafka.strimzi.io/v1
|
||||
kind: KafkaNodePool
|
||||
metadata:
|
||||
# "kafka" for a cluster migrated from ZooKeeper (that pool adopted
|
||||
# its <cluster>-kafka-N brokers), "b-<hash>" 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 <<MANIFEST
|
||||
apiVersion: kafka.strimzi.io/v1
|
||||
kind: KafkaNodePool
|
||||
metadata:
|
||||
name: {{ include "kafka.controllerPoolName" . }}
|
||||
namespace: ${ns}
|
||||
labels:
|
||||
strimzi.io/cluster: ${name}
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
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}
|
||||
# Controller node IDs start above the broker range, leaving
|
||||
# [0..replicas-1] to the broker pool. A cluster migrated from
|
||||
# ZooKeeper relies on it: its brokers kept their original IDs.
|
||||
strimzi.io/next-node-ids: "[{{ .Values.kafka.replicas }}-999]"
|
||||
spec:
|
||||
replicas: {{ $controllerReplicas }}
|
||||
roles:
|
||||
- controller
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.kafka.resourcesPreset .Values.kafka.resources $) | nindent 18 }}
|
||||
storage:
|
||||
type: jbod
|
||||
volumes:
|
||||
- id: 0
|
||||
type: persistent-claim
|
||||
size: {{ .Values.kafka.controllerStorageSize | default "5Gi" }}
|
||||
{{- with .Values.kafka.storageClass }}
|
||||
class: {{ . }}
|
||||
{{- end }}
|
||||
kraftMetadata: shared
|
||||
deleteClaim: false
|
||||
MANIFEST
|
||||
)
|
||||
|
||||
echo "Ensuring broker KafkaNodePool \"$brokerPool\" exists..."
|
||||
echo "$broker_manifest" | kubectl apply --openapi-patch=false -f -
|
||||
echo "Ensuring broker KafkaNodePool \"$BROKER_POOL\" exists..."
|
||||
printf '%s\n' "$BROKER_MANIFEST" | kubectl apply --openapi-patch=false -f -
|
||||
|
||||
echo "Ensuring controller KafkaNodePool exists..."
|
||||
echo "$controller_manifest" | kubectl apply --openapi-patch=false -f -
|
||||
printf '%s\n' "$CONTROLLER_MANIFEST" | kubectl apply --openapi-patch=false -f -
|
||||
|
||||
{{- define "kafka.brokerPoolManifest" }}
|
||||
{{- $brokerPool := index . 0 }}
|
||||
{{- $root := index . 1 }}
|
||||
{{- with $root }}
|
||||
apiVersion: kafka.strimzi.io/v1
|
||||
kind: KafkaNodePool
|
||||
metadata:
|
||||
name: {{ $brokerPool | quote }}
|
||||
{{- include "kafka.poolMetadata" . }}
|
||||
spec:
|
||||
replicas: {{ int .Values.kafka.replicas }}
|
||||
roles:
|
||||
- broker
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.kafka.resourcesPreset .Values.kafka.resources $root) | nindent 4 }}
|
||||
storage:
|
||||
type: jbod
|
||||
volumes:
|
||||
- id: 0
|
||||
type: persistent-claim
|
||||
{{- with .Values.kafka.size }}
|
||||
size: {{ . | toJson }}
|
||||
{{- end }}
|
||||
{{- with .Values.kafka.storageClass }}
|
||||
class: {{ . | quote }}
|
||||
{{- end }}
|
||||
deleteClaim: false
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "kafka.controllerPoolManifest" }}
|
||||
{{- $controllerReplicas := index . 0 }}
|
||||
{{- $root := index . 1 }}
|
||||
{{- with $root }}
|
||||
apiVersion: kafka.strimzi.io/v1
|
||||
kind: KafkaNodePool
|
||||
metadata:
|
||||
name: {{ include "kafka.controllerPoolName" . | quote }}
|
||||
{{- include "kafka.poolMetadata" . }}
|
||||
strimzi.io/next-node-ids: {{ printf "[%d-999]" (int .Values.kafka.replicas) | quote }}
|
||||
spec:
|
||||
replicas: {{ int $controllerReplicas }}
|
||||
roles:
|
||||
- controller
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.kafka.resourcesPreset .Values.kafka.resources $root) | nindent 4 }}
|
||||
storage:
|
||||
type: jbod
|
||||
volumes:
|
||||
- id: 0
|
||||
type: persistent-claim
|
||||
size: {{ .Values.kafka.controllerStorageSize | default "5Gi" | toJson }}
|
||||
{{- with .Values.kafka.storageClass }}
|
||||
class: {{ . | quote }}
|
||||
{{- end }}
|
||||
kraftMetadata: shared
|
||||
deleteClaim: false
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "kafka.poolMetadata" }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
labels:
|
||||
strimzi.io/cluster: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
helm.toolkit.fluxcd.io/name: {{ .Release.Name | quote }}
|
||||
helm.toolkit.fluxcd.io/namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
meta.helm.sh/release-name: {{ .Release.Name | quote }}
|
||||
meta.helm.sh/release-namespace: {{ .Release.Namespace | quote }}
|
||||
{{- end }}
|
||||
@@ -9,6 +9,11 @@
|
||||
{{- $segmentBytesMin := 1048576 }}
|
||||
{{- range $topic := .Values.topics }}
|
||||
{{- $config := $topic.config | default dict }}
|
||||
{{- range $key, $_ := $config }}
|
||||
{{- if not (regexMatch "^[A-Za-z0-9]+([._-][A-Za-z0-9]+)*$" $key) }}
|
||||
{{- fail (printf "topic %q config key %q is not a Kafka topic config name such as retention.ms" $topic.name $key) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $key := list "message.downconversion.enable" "message.format.version" "message.timestamp.difference.max.ms" }}
|
||||
{{- if hasKey $config $key }}
|
||||
{{- fail (printf "topic %q sets %s, which Kafka 4 removed: delete it from the topic's config" $topic.name $key) }}
|
||||
@@ -36,19 +41,19 @@
|
||||
apiVersion: kafka.strimzi.io/v1
|
||||
kind: KafkaTopic
|
||||
metadata:
|
||||
name: "{{ $.Release.Name }}-{{ kebabcase $topic.name }}"
|
||||
name: {{ printf "%s-%s" $.Release.Name (kebabcase $topic.name) | quote }}
|
||||
labels:
|
||||
strimzi.io/cluster: "{{ $.Release.Name }}"
|
||||
strimzi.io/cluster: {{ $.Release.Name | quote }}
|
||||
spec:
|
||||
topicName: "{{ $topic.name }}"
|
||||
topicName: {{ $topic.name | quote }}
|
||||
{{- with $topic.partitions }}
|
||||
partitions: {{ . }}
|
||||
partitions: {{ int . }}
|
||||
{{- end }}
|
||||
{{- with $topic.replicas }}
|
||||
replicas: {{ . }}
|
||||
replicas: {{ int . }}
|
||||
{{- end }}
|
||||
{{- with $topic.config }}
|
||||
config:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- include "cozy-lib.yaml.toYaml" (list . (printf "topic %q config" $topic.name)) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -65,18 +65,18 @@ tests:
|
||||
|
||||
# The hook creates the broker pool under the render-resolved name
|
||||
# (kafka.brokerPoolName): "kafka" for a cluster migrated from ZooKeeper,
|
||||
# "b-<hash>" otherwise. The manifest references the shell var so both resolve here.
|
||||
# "b-<hash>" 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'
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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/<role>, 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 }}
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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 `<installerRepository>/<schematicID>:<version>` 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.
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
@@ -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'
|
||||
@@ -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'
|
||||
@@ -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
|
||||
@@ -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])?)*)?$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-<cluster-name>.<tenant-host>` 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`.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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) }}
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -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*/,@? ]*$"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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'
|
||||
@@ -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
|
||||
|
||||
@@ -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:.+ -]*$"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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 `<namespace>/<application>`. 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:
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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:
|
||||
|
||||
@@ -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'
|
||||
@@ -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",
|
||||
|
||||
@@ -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: ""
|
||||
|
||||
Loaded 100 of 220 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user