Skip to content

Commit

Permalink
Add 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 Sep 29, 2023
1 parent e77d02c commit 4dcf5b7
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ generate-doctoc:
TRACE=$(TRACE) ./hack/generate-doctoc.sh

.PHONY: generate-e2e-templates
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, main) ## Generate test templates for all branches
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, v1.8 main) ## Generate test templates for all branches

.PHONY: generate-e2e-templates-main
generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the main branch
Expand All @@ -322,6 +322,10 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/dhcp-overrides > $(E2E_TEMPLATE_DIR)/main/cluster-template-dhcp-overrides.yaml
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/ownerreferences > $(E2E_TEMPLATE_DIR)/main/cluster-template-ownerreferences.yaml

.PHONY: generate-e2e-templates-v1.8
generate-e2e-templates-v1.8: $(KUSTOMIZE)
$(KUSTOMIZE) build $(E2E_TEMPLATE_DIR)/v1.8/cluster-template --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATE_DIR)/v1.8/cluster-template.yaml


## --------------------------------------
## Lint / Verify
Expand Down
1 change: 1 addition & 0 deletions hack/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set -o errexit # exits immediately on any unexpected error (does not bypass tra
set -o nounset # will error if variables are used without first being defined
set -o pipefail # any non-zero exit code in a piped command causes the pipeline to fail with that code

export TRACE=1
export PATH=${PWD}/hack/tools/bin:${PATH}
REPO_ROOT=$(git rev-parse --show-toplevel)

Expand Down
47 changes: 47 additions & 0 deletions test/e2e/clusterctl_upgrade_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e

import (
"context"

. "github.com/onsi/ginkgo/v2"
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
)

var _ = Describe("Upgrading cluster from CAPV 1.8.X to main using clusterctl [PR-Blocking]", func() {
capi_e2e.ClusterctlUpgradeSpec(context.TODO(), func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
InitWithProvidersContract: "v1beta1",
MgmtFlavor: "remote-management",
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.2/clusterctl-{OS}-{ARCH}",
InitWithCoreProvider: "cluster-api:v1.5.2",
InitWithBootstrapProviders: []string{"kubeadm:v1.5.2"},
InitWithControlPlaneProviders: []string{"kubeadm:v1.5.2"},
InitWithInfrastructureProviders: []string{"vsphere:v1.8.1"},
InitWithRuntimeExtensionProviders: []string{},
InitWithKubernetesVersion: "v1.28.0",
WorkloadKubernetesVersion: "v1.28.0",
WorkloadFlavor: "",
}
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.30.0/24
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Secret
metadata:
name: csi-vsphere-config
namespace: '${NAMESPACE}'
stringData:
data: |
apiVersion: v1
kind: Secret
metadata:
name: csi-vsphere-config
namespace: kube-system
stringData:
csi-vsphere.conf: |+
[Global]
cluster-id = "${NAMESPACE}/${CLUSTER_NAME}"
[VirtualCenter "${VSPHERE_SERVER}"]
insecure-flag = "${VSPHERE_INSECURE_CSI}"
user = "${VSPHERE_USERNAME}"
password = "${VSPHERE_PASSWORD}"
datacenters = "${VSPHERE_DATACENTER}"
[Network]
public-network = "${VSPHERE_NETWORK}"
type: Opaque
type: addons.cluster.x-k8s.io/resource-set
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
labels:
cni: "${CLUSTER_NAME}-crs-cni"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: "cni-${CLUSTER_NAME}-crs-cni"
data: ${CNI_RESOURCES}
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: "${CLUSTER_NAME}-crs-cni"
spec:
strategy: ApplyOnce
clusterSelector:
matchLabels:
cni: "${CLUSTER_NAME}-crs-cni"
resources:
- name: "cni-${CLUSTER_NAME}-crs-cni"
kind: ConfigMap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- op: remove
path: /spec/template/spec/storagePolicyName
13 changes: 13 additions & 0 deletions test/e2e/data/infrastructure-vsphere/v1.8/bases/vcpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# VSphereMachineTemplate object with the number of CPUs raised to 4
# for the purposes of mitigating the CPU spikes caused by scaling up
# the control plane (during upgrades and for HA control planes)
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereMachineTemplate
metadata:
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
spec:
template:
spec:
numCPUs: 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cluster-template.yaml
- ../bases/cluster-resource-set.yaml
patchesStrategicMerge:
- ../bases/cluster-resource-set-label.yaml
- ../bases/cluster-network-CIDR.yaml
- ../bases/cluster-resource-set-csi-insecure.yaml
patches:
- target:
kind: VSphereMachineTemplate
path: ../bases/remove-storage-policy.yaml
4 changes: 2 additions & 2 deletions test/e2e/quick_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = Describe("Cluster Creation using Cluster API quick-start test", func() {
})
})

var _ = Describe("ClusterClass Creation using Cluster API quick-start test [PR-Blocking] [ClusterClass]", func() {
var _ = Describe("ClusterClass Creation using Cluster API quick-start test [ClusterClass]", func() {
capi_e2e.QuickStartSpec(ctx, func() capi_e2e.QuickStartSpecInput {
return capi_e2e.QuickStartSpecInput{
E2EConfig: e2eConfig,
Expand All @@ -47,7 +47,7 @@ var _ = Describe("ClusterClass Creation using Cluster API quick-start test [PR-B
})
})

var _ = Describe("Cluster creation with [Ignition] bootstrap [PR-Blocking]", func() {
var _ = Describe("Cluster creation with [Ignition] bootstrap", func() {
capi_e2e.QuickStartSpec(ctx, func() capi_e2e.QuickStartSpecInput {
return capi_e2e.QuickStartSpecInput{
E2EConfig: e2eConfig,
Expand Down

0 comments on commit 4dcf5b7

Please sign in to comment.