Skip to content

Commit 0cb9e72

Browse files
authored
Merge pull request #695 from klinch0/feature/add-presets
feature/add-presets
2 parents 728743d + b4584b4 commit 0cb9e72

49 files changed

Lines changed: 741 additions & 93 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/apps/clickhouse/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 0.6.2
19+
version: 0.7.0
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to

‎packages/apps/clickhouse/README.md‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ more details:
3636

3737
### Backup parameters
3838

39-
| Name | Description | Value |
40-
| ------------------------ | ---------------------------------------------- | ------------------------------------------------------ |
41-
| `backup.enabled` | Enable pereiodic backups | `false` |
42-
| `backup.s3Region` | The AWS S3 region where backups are stored | `us-east-1` |
43-
| `backup.s3Bucket` | The S3 bucket used for storing backups | `s3.example.org/clickhouse-backups` |
44-
| `backup.schedule` | Cron schedule for automated backups | `0 2 * * *` |
45-
| `backup.cleanupStrategy` | The strategy for cleaning up old backups | `--keep-last=3 --keep-daily=3 --keep-within-weekly=1m` |
46-
| `backup.s3AccessKey` | The access key for S3, used for authentication | `oobaiRus9pah8PhohL1ThaeTa4UVa7gu` |
47-
| `backup.s3SecretKey` | The secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
48-
| `backup.resticPassword` | The password for Restic backup encryption | `ChaXoveekoh6eigh4siesheeda2quai0` |
39+
| Name | Description | Value |
40+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
41+
| `backup.enabled` | Enable pereiodic backups | `false` |
42+
| `backup.s3Region` | The AWS S3 region where backups are stored | `us-east-1` |
43+
| `backup.s3Bucket` | The S3 bucket used for storing backups | `s3.example.org/clickhouse-backups` |
44+
| `backup.schedule` | Cron schedule for automated backups | `0 2 * * *` |
45+
| `backup.cleanupStrategy` | The strategy for cleaning up old backups | `--keep-last=3 --keep-daily=3 --keep-within-weekly=1m` |
46+
| `backup.s3AccessKey` | The access key for S3, used for authentication | `oobaiRus9pah8PhohL1ThaeTa4UVa7gu` |
47+
| `backup.s3SecretKey` | The secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
48+
| `backup.resticPassword` | The password for Restic backup encryption | `ChaXoveekoh6eigh4siesheeda2quai0` |
49+
| `resources` | Resources | `{}` |
50+
| `resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if resources is set (resources is recommended for production). | `nano` |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{{/*
2+
Copyright Broadcom, Inc. All Rights Reserved.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return a resource request/limit object based on a given preset.
10+
These presets are for basic testing and not meant to be used in production
11+
{{ include "resources.preset" (dict "type" "nano") -}}
12+
*/}}
13+
{{- define "resources.preset" -}}
14+
{{/* The limits are the requests increased by 50% (except ephemeral-storage and xlarge/2xlarge sizes)*/}}
15+
{{- $presets := dict
16+
"nano" (dict
17+
"requests" (dict "cpu" "100m" "memory" "128Mi" "ephemeral-storage" "50Mi")
18+
"limits" (dict "cpu" "150m" "memory" "192Mi" "ephemeral-storage" "2Gi")
19+
)
20+
"micro" (dict
21+
"requests" (dict "cpu" "250m" "memory" "256Mi" "ephemeral-storage" "50Mi")
22+
"limits" (dict "cpu" "375m" "memory" "384Mi" "ephemeral-storage" "2Gi")
23+
)
24+
"small" (dict
25+
"requests" (dict "cpu" "500m" "memory" "512Mi" "ephemeral-storage" "50Mi")
26+
"limits" (dict "cpu" "750m" "memory" "768Mi" "ephemeral-storage" "2Gi")
27+
)
28+
"medium" (dict
29+
"requests" (dict "cpu" "500m" "memory" "1024Mi" "ephemeral-storage" "50Mi")
30+
"limits" (dict "cpu" "750m" "memory" "1536Mi" "ephemeral-storage" "2Gi")
31+
)
32+
"large" (dict
33+
"requests" (dict "cpu" "1.0" "memory" "2048Mi" "ephemeral-storage" "50Mi")
34+
"limits" (dict "cpu" "1.5" "memory" "3072Mi" "ephemeral-storage" "2Gi")
35+
)
36+
"xlarge" (dict
37+
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
38+
"limits" (dict "cpu" "3.0" "memory" "6144Mi" "ephemeral-storage" "2Gi")
39+
)
40+
"2xlarge" (dict
41+
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
42+
"limits" (dict "cpu" "6.0" "memory" "12288Mi" "ephemeral-storage" "2Gi")
43+
)
44+
}}
45+
{{- if hasKey $presets .type -}}
46+
{{- index $presets .type | toYaml -}}
47+
{{- else -}}
48+
{{- printf "ERROR: Preset key '%s' invalid. Allowed values are %s" .type (join "," (keys $presets)) | fail -}}
49+
{{- end -}}
50+
{{- end -}}

‎packages/apps/clickhouse/templates/clickhouse.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ spec:
121121
containers:
122122
- name: clickhouse
123123
image: clickhouse/clickhouse-server:24.9.2.42
124+
{{- if .Values.resources }}
125+
resources: {{- toYaml .Values.resources | nindent 16 }}
126+
{{- else if ne .Values.resourcesPreset "none" }}
127+
resources: {{- include "resources.preset" (dict "type" .Values.resourcesPreset "Release" .Release) | nindent 16 }}
128+
{{- end }}
124129
volumeMounts:
125130
- name: data-volume-template
126131
mountPath: /var/lib/clickhouse

‎packages/apps/clickhouse/values.schema.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@
7676
"default": "ChaXoveekoh6eigh4siesheeda2quai0"
7777
}
7878
}
79+
},
80+
"resources": {
81+
"type": "object",
82+
"description": "Resources",
83+
"default": {}
84+
},
85+
"resourcesPreset": {
86+
"type": "string",
87+
"description": "Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if resources is set (resources is recommended for production).",
88+
"default": "nano"
7989
}
8090
}
8191
}

‎packages/apps/clickhouse/values.yaml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ backup:
4646
s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
4747
s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
4848
resticPassword: ChaXoveekoh6eigh4siesheeda2quai0
49+
50+
## @param resources Resources
51+
resources: {}
52+
# resources:
53+
# limits:
54+
# cpu: 4000m
55+
# memory: 4Gi
56+
# requests:
57+
# cpu: 100m
58+
# memory: 512Mi
59+
60+
## @param resourcesPreset Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if resources is set (resources is recommended for production).
61+
resourcesPreset: "nano"

‎packages/apps/ferretdb/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 0.4.2
19+
version: 0.5.0
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to

‎packages/apps/ferretdb/README.md‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121

2222
### Backup parameters
2323

24-
| Name | Description | Value |
25-
| ------------------------ | ---------------------------------------------- | ------------------------------------------------------ |
26-
| `backup.enabled` | Enable pereiodic backups | `false` |
27-
| `backup.s3Region` | The AWS S3 region where backups are stored | `us-east-1` |
28-
| `backup.s3Bucket` | The S3 bucket used for storing backups | `s3.example.org/postgres-backups` |
29-
| `backup.schedule` | Cron schedule for automated backups | `0 2 * * *` |
30-
| `backup.cleanupStrategy` | The strategy for cleaning up old backups | `--keep-last=3 --keep-daily=3 --keep-within-weekly=1m` |
31-
| `backup.s3AccessKey` | The access key for S3, used for authentication | `oobaiRus9pah8PhohL1ThaeTa4UVa7gu` |
32-
| `backup.s3SecretKey` | The secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
33-
| `backup.resticPassword` | The password for Restic backup encryption | `ChaXoveekoh6eigh4siesheeda2quai0` |
24+
| Name | Description | Value |
25+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
26+
| `backup.enabled` | Enable pereiodic backups | `false` |
27+
| `backup.s3Region` | The AWS S3 region where backups are stored | `us-east-1` |
28+
| `backup.s3Bucket` | The S3 bucket used for storing backups | `s3.example.org/postgres-backups` |
29+
| `backup.schedule` | Cron schedule for automated backups | `0 2 * * *` |
30+
| `backup.cleanupStrategy` | The strategy for cleaning up old backups | `--keep-last=3 --keep-daily=3 --keep-within-weekly=1m` |
31+
| `backup.s3AccessKey` | The access key for S3, used for authentication | `oobaiRus9pah8PhohL1ThaeTa4UVa7gu` |
32+
| `backup.s3SecretKey` | The secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
33+
| `backup.resticPassword` | The password for Restic backup encryption | `ChaXoveekoh6eigh4siesheeda2quai0` |
34+
| `resources` | Resources | `{}` |
35+
| `resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if resources is set (resources is recommended for production). | `nano` |
3436

3537

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{{/*
2+
Copyright Broadcom, Inc. All Rights Reserved.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return a resource request/limit object based on a given preset.
10+
These presets are for basic testing and not meant to be used in production
11+
{{ include "resources.preset" (dict "type" "nano") -}}
12+
*/}}
13+
{{- define "resources.preset" -}}
14+
{{/* The limits are the requests increased by 50% (except ephemeral-storage and xlarge/2xlarge sizes)*/}}
15+
{{- $presets := dict
16+
"nano" (dict
17+
"requests" (dict "cpu" "100m" "memory" "128Mi" "ephemeral-storage" "50Mi")
18+
"limits" (dict "cpu" "150m" "memory" "192Mi" "ephemeral-storage" "2Gi")
19+
)
20+
"micro" (dict
21+
"requests" (dict "cpu" "250m" "memory" "256Mi" "ephemeral-storage" "50Mi")
22+
"limits" (dict "cpu" "375m" "memory" "384Mi" "ephemeral-storage" "2Gi")
23+
)
24+
"small" (dict
25+
"requests" (dict "cpu" "500m" "memory" "512Mi" "ephemeral-storage" "50Mi")
26+
"limits" (dict "cpu" "750m" "memory" "768Mi" "ephemeral-storage" "2Gi")
27+
)
28+
"medium" (dict
29+
"requests" (dict "cpu" "500m" "memory" "1024Mi" "ephemeral-storage" "50Mi")
30+
"limits" (dict "cpu" "750m" "memory" "1536Mi" "ephemeral-storage" "2Gi")
31+
)
32+
"large" (dict
33+
"requests" (dict "cpu" "1.0" "memory" "2048Mi" "ephemeral-storage" "50Mi")
34+
"limits" (dict "cpu" "1.5" "memory" "3072Mi" "ephemeral-storage" "2Gi")
35+
)
36+
"xlarge" (dict
37+
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
38+
"limits" (dict "cpu" "3.0" "memory" "6144Mi" "ephemeral-storage" "2Gi")
39+
)
40+
"2xlarge" (dict
41+
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
42+
"limits" (dict "cpu" "6.0" "memory" "12288Mi" "ephemeral-storage" "2Gi")
43+
)
44+
}}
45+
{{- if hasKey $presets .type -}}
46+
{{- index $presets .type | toYaml -}}
47+
{{- else -}}
48+
{{- printf "ERROR: Preset key '%s' invalid. Allowed values are %s" .type (join "," (keys $presets)) | fail -}}
49+
{{- end -}}
50+
{{- end -}}

‎packages/apps/ferretdb/templates/postgres.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ spec:
1515
{{- end }}
1616
minSyncReplicas: {{ .Values.quorum.minSyncReplicas }}
1717
maxSyncReplicas: {{ .Values.quorum.maxSyncReplicas }}
18-
18+
{{- if .Values.resources }}
19+
resources: {{- toYaml .Values.resources | nindent 4 }}
20+
{{- else if ne .Values.resourcesPreset "none" }}
21+
resources: {{- include "resources.preset" (dict "type" .Values.resourcesPreset "Release" .Release) | nindent 4 }}
22+
{{- end }}
1923
monitoring:
2024
enablePodMonitor: true
2125

0 commit comments

Comments
 (0)