Skip to content

Commit

Permalink
fix(t8s-cluster/clusterClass): fix redundant rolling of machines (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau authored Jul 24, 2023
1 parent c4a2a57 commit c025032
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ infrastructure.cluster.x-k8s.io/v1alpha6
openstack
{{- end -}}

{{- define "t8s-cluster.clusterClass.imageVersion" -}}
{{- printf "t8s-engine-2004-kube-%s" (include "t8s-cluster.k8s-version" $) -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.getIdentityRefSecretName" -}}
{{- printf "cloud-config-%s" .Release.Name -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,31 @@ spec:
names: {{- .Values.workers | keys | sortAlpha | toYaml | nindent 18 }}
description: Sets the ServerGroupID for MachineDeployment machines.
name: machineDeploymentServerGroupID
- definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/image
valueFrom:
template: {{ .Values.imageNameTemplate.workers }}
selector:
apiVersion: {{ include "t8s-cluster.clusterClass.infrastructureApiVersion" $ }}
kind: OpenStackMachineTemplate
matchResources:
machineDeploymentClass:
names: {{- .Values.workers | keys | sortAlpha | toYaml | nindent 18 }}
- jsonPatches:
- op: add
path: /spec/template/spec/image
valueFrom:
template: {{ .Values.imageNameTemplate.controlPlane }}
selector:
apiVersion: {{ include "t8s-cluster.clusterClass.infrastructureApiVersion" $ }}
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true

description: Sets the image version for machines.
name: imageVersion
- name: controlPlaneAvailabilityZones
enabledIf: {{ `{{ if .controlPlaneAvailabilityZones }}true{{ end }}` | quote }}
definitions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ flavor: {{ .machineDeploymentClass.flavor }}
identityRef:
name: {{ include "t8s-cluster.clusterClass.getIdentityRefSecretName" .context }}
kind: Secret
image: {{ include "t8s-cluster.clusterClass.imageVersion" .context }} # artifacthub-ignore
securityGroups: {{- include "t8s-cluster.clusterClass.securityGroups" .machineDeploymentClass | nindent 2 }}
{{- with .Values.sshKeyName }}
sshKeyName: {{ . }}
Expand Down
16 changes: 16 additions & 0 deletions charts/t8s-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,22 @@
"calico"
]
},
"imageNameTemplate": {
"type": "object",
"properties": {
"workers": {
"type": "string"
},
"controlPlane": {
"type": "string"
}
},
"required": [
"workers",
"controlPlane"
],
"additionalItems": false
},
"common": {
"type": "object",
"description": "Values for sub-chart"
Expand Down
4 changes: 4 additions & 0 deletions charts/t8s-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ containerRegistryProxy:
sshKeyName: null

cni: cilium

imageNameTemplate:
workers: t8s-engine-2004-kube-{{ .builtin.machineDeployment.version }}
controlPlane: t8s-engine-2004-kube-{{ .builtin.controlPlane.version }}

0 comments on commit c025032

Please sign in to comment.