Skip to content

Commit 1434c18

Browse files
committed
[kubernetes] User-selectable cluster version
This patch adds a new version field to the kubernetes chart, letting end-users specify the version of kubernetes they want to deploy. [kubernetes] Let users specify desired version of tenant k8s cluster. Signed-off-by: Timofei Larkin <[email protected]>
1 parent 70f8266 commit 1434c18

8 files changed

Lines changed: 30 additions & 6 deletions

File tree

‎packages/apps/kubernetes/Chart.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ 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.25.0
19+
version: 0.26.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
2323
# follow Semantic Versioning. They should reflect the version the application is using.
2424
# It is recommended to use it with quotes.
25-
appVersion: 1.32.4
25+
appVersion: 1.32.6

‎packages/apps/kubernetes/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include ../../../scripts/package.mk
66

77
generate:
88
readme-generator -v values.yaml -s values.schema.json -r README.md
9+
yq -o json -i '.properties.version.enum = ["v1.28","v1.29","v1.30","v1.31","v1.32","v1.33"]' values.schema.json
910
yq -o json -i '.properties.addons.properties.ingressNginx.properties.exposeMethod.enum = ["Proxied","LoadBalancer"]' values.schema.json
1011
yq -o json -i '.properties.controlPlane.properties.apiServer.properties.resourcesPreset.enum = ["none","nano","micro","small","medium","large","xlarge","2xlarge"]' values.schema.json
1112
yq -o json -i '.properties.controlPlane.properties.controllerManager.properties.resourcesPreset.enum = ["none","nano","micro","small","medium","large","xlarge","2xlarge"]' values.schema.json

‎packages/apps/kubernetes/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ See the reference for components utilized in this service:
8686
| `host` | Hostname used to access the Kubernetes cluster externally. Defaults to `<cluster-name>.<tenant-host>` when empty. | `""` |
8787
| `controlPlane.replicas` | Number of replicas for Kubernetes control-plane components. | `2` |
8888
| `storageClass` | StorageClass used to store user data. | `replicated` |
89+
| `version` | Kubernetes version given as vMAJOR.MINOR | `v1.32` |
8990
| `nodeGroups` | nodeGroups configuration | `{}` |
9091
9192
### Cluster Addons
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- define "kubernetes.versionMap" }}
2+
{{- $versionMap := dict `v1.28` `v1.28.15` `v1.29` `v1.29.15` `v1.30` `v1.30.14` `v1.31` `v1.31.10` `v1.32` `v1.32.6` `v1.33` `v1.33.2` }}
3+
{{- if not (hasKey $versionMap .) }}
4+
{{- printf `Kubernetes version %s is not supported, allowed versions are %s` . (keys $versionMap) | fail }}
5+
{{- end }}
6+
{{- index $versionMap . }}
7+
{{- end }}

‎packages/apps/kubernetes/templates/cluster.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ spec:
151151
labels:
152152
policy.cozystack.io/allow-to-etcd: "true"
153153
replicas: 2
154-
version: {{ $.Chart.AppVersion }}
154+
version: {{ include "kubernetes.versionMap" $.Values.version }}
155155
---
156156
apiVersion: cozystack.io/v1alpha1
157157
kind: WorkloadMonitor
@@ -290,7 +290,7 @@ spec:
290290
kind: KubevirtMachineTemplate
291291
name: {{ $.Release.Name }}-{{ $groupName }}-{{ $kubevirtmachinetemplateHash }}
292292
namespace: {{ $.Release.Namespace }}
293-
version: v{{ $.Chart.AppVersion }}
293+
version: {{ include "kubernetes.versionMap" $.Values.version }}
294294
---
295295
apiVersion: cluster.x-k8s.io/v1beta1
296296
kind: MachineHealthCheck

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,19 @@
127127
"description": "StorageClass used to store user data.",
128128
"default": "replicated"
129129
},
130+
"version": {
131+
"type": "string",
132+
"description": "Kubernetes version given as vMAJOR.MINOR",
133+
"default": "v1.32",
134+
"enum": [
135+
"v1.28",
136+
"v1.29",
137+
"v1.30",
138+
"v1.31",
139+
"v1.32",
140+
"v1.33"
141+
]
142+
},
130143
"addons": {
131144
"type": "object",
132145
"properties": {

‎packages/apps/kubernetes/values.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
## @param host Hostname used to access the Kubernetes cluster externally. Defaults to `<cluster-name>.<tenant-host>` when empty.
44
## @param controlPlane.replicas Number of replicas for Kubernetes control-plane components.
55
## @param storageClass StorageClass used to store user data.
6+
## @param version Kubernetes version given as vMAJOR.MINOR
67
##
78
host: ""
89
storageClass: replicated
9-
10+
version: "v1.32"
1011
## @param nodeGroups [object] nodeGroups configuration
1112
##
1213
nodeGroups:

‎packages/apps/versions_map‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ kafka 0.7.0 6358fd7a
5454
kafka 0.7.1 4369b031
5555
kafka 0.8.0 HEAD
5656
kubernetes 0.24.0 62cb694d
57-
kubernetes 0.25.0 HEAD
57+
kubernetes 0.25.0 70f82667
58+
kubernetes 0.26.0 HEAD
5859
mysql 0.1.0 263e47be
5960
mysql 0.2.0 c24a103f
6061
mysql 0.3.0 53f2365e

0 commit comments

Comments
 (0)