Skip to content

Commit ffb41d5

Browse files
authored
Merge pull request #5395 from randomvariable/e2e-upgrade-doc
🌱 Clusterctl Upgrade Spec: Add details on how to use it
2 parents 18ecf48 + ae6aef3 commit ffb41d5

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

test/e2e/clusterctl_upgrade.go

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ const (
5353

5454
// ClusterctlUpgradeSpecInput is the input for ClusterctlUpgradeSpec.
5555
type ClusterctlUpgradeSpecInput struct {
56-
E2EConfig *clusterctl.E2EConfig
57-
ClusterctlConfigPath string
58-
BootstrapClusterProxy framework.ClusterProxy
59-
ArtifactFolder string
60-
InitWithBinary string
56+
E2EConfig *clusterctl.E2EConfig
57+
ClusterctlConfigPath string
58+
BootstrapClusterProxy framework.ClusterProxy
59+
ArtifactFolder string
60+
// InitWithBinary can be used to override the INIT_WITH_BINARY e2e config variable with the URL of the clusterctl binary of the old version of Cluster API. The spec will interpolate the
61+
// strings `{OS}` and `{ARCH}` to `runtime.GOOS` and `runtime.GOARCH` respectively, e.g. https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.3.23/clusterctl-{OS}-{ARCH}
62+
InitWithBinary string
63+
// InitWithProvidersContract can be used to override the INIT_WITH_PROVIDERS_CONTRACT e2e config variable with a specific
64+
// provider contract to use to initialise the secondary management cluster, e.g. `v1alpha3`
6165
InitWithProvidersContract string
6266
SkipCleanup bool
6367
PreUpgrade func(managementClusterProxy framework.ClusterProxy)
@@ -69,6 +73,32 @@ type ClusterctlUpgradeSpecInput struct {
6973
// ClusterctlUpgradeSpec implements a test that verifies clusterctl upgrade of a management cluster.
7074
//
7175
// NOTE: this test is designed to test older versions of Cluster API --> v1beta1 upgrades.
76+
// This spec will create a workload cluster, which will be converted into a new management cluster (henceforth called secondary
77+
// managemnet cluster)
78+
// with the older version of Cluster API and infrastructure provider. It will then create an additional
79+
// workload cluster (henceforth called secondary workload cluster) from the new management cluster using the default cluster template of the old release
80+
// then run clusterctl upgrade to the latest version of Cluster API and ensure correct operation by
81+
// scaling a MachineDeployment.
82+
//
83+
// To use this spec the variables INIT_WITH_BINARY and INIT_WITH_PROVIDERS_CONTRACT must be set or specified directly
84+
// in the spec input. See ClusterctlUpgradeSpecInput for further information.
85+
//
86+
// In order to get this to work, infrastructure providers need to implement a mechanism to stage
87+
// the locally compiled OCI image of their infrastructure provider and have it downloaded and available
88+
// on the secondary management cluster. It is recommended that infrastructure providers use `docker save` and output
89+
// the local image to a tar file, upload it to object storage, and then use preKubeadmCommands to pre-load the image
90+
// before Kubernetes starts.
91+
//
92+
// For example, for Cluster API Provider AWS, the docker image is stored in an s3 bucket with a unique name for the
93+
// account-region pair, so as to not clash with any other AWS user / account, with the object key being the sha256sum of the
94+
// image digest.
95+
//
96+
// The following commands are then added to preKubeadmCommands:
97+
//
98+
// preKubeadmCommands:
99+
// - mkdir -p /opt/cluster-api
100+
// - aws s3 cp "s3://${S3_BUCKET}/${E2E_IMAGE_SHA}" /opt/cluster-api/image.tar
101+
// - ctr -n k8s.io images import /opt/cluster-api/image.tar # The image must be imported into the k8s.io namespace
72102
func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpgradeSpecInput) {
73103
var (
74104
specName = "clusterctl-upgrade"

0 commit comments

Comments
 (0)