Skip to content

Commit

Permalink
Merge pull request metal3-io#1634 from Nordix/peppi-lotta/release-1.7…
Browse files Browse the repository at this point in the history
…-related-tests

🌱 Release-1.7 related changes
  • Loading branch information
metal3-io-bot authored May 6, 2024
2 parents 27e40a9 + d2ee66a commit 1ba01bd
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 36 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ is defined above.
API version reaches EOL.
- We will maintain test coverage for all supported minor releases and for one
additional release for the current stable API version in case we have to do an
emergency patch release. For example, if v1.5 and v1.4 are currently
supported, we will also maintain test coverage for v1.3 for one additional
release cycle. When v1.6 is released, tests for v1.3 will be removed.
emergency patch release. For example, if v1.7 and v1.6 are currently
supported, we will also maintain test coverage for v1.5 for one additional
release cycle. When v1.7 is released, tests for v1.4 will be removed.

<!-- markdownlint-disable MD013 -->

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,12 @@ delete-examples-clusterclass:
## --------------------------------------
##@ release:

## latest git tag for the commit, e.g., v1.4.0
## latest git tag for the commit, e.g., v1.7.0
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
ifneq (,$(findstring -,$(RELEASE_TAG)))
PRE_RELEASE=true
endif
# the previous release tag, e.g., v1.4.0, excluding pre-release tags
# the previous release tag, e.g., v1.7.0, excluding pre-release tags
PREVIOUS_TAG ?= $(shell git tag -l | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+" | sort -V | grep -B1 $(RELEASE_TAG) | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$$" | head -n 1 2>/dev/null)
RELEASE_DIR := out
RELEASE_NOTES_DIR := releasenotes
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ need to be manually installed. Example flow of installing Metal3 provider:
provider name as follows:

```shell
clusterctl init --infrastructure metal3:v1.6.0
clusterctl init --infrastructure metal3:v1.7.0
```

1. Deploy Baremetal Operator manifests and CRDs. You need to install
Expand Down Expand Up @@ -141,6 +141,13 @@ To trigger e2e test on a PR, use the following phrases:
- **/test-centos-e2e-integration-test-main** runs integration e2e
tests with CAPM3 API version v1beta1 and branch main on CentOS
Release-1.7 branch:
- **/test metal3-ubuntu-e2e-integration-test-release-1-7** runs integration e2e
tests with CAPM3 API version v1beta1 and branch release-1.7 on Ubuntu
- **/test metal3-centos-e2e-integration-test-release-1-7** runs integration e2e
tests with CAPM3 API version v1beta1 and branch release-1.7 on CentOS
Release-1.6 branch:
- **/test metal3-ubuntu-e2e-integration-test-release-1-6** runs integration e2e
Expand All @@ -155,13 +162,6 @@ Release-1.5 branch:
- **/test metal3-centos-e2e-integration-test-release-1-5** runs integration e2e
tests with CAPM3 API version v1beta1 and branch release-1.5 on CentOS
Release-1.4 branch:
- **/test metal3-ubuntu-e2e-integration-test-release-1-4** runs integration e2e
tests with CAPM3 API version v1beta1 and branch release-1.4 on Ubuntu
- **/test metal3-centos-e2e-integration-test-release-1-4** runs integration e2e
tests with CAPM3 API version v1beta1 and branch release-1.4 on CentOS
## Basic tests
Unlike integration tests, basic tests focus on the target cluster creation
Expand All @@ -181,6 +181,13 @@ On main branch:
- **/test metal3-centos-e2e-feature-test-main** runs e2e feature tests with
CAPM3 API version v1beta1 and branch main on CentOS
Release-1.7 branch:
- **/test metal3-ubuntu-e2e-feature-test-release-1-7** runs e2e feature tests with
CAPM3 API version v1beta1 and branch release-1.7 on Ubuntu
- **/test metal3-centos-e2e-feature-test-release-1-7** runs e2e feature tests with
CAPM3 API version v1beta1 and branch release-1.7 on CentOS
Release-1.6 branch:
- **/test metal3-ubuntu-e2e-feature-test-release-1-6** runs e2e feature tests with
Expand All @@ -195,13 +202,6 @@ Release-1.5 branch:
- **/test metal3-centos-e2e-feature-test-1-5** runs e2e feature tests with CAPM3
API version v1beta1 and branch release-1.5 on CentOS
Release-1.4 branch:
- **/test metal3-ubuntu-e2e-feature-test-release-1-4** runs e2e feature tests
with CAPM3 API version v1beta1 and branch release-1.4 on Ubuntu
- **/test metal3-centos-e2e-feature-test-release-1-4** runs e2e feature tests
with CAPM3 API version v1beta1 and branch release-1.4 on CentOS
### Upgrade tests
#### Clusterctl upgrade tests
Expand All @@ -212,15 +212,15 @@ We run upgrade test on main branch from different releases:
- **/test metal3-e2e-clusterctl-upgrade-test-main** runs e2e clusterctl
upgrade tests on main with Ubuntu
- **/test metal3-e2e-clusterctl-upgrade-test-release-1-4** runs e2e clusterctl
upgrade tests on release-1.4 with Ubuntu
- **/test metal3-e2e-clusterctl-upgrade-test-release-1-5** runs e2e clusterctl
upgrade tests on release-1.5 with Ubuntu
- **/test metal3-e2e-clusterctl-upgrade-test-release-1-6** runs e2e clusterctl
upgrade tests on release-1.6 with Ubuntu
- **/test metal3-e2e-clusterctl-upgrade-test-release-1-7** runs e2e clusterctl
upgrade tests on release-1.7 with Ubuntu
#### K8s upgrade tests
CAPM3 tests upgrading kubernetes between last 3 releases.
Expand Down
1 change: 1 addition & 0 deletions docs/e2e-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ in the ephemeral cluster either before pivoting or after re-pivoting.

| tests | CAPM3 from | CAPM3 to | CAPI from | CAPI to |
| --------------| ----------- | --------- | ---------- |---------------- |
| v1.7=>current | v1.7.0 | main | v1.7.1 | latest release |
| v1.6=>current | v1.6.1 | main | v1.6.3 | latest release |
| v1.5=>current | v1.5.3 | main | v1.5.7 | latest release |

Expand Down
2 changes: 1 addition & 1 deletion hack/verify-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ _module_get_latest_patch_release()
{
# get latest patch release from given version
# module needs to contain full module url
# version is minor release prefix, like v1.4.
# version is minor release prefix, like v1.7.
local repo="$1"
local version="$2"

Expand Down
15 changes: 3 additions & 12 deletions scripts/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@ FORCE_REPO_UPDATE="${FORCE_REPO_UPDATE:-false}"

export CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH:-main}"

# Starting from CAPI v1.5.0 version cluster-api config folder location has changed
# to XDG_CONFIG_HOME folder. Following code defines the cluster-api config folder
# location according to CAPM3(since CAPM3 minor versions are aligned to CAPI
# minors versions) release branch

if [[ ${CAPM3RELEASEBRANCH} == "release-1.4" ]]; then
export CAPI_CONFIG_FOLDER="${HOME}/.cluster-api"
else
# Default CAPI_CONFIG_FOLDER to $HOME/.config folder if XDG_CONFIG_HOME not set
CONFIG_FOLDER="${XDG_CONFIG_HOME:-$HOME/.config}"
export CAPI_CONFIG_FOLDER="${CONFIG_FOLDER}/cluster-api"
fi
# Default CAPI_CONFIG_FOLDER to $HOME/.config folder if XDG_CONFIG_HOME not set
CONFIG_FOLDER="${XDG_CONFIG_HOME:-$HOME/.config}"
export CAPI_CONFIG_FOLDER="${CONFIG_FOLDER}/cluster-api"

# shellcheck source=./scripts/environment.sh
source "${REPO_ROOT}/scripts/environment.sh"
Expand Down
39 changes: 39 additions & 0 deletions test/e2e/config/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ providers:
- name: cluster-api
type: CoreProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
type: "url"
contract: v1beta1
replacements:
- old: --metrics-addr=127.0.0.1:8080
new: --metrics-addr=:8080
files:
- sourcePath: "../data/shared/v1.7/metadata.yaml"
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
type: "url"
Expand All @@ -38,6 +47,15 @@ providers:
- name: kubeadm
type: BootstrapProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
type: "url"
contract: v1beta1
replacements:
- old: --metrics-addr=127.0.0.1:8080
new: --metrics-addr=:8080
files:
- sourcePath: "../data/shared/v1.7/metadata.yaml"
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
type: "url"
Expand All @@ -59,6 +77,16 @@ providers:
- name: kubeadm
type: ControlPlaneProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
type: "url"
contract: v1beta1
replacements:
- old: --metrics-addr=127.0.0.1:8080
new: --metrics-addr=:8080
files:
- sourcePath: "../data/shared/v1.7/metadata.yaml"
versions:
- name: "{go://sigs.k8s.io/[email protected]}"
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
type: "url"
Expand All @@ -84,6 +112,17 @@ providers:
- name: metal3
type: InfrastructureProvider
versions:
- name: "{go://github.com/metal3-io/[email protected]}"
value: "https://github.com/metal3-io/cluster-api-provider-metal3/releases/download/{go://github.com/metal3-io/[email protected]}/infrastructure-components.yaml"
type: "url"
contract: v1beta1
files:
- sourcePath: "../data/infrastructure-metal3/v1.7/metadata.yaml"
targetName: "metadata.yaml"
- sourcePath: "../_out/cluster-template-ubuntu.yaml"
targetName: "cluster-template-ubuntu.yaml"
- sourcePath: "../_out/cluster-template-upgrade-workload.yaml"
targetName: "cluster-template-upgrade-workload.yaml"
- name: "{go://github.com/metal3-io/[email protected]}"
value: "https://github.com/metal3-io/cluster-api-provider-metal3/releases/download/{go://github.com/metal3-io/[email protected]}/infrastructure-components.yaml"
type: "url"
Expand Down
67 changes: 67 additions & 0 deletions test/e2e/upgrade_clusterctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,73 @@ var (
providerMetal3Prefix = "metal3:v%s"
)

var _ = Describe("When testing cluster upgrade from releases (v1.7=>current) [clusterctl-upgrade]", func() {
BeforeEach(func() {
osType := strings.ToLower(os.Getenv("OS"))
Expect(osType).ToNot(Equal(""))
validateGlobals(specName)
imageURL, imageChecksum := EnsureImage("v1.30.0")
os.Setenv("IMAGE_RAW_CHECKSUM", imageChecksum)
os.Setenv("IMAGE_RAW_URL", imageURL)
// We need to override clusterctl apply log folder to avoid getting our credentials exposed.
clusterctlLogFolder = filepath.Join(os.TempDir(), "clusters", bootstrapClusterProxy.GetName())
})

minorVersion := "1.7"
capiStableRelease, err := capi_e2e.GetStableReleaseOfMinor(ctx, minorVersion)
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for CAPI minor release : %s", minorVersion)
capm3StableRelease, err := GetCAPM3StableReleaseOfMinor(ctx, minorVersion)
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for CAPM3 minor release : %s", minorVersion)

capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
InitWithCoreProvider: fmt.Sprintf(providerCAPIPrefix, capiStableRelease),
InitWithBootstrapProviders: []string{fmt.Sprintf(providerKubeadmPrefix, capiStableRelease)},
InitWithControlPlaneProviders: []string{fmt.Sprintf(providerKubeadmPrefix, capiStableRelease)},
InitWithInfrastructureProviders: []string{fmt.Sprintf(providerMetal3Prefix, capm3StableRelease)},
InitWithKubernetesVersion: "v1.30.0",
WorkloadKubernetesVersion: "v1.30.0",
InitWithBinary: fmt.Sprintf(clusterctlDownloadURL, capiStableRelease),
PreInit: func(clusterProxy framework.ClusterProxy) {
preInitFunc(clusterProxy)
// Override capi/capm3 versions exported in preInit
os.Setenv("CAPI_VERSION", "v1beta1")
os.Setenv("CAPM3_VERSION", "v1beta1")
os.Setenv("KUBECONFIG_BOOTSTRAP", bootstrapClusterProxy.GetKubeconfigPath())
},
PostNamespaceCreated: postNamespaceCreated,
PreUpgrade: preUpgrade,
PreCleanupManagementCluster: preCleanupManagementCluster,
MgmtFlavor: osType,
WorkloadFlavor: osType,
}
})
AfterEach(func() {
// Recreate bmh that was used in capi namespace in metal3
//#nosec G204 -- We need to pass in the file name here.
cmd := exec.Command("bash", "-c", "kubectl apply -f bmhosts_crs.yaml -n metal3")
cmd.Dir = workDir
output, err := cmd.CombinedOutput()
Logf("Applying bmh to metal3 namespace : \n %v", string(output))
Expect(err).ToNot(HaveOccurred())
// wait for all bmh to become available
bootstrapClient := bootstrapClusterProxy.GetClient()
ListBareMetalHosts(ctx, bootstrapClient, client.InNamespace(namespace))
WaitForNumBmhInState(ctx, bmov1alpha1.StateAvailable, WaitForNumInput{
Client: bootstrapClient,
Options: []client.ListOption{client.InNamespace(namespace)},
Replicas: 5,
Intervals: e2eConfig.GetIntervals(specName, "wait-bmh-available"),
})
ListBareMetalHosts(ctx, bootstrapClient, client.InNamespace(namespace))
})
})

var _ = Describe("When testing cluster upgrade from releases (v1.6=>current) [clusterctl-upgrade]", func() {
BeforeEach(func() {
osType := strings.ToLower(os.Getenv("OS"))
Expand Down

0 comments on commit 1ba01bd

Please sign in to comment.