Skip to content

Commit

Permalink
Rationalize Versions (#14)
Browse files Browse the repository at this point in the history
We had to duplicate the Kubernetes version in multiple places, which
makes configuration harder, and is a classic case of over-engineering
when any iupgrade logic should already be part of CAPI.  I've bumped
this to a new major alpha version too as legacy naming is now dead, and
we shouldn't be supporting something that is inherently broken because
it will just waste time.
  • Loading branch information
spjmurray authored Jul 19, 2024
1 parent ec49678 commit b71526f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 44 deletions.
2 changes: 1 addition & 1 deletion charts/cluster-api-cluster-openstack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: cluster-api-cluster-openstack
description: A Helm chart to deploy a Kubernetes Cluster
type: application
version: v0.4.4
version: v0.5.0
icon: https://raw.githubusercontent.com/unikorn-cloud/helm-cluster-api/main/icons/default.png
2 changes: 1 addition & 1 deletion charts/cluster-api-cluster-openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
source:
repoURL: https://unikorn-cloud.github.io/helm-cluster-api
chart: cluster-api-cluster-openstack
targetRevision: v0.4.4
targetRevision: v0.5.0
helm:
releaseName: foo
# Remove the default work queue.
Expand Down
8 changes: 0 additions & 8 deletions charts/cluster-api-cluster-openstack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ dev/staging/production CAPI instances.
{{- printf "%s-cloud-config" .Release.Name }}
{{- end }}
{{- define "kubeadmcontrolplane.name" }}
{{- if .Values.legacyResourceNames }}
{{- printf "%s-control-plane" .Release.Name }}
{{- else }}
{{- .Release.Name }}
{{- end }}
{{- end }}
{{/*
The machine templates are a bit special in that their names will directly
influence the hostnames of the nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
controlPlaneRef:
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
name: {{ include "kubeadmcontrolplane.name" . }}
name: {{ .Release.Name }}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackCluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
name: {{ include "kubeadmcontrolplane.name" . }}
name: {{ .Release.Name }}
labels:
{{- include "openstackcluster.labels" . | nindent 4 }}
annotations:
# Let CAPO do this in its chosen order.
argocd.argoproj.io/sync-options: Delete=false
spec:
version: "{{ .Values.controlPlane.version }}"
version: "{{ .Values.version }}"
replicas: {{ .Values.controlPlane.replicas }}
machineTemplate:
infrastructureRef:
Expand Down
7 changes: 1 addition & 6 deletions charts/cluster-api-cluster-openstack/templates/workload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ The resource names are common all over the place, so define in a canonical locat
*/}}
{{- $pool_name := printf "%s-pool-%s" $.Release.Name ( $name | sha256sum | trunc 8 ) }}
{{- $pool_name_discriminated := printf "%s-pool-%s-%s" $.Release.Name ( $name | sha256sum | trunc 8 ) ( include "openstack.discriminator.workload" $context ) }}

{{- if $values.legacyResourceNames }}
{{- $pool_name = printf "%v-pool-%v" $.Release.Name $name }}
{{- $pool_name_discriminated = printf "%v-pool-%v-%v" $.Release.Name $name (include "openstack.discriminator.workload" $context) }}
{{- end }}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
Expand All @@ -39,7 +34,7 @@ spec:
template:
spec:
clusterName: {{ include "cluster.name" $ }}
version: "{{ $pool.version }}"
version: "{{ $.Values.version }}"
failureDomain: {{ include "openstack.failureDomain.compute.workload" $context }}
bootstrap:
configRef:
Expand Down
15 changes: 4 additions & 11 deletions charts/cluster-api-cluster-openstack/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,10 @@
"workloadMachineSet": {
"type": "object",
"required": [
"version",
"replicas",
"machine"
],
"properties": {
"version": {
"$ref": "#/$defs/semanticVersion"
},
"replicas": {
"$ref": "#/$defs/nonNegativeNumber"
},
Expand Down Expand Up @@ -218,18 +214,19 @@
},
"type": "object",
"required": [
"version",
"labelDomain",
"openstack",
"controlPlane",
"network"
],
"properties": {
"version": {
"$ref": "#/$defs/semanticVersion"
},
"labelDomain": {
"type": "string"
},
"legacyResourceNames": {
"type": "boolean"
},
"openstack": {
"type:": "object",
"required": [
Expand Down Expand Up @@ -299,14 +296,10 @@
"controlPlane": {
"type": "object",
"required": [
"version",
"replicas",
"machine"
],
"properties": {
"version": {
"$ref": "#/$defs/semanticVersion"
},
"replicas": {
"$ref": "#/$defs/nonNegativeNumber"
},
Expand Down
18 changes: 4 additions & 14 deletions charts/cluster-api-cluster-openstack/values.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Label domain for implicit labels defined in this chart.
labelDomain: unikorn-cloud.org

# Legacy resource names are very easy to go over the 63 character resource name
# limit as you can imagine a 53 character release concatenated with an arbitrary
# sized pool name, and a random instance ID. With this set to false, we'll put
# tainted inputs through SHA2 and extract an 8 character substring (that's still
# 4 billion possible outcomes). Try to kee the release name in the ~20 character
# range to avoid overflows (if this means hashing, do it).
legacyResourceNames: false
# Version of Kubernetes, should match that pre-installed on the base images
# otherwise you'll have to pay a start-up penalty as kubeadm downloads the
# images.
version: v1.30.2

# OpenStack specific configuration.
# Contains credentials for the cloud, networking options and other
Expand Down Expand Up @@ -72,9 +69,6 @@ openstack:
# Control plane topology.
# Modifications to this object will trigger a control plane upgrade.
controlPlane:
# Version of Kubernetes, should match that installed on the base images.
version: v1.30.2

# Number of control plane machines.
replicas: 3

Expand Down Expand Up @@ -108,10 +102,6 @@ controlPlane:
# workloadPools:
# # Pool name
# default:
# # Version of Kubernetes, should match that installed on the base images
# # in order to improve provisioning and scaling time.
# version: v1.30.2
#
# # Number of workload machines.
# replicas: 3
#
Expand Down

0 comments on commit b71526f

Please sign in to comment.