Skip to content

Commit

Permalink
Add workloadKubernetesVersion to v1.3 clusterctl upgrade test
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Jun 19, 2023
1 parent cd0351c commit a19a288
Show file tree
Hide file tree
Showing 7 changed files with 656 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/e2e/clusterctl_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ type ClusterctlUpgradeSpecInput struct {
MgmtFlavor string
CNIManifestPath string
WorkloadFlavor string
// WorkloadKubernetesVersion is Kubernetes version used to create the workload cluster, e.g. `v1.25.0`
WorkloadKubernetesVersion string
// Custom providers can be specified to upgrade to a pre-release or a custom version instead of upgrading to the latest using contact
CoreProvider string
BootstrapProviders []string
Expand Down Expand Up @@ -328,7 +330,10 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
// so we are getting a template using the downloaded version of clusterctl, applying it, and wait for machines to be provisioned.

workLoadClusterName = fmt.Sprintf("%s-%s", specName, util.RandomString(6))
kubernetesVersion := input.E2EConfig.GetVariable(KubernetesVersion)
kubernetesVersion := input.WorkloadKubernetesVersion
if kubernetesVersion == "" {
kubernetesVersion = input.E2EConfig.GetVariable(KubernetesVersion)
}
controlPlaneMachineCount := pointer.Int64(1)
workerMachineCount := pointer.Int64(1)

Expand Down
2 changes: 2 additions & 0 deletions test/e2e/clusterctl_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _ = Describe("When testing clusterctl upgrades (v0.3=>current)", func() {
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v0.3/bases.
InitWithKubernetesVersion: "v1.21.12",
// CAPI does not work with Kubernetes < v1.22 if ClusterClass is enabled, so we have to disable it.
WorkloadKubernetesVersion: "v1.21.12",
UpgradeClusterctlVariables: map[string]string{
"CLUSTER_TOPOLOGY": "false",
},
Expand All @@ -58,6 +59,7 @@ var _ = Describe("When testing clusterctl upgrades (v0.4=>current)", func() {
InitWithProvidersContract: "v1alpha4",
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v0.4/bases.
InitWithKubernetesVersion: "v1.23.13",
WorkloadKubernetesVersion: "v1.23.13",
MgmtFlavor: "topology",
WorkloadFlavor: "",
}
Expand Down
167 changes: 167 additions & 0 deletions test/e2e/data/infrastructure-docker/v1.0/cluster-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
apiVersion: v1
binaryData: null
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: ${CLUSTER_NAME}-crs-0
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
fail-swap-on: "false"
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
cni: ${CLUSTER_NAME}-crs-0
name: ${CLUSTER_NAME}
spec:
clusterNetwork:
pods:
cidrBlocks:
- ${DOCKER_POD_CIDRS}
serviceDomain: ${DOCKER_SERVICE_DOMAIN}
services:
cidrBlocks:
- ${DOCKER_SERVICE_CIDRS}
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: ${CLUSTER_NAME}-control-plane
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
name: ${CLUSTER_NAME}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels: null
template:
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: ${CLUSTER_NAME}-md-0
clusterName: ${CLUSTER_NAME}
failureDomain: fd4
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: ${CLUSTER_NAME}-md-0
version: ${KUBERNETES_VERSION}
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
labels:
kcp-adoption.step2: ""
name: ${CLUSTER_NAME}-control-plane
spec:
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
- 0.0.0.0
- host.docker.internal
controllerManager:
extraArgs:
enable-hostpath-provisioner: "true"
initConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
fail-swap-on: "false"
joinConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
fail-swap-on: "false"
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: ${CLUSTER_NAME}-control-plane
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: ${KUBERNETES_VERSION}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
metadata:
name: ${CLUSTER_NAME}
spec:
failureDomains:
fd1:
controlPlane: true
fd2:
controlPlane: true
fd3:
controlPlane: true
fd4:
controlPlane: false
fd5:
controlPlane: false
fd6:
controlPlane: false
fd7:
controlPlane: false
fd8:
controlPlane: false
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
spec:
template:
spec:
extraMounts:
- containerPath: /var/run/docker.sock
hostPath: /var/run/docker.sock
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
template:
spec:
extraMounts:
- containerPath: /var/run/docker.sock
hostPath: /var/run/docker.sock
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: v1
binaryData: null
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: ${CLUSTER_NAME}-crs-0
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
cni: ${CLUSTER_NAME}-crs-0
name: ${CLUSTER_NAME}
namespace: default
spec:
clusterNetwork:
pods:
cidrBlocks:
- ${DOCKER_POD_CIDRS}
serviceDomain: ${DOCKER_SERVICE_DOMAIN}
services:
cidrBlocks:
- ${DOCKER_SERVICE_CIDRS}
topology:
class: quick-start
controlPlane:
metadata:
annotations:
annotation-from-cluster-topology: value-from-cluster-topology
labels:
label-from-cluster-topology: value-from-cluster-topology
nodeDeletionTimeout: 30s
nodeVolumeDetachTimeout: 5m
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: etcdImageTag
value: ""
- name: coreDNSImageTag
value: ""
- name: preLoadImages
value: ${DOCKER_PRELOAD_IMAGES:-[]}
version: ${KUBERNETES_VERSION}
workers:
machineDeployments:
- class: default-worker
failureDomain: fd4
metadata:
annotations:
annotation-from-cluster-topology: value-from-cluster-topology
labels:
label-from-cluster-topology: value-from-cluster-topology
minReadySeconds: 5
name: md-0
nodeDeletionTimeout: 30s
nodeVolumeDetachTimeout: 5m
replicas: ${WORKER_MACHINE_COUNT}
strategy:
rollingUpdate:
maxSurge: 20%
maxUnavailable: 0
Loading

0 comments on commit a19a288

Please sign in to comment.