From bf38316163bb9d35cec4753397631534cc55eb00 Mon Sep 17 00:00:00 2001 From: Isaiah Olson Date: Sat, 13 Sep 2025 21:00:48 -0500 Subject: [PATCH] Restructure FoundationDB values and flatten them Signed-off-by: Isaiah Olson --- packages/apps/foundationdb/README.md | 51 +- .../apps/foundationdb/templates/cluster.yaml | 16 +- packages/apps/foundationdb/values.schema.json | 474 +++++++++++------- packages/apps/foundationdb/values.yaml | 95 ++-- 4 files changed, 404 insertions(+), 232 deletions(-) diff --git a/packages/apps/foundationdb/README.md b/packages/apps/foundationdb/README.md index b5245013..a6c4c688 100644 --- a/packages/apps/foundationdb/README.md +++ b/packages/apps/foundationdb/README.md @@ -133,4 +133,53 @@ FoundationDB is designed for high availability: For issues related to FoundationDB itself, refer to the [FoundationDB documentation](https://apple.github.io/foundationdb/). -For Cozystack-specific issues, consult the Cozystack documentation or support channels. \ No newline at end of file +For Cozystack-specific issues, consult the Cozystack documentation or support channels. + +## Parameters + +### Common parameters + +| Name | Description | Type | Value | +| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ----------------------- | +| `replicas` | Number of FoundationDB replicas (total instances) | `int` | `3` | +| `cluster` | Cluster configuration | `object` | `{}` | +| `cluster.processCounts` | Process counts for different roles | `object` | `{}` | +| `cluster.processCounts.stateless` | Number of stateless processes (-1 for automatic) | `int` | `-1` | +| `cluster.processCounts.storage` | Number of storage processes | `int` | `3` | +| `cluster.processCounts.cluster_controller` | Number of cluster controller processes | `int` | `1` | +| `cluster.version` | Version of FoundationDB to use | `string` | `7.4.1` | +| `cluster.faultDomain` | Fault domain configuration | `object` | `{}` | +| `cluster.faultDomain.key` | Fault domain key | `string` | `foundationdb.org/none` | +| `cluster.faultDomain.valueFrom` | Fault domain value source | `string` | `$FDB_ZONE_ID` | +| `storage` | Storage configuration | `object` | `{}` | +| `storage.size` | Size of persistent volumes for each instance | `quantity` | `16Gi` | +| `storage.storageClass` | Storage class (if not set, uses cluster default) | `string` | `""` | +| `resources` | Explicit CPU and memory configuration for each FoundationDB instance. When left empty, the preset defined in `resourcesPreset` is applied. | `*object` | `{}` | +| `resources.cpu` | CPU available to each instance | `*quantity` | `null` | +| `resources.memory` | Memory (RAM) available to each instance | `*quantity` | `null` | +| `resourcesPreset` | Default sizing preset used when `resources` is omitted. Allowed values: `small`, `medium`, `large`, `xlarge`, `2xlarge`. | `string` | `medium` | +| `backup` | Backup configuration | `object` | `{}` | +| `backup.enabled` | Enable backups | `bool` | `false` | +| `backup.s3` | S3 configuration for backups | `object` | `{}` | +| `backup.s3.bucket` | S3 bucket name | `string` | `""` | +| `backup.s3.endpoint` | S3 endpoint URL | `string` | `""` | +| `backup.s3.region` | S3 region | `string` | `us-east-1` | +| `backup.s3.credentials` | S3 credentials | `object` | `{}` | +| `backup.s3.credentials.accessKeyId` | S3 access key ID | `string` | `""` | +| `backup.s3.credentials.secretAccessKey` | S3 secret access key | `string` | `""` | +| `backup.retentionPolicy` | Retention policy for backups | `string` | `7d` | +| `monitoring` | Monitoring configuration | `object` | `{}` | +| `monitoring.enabled` | Enable WorkloadMonitor integration | `bool` | `true` | + + +### FoundationDB configuration + +| Name | Description | Type | Value | +| ---------------------------- | ------------------------------------------------------------------ | ---------- | ------- | +| `customParameters` | Custom parameters to pass to FoundationDB | `[]string` | `[]` | +| `imageType` | Container image deployment type (split recommended for production) | `string` | `split` | +| `securityContext` | Security context for containers | `object` | `{}` | +| `securityContext.runAsUser` | User ID to run the container | `int` | `0` | +| `securityContext.runAsGroup` | Group ID to run the container | `int` | `0` | +| `automaticReplacements` | Enable automatic pod replacements | `bool` | `true` | + diff --git a/packages/apps/foundationdb/templates/cluster.yaml b/packages/apps/foundationdb/templates/cluster.yaml index 40038a2f..f342054d 100644 --- a/packages/apps/foundationdb/templates/cluster.yaml +++ b/packages/apps/foundationdb/templates/cluster.yaml @@ -15,13 +15,13 @@ spec: automationOptions: replacements: - enabled: {{ .Values.advanced.automaticReplacements }} + enabled: {{ .Values.automaticReplacements }} faultDomain: key: {{ .Values.cluster.faultDomain.key }} {{- if .Values.cluster.faultDomain.valueFrom }} valueFrom: {{ .Values.cluster.faultDomain.valueFrom }} {{- end }} - imageType: {{ .Values.advanced.imageType }} + imageType: {{ .Values.imageType }} labels: filterOnOwnerReference: false matchLabels: @@ -34,9 +34,9 @@ spec: processes: general: - {{- if .Values.advanced.customParameters }} + {{- if .Values.customParameters }} customParameters: - {{- range .Values.advanced.customParameters }} + {{- range .Values.customParameters }} - {{ . }} {{- end }} {{- end }} @@ -44,9 +44,9 @@ spec: spec: containers: - name: foundationdb - resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resources.preset .Values.resources $) | nindent 16 }} + resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 16 }} securityContext: - {{- toYaml .Values.advanced.securityContext | nindent 16 }} + {{- toYaml .Values.securityContext | nindent 16 }} - name: foundationdb-kubernetes-sidecar resources: limits: @@ -56,7 +56,7 @@ spec: cpu: 100m memory: 128Mi securityContext: - {{- toYaml .Values.advanced.securityContext | nindent 16 }} + {{- toYaml .Values.securityContext | nindent 16 }} initContainers: - name: foundationdb-kubernetes-init resources: @@ -67,7 +67,7 @@ spec: cpu: 100m memory: 128Mi securityContext: - {{- toYaml .Values.advanced.securityContext | nindent 16 }} + {{- toYaml .Values.securityContext | nindent 16 }} volumeClaimTemplate: spec: diff --git a/packages/apps/foundationdb/values.schema.json b/packages/apps/foundationdb/values.schema.json index 039ed241..c1a3805f 100644 --- a/packages/apps/foundationdb/values.schema.json +++ b/packages/apps/foundationdb/values.schema.json @@ -1,218 +1,322 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Chart Values", "type": "object", "properties": { - "replicas": { - "type": "integer", - "minimum": 1, - "default": 3, - "title": "Number of replicas", - "description": "Total number of FoundationDB instances" + "automaticReplacements": { + "description": "Enable automatic pod replacements", + "type": "boolean", + "default": true + }, + "backup": { + "description": "Backup configuration", + "type": "object", + "default": { + "enabled": false, + "retentionPolicy": "7d", + "s3": { + "bucket": "", + "credentials": { + "accessKeyId": "", + "secretAccessKey": "" + }, + "endpoint": "", + "region": "us-east-1" + } + }, + "required": [ + "enabled", + "retentionPolicy", + "s3" + ], + "properties": { + "enabled": { + "description": "Enable backups", + "type": "boolean", + "default": false + }, + "retentionPolicy": { + "description": "Retention policy for backups", + "type": "string", + "default": "7d" + }, + "s3": { + "description": "S3 configuration for backups", + "type": "object", + "default": { + "bucket": "", + "credentials": { + "accessKeyId": "", + "secretAccessKey": "" + }, + "endpoint": "", + "region": "us-east-1" + }, + "required": [ + "bucket", + "credentials", + "endpoint", + "region" + ], + "properties": { + "bucket": { + "description": "S3 bucket name", + "type": "string" + }, + "credentials": { + "description": "S3 credentials", + "type": "object", + "default": { + "accessKeyId": "", + "secretAccessKey": "" + }, + "required": [ + "accessKeyId", + "secretAccessKey" + ], + "properties": { + "accessKeyId": { + "description": "S3 access key ID", + "type": "string" + }, + "secretAccessKey": { + "description": "S3 secret access key", + "type": "string" + } + } + }, + "endpoint": { + "description": "S3 endpoint URL", + "type": "string" + }, + "region": { + "description": "S3 region", + "type": "string", + "default": "us-east-1" + } + } + } + } }, "cluster": { + "description": "Cluster configuration", "type": "object", - "title": "Cluster Configuration", - "properties": { + "default": { + "faultDomain": { + "key": "foundationdb.org/none", + "valueFrom": "$FDB_ZONE_ID" + }, "processCounts": { + "cluster_controller": 1, + "stateless": -1, + "storage": 3 + }, + "version": "7.4.1" + }, + "required": [ + "faultDomain", + "processCounts", + "version" + ], + "properties": { + "faultDomain": { + "description": "Fault domain configuration", "type": "object", - "title": "Process Counts", + "default": { + "key": "foundationdb.org/none", + "valueFrom": "$FDB_ZONE_ID" + }, + "required": [ + "key", + "valueFrom" + ], "properties": { - "stateless": { + "key": { + "description": "Fault domain key", + "type": "string", + "default": "foundationdb.org/none" + }, + "valueFrom": { + "description": "Fault domain value source", + "type": "string", + "default": "$FDB_ZONE_ID" + } + } + }, + "processCounts": { + "description": "Process counts for different roles", + "type": "object", + "default": { + "cluster_controller": 1, + "stateless": -1, + "storage": 3 + }, + "required": [ + "cluster_controller", + "stateless", + "storage" + ], + "properties": { + "cluster_controller": { + "description": "Number of cluster controller processes", "type": "integer", - "default": -1, - "title": "Stateless processes", - "description": "Number of stateless processes (-1 for automatic)" + "default": 1 + }, + "stateless": { + "description": "Number of stateless processes (-1 for automatic)", + "type": "integer", + "default": -1 }, "storage": { + "description": "Number of storage processes", "type": "integer", - "minimum": 1, - "default": 3, - "title": "Storage processes", - "description": "Number of storage processes" - }, - "cluster_controller": { - "type": "integer", - "minimum": 1, - "default": 1, - "title": "Cluster controllers", - "description": "Number of cluster controller processes" + "default": 3 } } }, "version": { + "description": "Version of FoundationDB to use", "type": "string", - "default": "7.4.1", - "title": "FoundationDB Version", - "description": "Version of FoundationDB to deploy" - }, - "faultDomain": { - "type": "object", - "title": "Fault Domain", - "properties": { - "key": { - "type": "string", - "default": "foundationdb.org/none", - "title": "Fault domain key" + "default": "7.4.1" + } + } + }, + "customParameters": { + "description": "Custom parameters to pass to FoundationDB", + "type": "array", + "default": [], + "items": { + "type": "string" + } + }, + "imageType": { + "description": "Container image deployment type (split recommended for production)", + "type": "string", + "default": "split", + "enum": [ + "unified", + "split" + ] + }, + "monitoring": { + "description": "Monitoring configuration", + "type": "object", + "default": { + "enabled": true + }, + "required": [ + "enabled" + ], + "properties": { + "enabled": { + "description": "Enable WorkloadMonitor integration", + "type": "boolean", + "default": true + } + } + }, + "replicas": { + "description": "Number of FoundationDB replicas (total instances)", + "type": "integer", + "default": 3 + }, + "resources": { + "description": "Explicit CPU and memory configuration for each FoundationDB instance. When left empty, the preset defined in `resourcesPreset` is applied.", + "type": "object", + "default": {}, + "properties": { + "cpu": { + "description": "CPU available to each instance", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "anyOf": [ + { + "type": "integer" }, - "valueFrom": { - "type": "string", - "default": "$FDB_ZONE_ID", - "title": "Fault domain value source" + { + "type": "string" } - } + ], + "x-kubernetes-int-or-string": true + }, + "memory": { + "description": "Memory (RAM) available to each instance", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "x-kubernetes-int-or-string": true + } + } + }, + "resourcesPreset": { + "description": "Default sizing preset used when `resources` is omitted. Allowed values: `small`, `medium`, `large`, `xlarge`, `2xlarge`.", + "type": "string", + "default": "medium", + "enum": [ + "small", + "medium", + "large", + "xlarge", + "2xlarge" + ] + }, + "securityContext": { + "description": "Security context for containers", + "type": "object", + "default": { + "runAsGroup": 0, + "runAsUser": 0 + }, + "required": [ + "runAsGroup", + "runAsUser" + ], + "properties": { + "runAsGroup": { + "description": "Group ID to run the container", + "type": "integer", + "default": 0 + }, + "runAsUser": { + "description": "User ID to run the container", + "type": "integer", + "default": 0 } } }, "storage": { + "description": "Storage configuration", "type": "object", - "title": "Storage Configuration", + "default": { + "size": "16Gi", + "storageClass": "" + }, + "required": [ + "size", + "storageClass" + ], "properties": { "size": { - "type": "string", + "description": "Size of persistent volumes for each instance", "default": "16Gi", - "title": "Storage size", - "description": "Size of persistent volumes for each instance" + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "x-kubernetes-int-or-string": true }, "storageClass": { - "type": "string", - "title": "Storage class", - "description": "Kubernetes storage class to use (optional)" - } - } - }, - "resources": { - "type": "object", - "title": "Resource Configuration", - "properties": { - "preset": { - "type": "string", - "enum": ["small", "medium", "large", "xlarge"], - "default": "medium", - "title": "Resource preset", - "description": "Predefined resource configuration" - }, - "limits": { - "type": "object", - "title": "Resource limits", - "properties": { - "cpu": {"type": "string"}, - "memory": {"type": "string"} - } - }, - "requests": { - "type": "object", - "title": "Resource requests", - "properties": { - "cpu": {"type": "string"}, - "memory": {"type": "string"} - } - } - } - }, - "backup": { - "type": "object", - "title": "Backup Configuration", - "properties": { - "enabled": { - "type": "boolean", - "default": false, - "title": "Enable backups", - "description": "Enable automatic backups to S3" - }, - "s3": { - "type": "object", - "title": "S3 Configuration", - "properties": { - "bucket": { - "type": "string", - "title": "S3 bucket name" - }, - "endpoint": { - "type": "string", - "title": "S3 endpoint URL" - }, - "region": { - "type": "string", - "default": "us-east-1", - "title": "S3 region" - }, - "credentials": { - "type": "object", - "title": "S3 credentials", - "properties": { - "accessKeyId": { - "type": "string", - "title": "Access key ID" - }, - "secretAccessKey": { - "type": "string", - "title": "Secret access key" - } - } - } - } - }, - "retentionPolicy": { - "type": "string", - "default": "7d", - "title": "Retention policy", - "description": "How long to keep backups" - } - } - }, - "monitoring": { - "type": "object", - "title": "Monitoring", - "properties": { - "enabled": { - "type": "boolean", - "default": true, - "title": "Enable monitoring", - "description": "Enable WorkloadMonitor integration" - } - } - }, - "advanced": { - "type": "object", - "title": "Advanced Configuration", - "properties": { - "customParameters": { - "type": "array", - "title": "Custom parameters", - "description": "Custom FoundationDB parameters", - "items": { - "type": "string" - } - }, - "imageType": { - "type": "string", - "enum": ["unified", "split"], - "default": "split", - "title": "Image type", - "description": "Container image deployment type" - }, - "automaticReplacements": { - "type": "boolean", - "default": true, - "title": "Automatic replacements", - "description": "Enable automatic pod replacements" - }, - "securityContext": { - "type": "object", - "title": "Security context", - "description": "Security context for containers", - "properties": { - "runAsUser": { - "type": "integer", - "title": "Run as user", - "description": "User ID to run the container" - }, - "runAsGroup": { - "type": "integer", - "title": "Run as group", - "description": "Group ID to run the container" - } - } + "description": "Storage class (if not set, uses cluster default)", + "type": "string" } } } diff --git a/packages/apps/foundationdb/values.yaml b/packages/apps/foundationdb/values.yaml index 1db095fd..194c69e5 100644 --- a/packages/apps/foundationdb/values.yaml +++ b/packages/apps/foundationdb/values.yaml @@ -2,44 +2,61 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -# Number of replicas (total instances) +## @section Common parameters +## +## @param replicas {int} Number of FoundationDB replicas (total instances) replicas: 3 -# Cluster configuration +## @param cluster {cluster} Cluster configuration +## @field cluster.processCounts {clusterProcessCounts} Process counts for different roles +## @field clusterProcessCounts.stateless {int} Number of stateless processes (-1 for automatic) +## @field clusterProcessCounts.storage {int} Number of storage processes +## @field clusterProcessCounts.cluster_controller {int} Number of cluster controller processes +## @field cluster.version {string} Version of FoundationDB to use +## @field cluster.faultDomain {clusterFaultDomain} Fault domain configuration +## @field clusterFaultDomain.key {string} Fault domain key +## @field clusterFaultDomain.valueFrom {string} Fault domain value source cluster: - # Process counts for different roles processCounts: stateless: -1 # Automatically calculated storage: 3 # Storage processes cluster_controller: 1 - - # Version of FoundationDB to use + version: "7.4.1" - - # Fault domain configuration + faultDomain: key: "foundationdb.org/none" valueFrom: "$FDB_ZONE_ID" -# Storage configuration +## @param storage {storage} Storage configuration +## @field storage.size {quantity} Size of persistent volumes for each instance +## @field storage.storageClass {string} Storage class (if not set, uses cluster default) storage: - # Size of persistent volumes size: "16Gi" - # Storage class (if not set, uses cluster default) storageClass: "" -# Resource configuration -resources: - # Resource preset (will be used by cozy-lib) - preset: "medium" - # Custom resource overrides - limits: {} - requests: {} +## @param resources {*resources} Explicit CPU and memory configuration for each FoundationDB instance. When left empty, the preset defined in `resourcesPreset` is applied. +## @field resources.cpu {*quantity} CPU available to each instance +## @field resources.memory {*quantity} Memory (RAM) available to each instance +resources: {} + # resources: + # cpu: 2000m + # memory: 4Gi +## @param resourcesPreset {string enum:"small,medium,large,xlarge,2xlarge"} Default sizing preset used when `resources` is omitted. Allowed values: `small`, `medium`, `large`, `xlarge`, `2xlarge`. +resourcesPreset: "medium" -# Backup configuration +## @param backup {backup} Backup configuration +## @field backup.enabled {bool} Enable backups +## @field backup.s3 {backupS3} S3 configuration for backups +## @field backupS3.bucket {string} S3 bucket name +## @field backupS3.endpoint {string} S3 endpoint URL +## @field backupS3.region {string} S3 region +## @field backupS3.credentials {backupS3Credentials} S3 credentials +## @field backupS3Credentials.accessKeyId {string} S3 access key ID +## @field backupS3Credentials.secretAccessKey {string} S3 secret access key +## @field backup.retentionPolicy {string} Retention policy for backups backup: enabled: false - # S3 configuration for backups s3: bucket: "" endpoint: "" @@ -47,27 +64,29 @@ backup: credentials: accessKeyId: "" secretAccessKey: "" - # Retention policy for backups retentionPolicy: "7d" -# Monitoring +## @param monitoring {monitoring} Monitoring configuration +## @field monitoring.enabled {bool} Enable WorkloadMonitor integration monitoring: enabled: true -# Advanced configuration -advanced: - # Custom parameters to pass to FoundationDB - customParameters: [] - # Example: - # - knob_disable_posix_kernel_aio=1 - - # Image type (split recommended for production) - imageType: "split" - - # Security context for containers - securityContext: - runAsUser: 0 - runAsGroup: 0 - - # Enable automatic replacements - automaticReplacements: true \ No newline at end of file +## @section FoundationDB configuration +## +## @param customParameters {[]string} Custom parameters to pass to FoundationDB +customParameters: [] +# Example: +# - knob_disable_posix_kernel_aio=1 + +## @param imageType {string enum:"unified,split"} Container image deployment type (split recommended for production) +imageType: "split" + +## @param securityContext {securityContext} Security context for containers +## @field securityContext.runAsUser {int} User ID to run the container +## @field securityContext.runAsGroup {int} Group ID to run the container +securityContext: + runAsUser: 0 + runAsGroup: 0 + +## @param automaticReplacements {bool} Enable automatic pod replacements +automaticReplacements: true \ No newline at end of file