Skip to content

Commit 89d11aa

Browse files
kvapsNickVolynkin
authored andcommitted
Introduce new OpenAPI schema generator
Use https://github.com/cozystack/cozyvalues-gen for three apps: - apps/postgres - apps/virtual-machine - extra/monitoring Changes: - Add type and enum definitions to values.yaml. - Update READMEs with new information. - Update values.schema.json with definitions for children objects, allowing precise UI customization. Add regexp for specific types such as resources: CPU like `500m` and RAM like `4GiB`. - Remove direct injections with `yq` from Makefiles where they're not needed anymore. Co-authored-by: Nick Volynkin <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]> Signed-off-by: Nick Volynkin <[email protected]>
1 parent 8ddbe32 commit 89d11aa

13 files changed

Lines changed: 952 additions & 389 deletions

File tree

‎.github/workflows/pre-commit.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- name: Install generate
3030
run: |
3131
curl -sSL https://github.com/cozystack/readme-generator-for-helm/releases/download/v1.0.0/readme-generator-for-helm-linux-amd64.tar.gz | tar -xzvf- -C /usr/local/bin/ readme-generator-for-helm
32+
curl -sSL https://github.com/cozystack/cozyvalues-gen/releases/download/v0.7.0/cozyvalues-gen-linux-amd64.tar.gz | tar -xzvf- -C /usr/local/bin/ cozyvalues-gen
3233
3334
- name: Run pre-commit hooks
3435
run: |

‎packages/apps/postgres/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
include ../../../scripts/package.mk
2-
PRESET_ENUM := ["nano","micro","small","medium","large","xlarge","2xlarge"]
32

43
generate:
5-
readme-generator-for-helm -v values.yaml -s values.schema.json -r README.md
6-
yq -i -o json --indent 4 '.properties.resourcesPreset.enum = $(PRESET_ENUM)' values.schema.json
4+
cozyvalues-gen -v values.yaml -s values.schema.json -r README.md

‎packages/apps/postgres/README.md‎

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,44 +66,61 @@ See:
6666

6767
### Common parameters
6868

69-
| Name | Description | Value |
70-
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------- |
71-
| `replicas` | Number of Postgres replicas | `2` |
72-
| `resources` | Explicit CPU and memory configuration for each PostgreSQL replica. When left empty, the preset defined in `resourcesPreset` is applied. | `{}` |
73-
| `resourcesPreset` | Default sizing preset used when `resources` is omitted. Allowed values: nano, micro, small, medium, large, xlarge, 2xlarge. | `micro` |
74-
| `size` | Persistent Volume size | `10Gi` |
75-
| `storageClass` | StorageClass used to store the data | `""` |
76-
| `external` | Enable external access from outside the cluster | `false` |
69+
| Name | Description | Type | Value |
70+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------- |
71+
| `replicas` | Number of Postgres replicas | `int` | `2` |
72+
| `resources` | Explicit CPU and memory configuration for each PostgreSQL replica. When left empty, the preset defined in `resourcesPreset` is applied. | `*object` | `{}` |
73+
| `resources.cpu` | CPU | `*string` | `null` |
74+
| `resources.memory` | Memory | `*string` | `null` |
75+
| `resourcesPreset` | Default sizing preset used when `resources` is omitted. Allowed values: `nano`, `micro`, `small`, `medium`, `large`, `xlarge`, `2xlarge`. | `string` | `{}` |
76+
| `size` | Persistent Volume size | `string` | `10Gi` |
77+
| `storageClass` | StorageClass used to store the data | `string` | `""` |
78+
| `external` | Enable external access from outside the cluster | `bool` | `false` |
79+
7780

7881
### Application-specific parameters
7982

80-
| Name | Description | Value |
81-
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----- |
82-
| `postgresql.parameters.max_connections` | Determines the maximum number of concurrent connections to the database server. The default is typically 100 connections | `100` |
83-
| `quorum.minSyncReplicas` | Minimum number of synchronous replicas that must acknowledge a transaction before it is considered committed. | `0` |
84-
| `quorum.maxSyncReplicas` | Maximum number of synchronous replicas that can acknowledge a transaction (must be lower than the number of instances). | `0` |
85-
| `users` | Users configuration | `{}` |
86-
| `databases` | Databases configuration | `{}` |
83+
| Name | Description | Type | Value |
84+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------- | ------- |
85+
| `postgresql` | PostgreSQL server configuration | `object` | `{}` |
86+
| `postgresql.parameters` | PostgreSQL server parameters | `object` | `{}` |
87+
| `postgresql.parameters.max_connections` | Determines the maximum number of concurrent connections to the database server. The default is typically 100 connections | `int` | `100` |
88+
| `quorum` | Quorum configuration for synchronous replication | `object` | `{}` |
89+
| `quorum.minSyncReplicas` | Minimum number of synchronous replicas that must acknowledge a transaction before it is considered committed. | `int` | `0` |
90+
| `quorum.maxSyncReplicas` | Maximum number of synchronous replicas that can acknowledge a transaction (must be lower than the number of instances). | `int` | `0` |
91+
| `users` | Users configuration | `map[string]object` | `{...}` |
92+
| `users[name].password` | Password for the user | `*string` | `null` |
93+
| `users[name].replication` | Whether the user has replication privileges | `*bool` | `null` |
94+
| `databases` | Databases configuration | `map[string]object` | `{...}` |
95+
| `databases[name].roles` | Roles for the database | `*object` | `null` |
96+
| `databases[name].roles.admin` | List of users with admin privileges | `[]string` | `[]` |
97+
| `databases[name].roles.readonly` | List of users with read-only privileges | `[]string` | `[]` |
98+
| `databases[name].extensions` | Extensions enabled for the database | `[]string` | `[]` |
99+
87100

88101
### Backup parameters
89102

90-
| Name | Description | Value |
91-
| ------------------------ | ---------------------------------------------------------- | ----------------------------------- |
92-
| `backup.enabled` | Enable regular backups | `false` |
93-
| `backup.schedule` | Cron schedule for automated backups | `0 2 * * * *` |
94-
| `backup.retentionPolicy` | Retention policy | `30d` |
95-
| `backup.destinationPath` | Path to store the backup (i.e. s3://bucket/path/to/folder) | `s3://bucket/path/to/folder/` |
96-
| `backup.endpointURL` | S3 Endpoint used to upload data to the cloud | `http://minio-gateway-service:9000` |
97-
| `backup.s3AccessKey` | Access key for S3, used for authentication | `oobaiRus9pah8PhohL1ThaeTa4UVa7gu` |
98-
| `backup.s3SecretKey` | Secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
103+
| Name | Description | Type | Value |
104+
| ------------------------ | ---------------------------------------------------------- | -------- | ----------------------------------- |
105+
| `backup` | Backup configuration | `object` | `{}` |
106+
| `backup.enabled` | Enable regular backups | `bool` | `false` |
107+
| `backup.schedule` | Cron schedule for automated backups | `string` | `0 2 * * * *` |
108+
| `backup.retentionPolicy` | Retention policy | `string` | `30d` |
109+
| `backup.destinationPath` | Path to store the backup (i.e. s3://bucket/path/to/folder) | `string` | `s3://bucket/path/to/folder/` |
110+
| `backup.endpointURL` | S3 Endpoint used to upload data to the cloud | `string` | `http://minio-gateway-service:9000` |
111+
| `backup.s3AccessKey` | Access key for S3, used for authentication | `string` | `<access key>` |
112+
| `backup.s3SecretKey` | Secret key for S3, used for authentication | `string` | `<secret key>` |
113+
99114

100115
### Bootstrap (recovery) parameters
101116

102-
| Name | Description | Value |
103-
| ------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------- |
104-
| `bootstrap.enabled` | Restore database cluster from a backup | `false` |
105-
| `bootstrap.recoveryTime` | Timestamp (PITR) up to which recovery will proceed, expressed in RFC 3339 format. If left empty, will restore latest | `""` |
106-
| `bootstrap.oldName` | Name of database cluster before deleting | `""` |
117+
| Name | Description | Type | Value |
118+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------- | --------- | ------- |
119+
| `bootstrap` | Bootstrap configuration | `object` | `{}` |
120+
| `bootstrap.enabled` | Restore database cluster from a backup | `bool` | `false` |
121+
| `bootstrap.recoveryTime` | Timestamp (PITR) up to which recovery will proceed, expressed in RFC 3339 format. If left empty, will restore latest | `*string` | `""` |
122+
| `bootstrap.oldName` | Name of database cluster before deleting | `string` | `""` |
123+
107124

108125
## Parameter examples and reference
109126

0 commit comments

Comments
 (0)