Skip to content

build: Use latest k8s for dev and test management cluster #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions make/examples.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

export KUBERNETES_VERSION := v1.27.5

.PHONY: examples.sync
examples.sync: ## Syncs the examples by fetching upstream examples and applying kustomize patches
hack/examples/sync.sh
4 changes: 3 additions & 1 deletion make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ E2E_PARALLEL_NODES ?= $(shell nproc --ignore=1)
E2E_FLAKE_ATTEMPTS ?= 1
E2E_CONF_FILE ?= $(REPO_ROOT)/test/e2e/config/caren.yaml
E2E_CONF_FILE_ENVSUBST ?= $(basename $(E2E_CONF_FILE))-envsubst.yaml
export E2E_DEFAULT_KUBERNETES_VERSION ?= v1.28.7
ARTIFACTS ?= ${REPO_ROOT}/_artifacts

.PHONY: e2e-test
Expand Down Expand Up @@ -115,7 +116,8 @@ endif
test/e2e/... -- \
-e2e.artifacts-folder="$(ARTIFACTS)" \
-e2e.config="$(E2E_CONF_FILE_ENVSUBST)" \
$(if $(filter $(E2E_SKIP_CLEANUP),true),-e2e.skip-resource-cleanup)
$(if $(filter $(E2E_SKIP_CLEANUP),true),-e2e.skip-resource-cleanup) \
-e2e.bootstrap-kind-version="$(KINDEST_IMAGE_TAG)"
go tool cover \
-html=coverage-e2e.out \
-o coverage-e2e.html
Expand Down
10 changes: 5 additions & 5 deletions make/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ KIND_CLUSTER_NAME ?= $(GITHUB_REPOSITORY)-dev
KIND_KUBECONFIG ?= $(KIND_DIR)/$(KIND_CLUSTER_NAME)/kubeconfig

KINDEST_NODE_IMAGE ?= ghcr.io/mesosphere/kind-node
KINDEST_NODE_VERSION_v1.26 ?= v1.26.14
KINDEST_NODE_VERSION_v1.27 ?= v1.27.11
KINDEST_NODE_VERSION_v1.28 ?= v1.28.7
KINDEST_NODE_VERSION_v1.29 ?= v1.29.2
KINDEST_NODE_VERSION_v1.27 ?= v1.27.13
KINDEST_NODE_VERSION_v1.28 ?= v1.28.9
KINDEST_NODE_VERSION_v1.29 ?= v1.29.4
# Allow easy override of Kubernetes version to use via `make KIND_KUBERNETES_VERSION=v1.23` to use in CI
KIND_KUBERNETES_VERSION ?= v1.29
ifndef KINDEST_NODE_VERSION_$(KIND_KUBERNETES_VERSION)
$(error Unsupported Kind Kubernetes version: $(KIND_KUBERNETES_VERSION) (use on of: [$(patsubst KINDEST_NODE_VERSION_%,%,$(filter KINDEST_NODE_VERSION_%,$(.VARIABLES)))]))
endif

KINDEST_IMAGE = $(KINDEST_NODE_IMAGE):$(KINDEST_NODE_VERSION_$(KIND_KUBERNETES_VERSION))
export KINDEST_IMAGE_TAG ?= $(KINDEST_NODE_VERSION_$(KIND_KUBERNETES_VERSION))
KINDEST_IMAGE = $(KINDEST_NODE_IMAGE):$(KINDEST_IMAGE_TAG)

.PHONY: kind.recreate
kind.recreate: ## Re-creates new KinD cluster if necessary
Expand Down
9 changes: 7 additions & 2 deletions test/e2e/config/caren.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,13 @@ variables:
# allowing the same e2e config file to be re-used in different Prow jobs e.g. each one with a K8s version permutation.
# The following Kubernetes versions should be the latest versions with already published kindest/node images.
# This avoids building node images in the default case which improves the test duration significantly.
KUBERNETES_VERSION_MANAGEMENT: "v1.29.2"
KUBERNETES_VERSION: "v1.28.7"
KUBERNETES_VERSION_MANAGEMENT: "${KINDEST_IMAGE_TAG}"
# The default Kubernetes version for the test workload clusters for all providers, unless overridden below.
KUBERNETES_VERSION: "${E2E_DEFAULT_KUBERNETES_VERSION}"
# Override Kubernetes version for test workload clusters for specific providers by setting the env variables
# `KUBERNETES_VERSION_<PROVIDER>`, where `<PROVIDER>` is the uppercase provider name, e.g.
# `KUBERNETES_VERSION_DOCKER: v1.29.4`.
KUBERNETES_VERSION_DOCKER: "${KINDEST_IMAGE_TAG}"
SERVICE_CIDR: "10.128.0.0/12"
POD_CIDR: "192.168.0.0/16"
NODE_DRAIN_TIMEOUT: "60s"
Expand Down
18 changes: 12 additions & 6 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func init() { //nolint:gochecknoinits // Idiomatically used to set up flags.
flag.StringVar(
&bootstrapKubernetesVersion,
"e2e.bootstrap-kind-version",
"v1.29.2",
"v1.29.4",
"the version of the image used in bootstrap cluster",
)
}
Expand Down Expand Up @@ -258,11 +258,17 @@ func initBootstrapCluster(
clusterctl.InitManagementClusterAndWatchControllerLogs(
context.TODO(),
clusterctl.InitManagementClusterAndWatchControllerLogsInput{
ClusterProxy: bootstrapClusterProxy,
ClusterctlConfigPath: clusterctlConfig,
InfrastructureProviders: config.GetProviderLatestVersionsByContract("*", config.InfrastructureProviders()...),
AddonProviders: config.GetProviderLatestVersionsByContract("*", config.AddonProviders()...),
RuntimeExtensionProviders: config.GetProviderLatestVersionsByContract("*", config.RuntimeExtensionProviders()...),
ClusterProxy: bootstrapClusterProxy,
ClusterctlConfigPath: clusterctlConfig,
InfrastructureProviders: config.GetProviderLatestVersionsByContract(
"*",
config.InfrastructureProviders()...),
AddonProviders: config.GetProviderLatestVersionsByContract(
"*",
config.AddonProviders()...),
RuntimeExtensionProviders: config.GetProviderLatestVersionsByContract(
"*",
config.RuntimeExtensionProviders()...),
LogFolder: filepath.Join(
artifactFolder,
"clusters",
Expand Down
30 changes: 23 additions & 7 deletions test/e2e/quick_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,24 @@ var _ = Describe("Quick start", Serial, func() {
))
}

// Check if a provider-specific Kubernetes version is set in the environment and use that. This allows
// for testing against different Kubernetes versions, as some providers (e.g. Docker) have machine images
// available that are not available in other providers.
// This version can be specified in `test/e2e/config/caren.yaml` with a variable named
// `KUBERNETES_VERSION_<PROVIDER>`, where `<PROVIDER>` is the uppercase provider name, e.g.
// `KUBERNETES_VERSION_DOCKER: v1.29.4`.
testE2EConfig := e2eConfig.DeepCopy()
varName := capie2e.KubernetesVersion + "_" + strings.ToUpper(
lowercaseProvider,
)
if testE2EConfig.HasVariable(varName) {
testE2EConfig.Variables[capie2e.KubernetesVersion] = testE2EConfig.GetVariable(
varName,
)
}

return capie2e.QuickStartSpecInput{
E2EConfig: e2eConfig,
E2EConfig: testE2EConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
Expand Down Expand Up @@ -92,11 +108,11 @@ var _ = Describe("Quick start", Serial, func() {
ctx,
framework.WaitForNodesReadyInput{
Lister: workloadClient,
KubernetesVersion: e2eConfig.GetVariable(
KubernetesVersion: testE2EConfig.GetVariable(
capie2e.KubernetesVersion,
),
Count: 2,
WaitForNodesReady: e2eConfig.GetIntervals(
WaitForNodesReady: testE2EConfig.GetIntervals(
flavour,
"wait-nodes-ready",
),
Expand Down Expand Up @@ -131,19 +147,19 @@ var _ = Describe("Quick start", Serial, func() {
AddonsConfig: addonsConfig,
ClusterProxy: proxy,
WorkloadCluster: workloadCluster,
DeploymentIntervals: e2eConfig.GetIntervals(
DeploymentIntervals: testE2EConfig.GetIntervals(
flavour,
"wait-deployment",
),
DaemonSetIntervals: e2eConfig.GetIntervals(
DaemonSetIntervals: testE2EConfig.GetIntervals(
flavour,
"wait-daemonset",
),
HelmReleaseIntervals: e2eConfig.GetIntervals(
HelmReleaseIntervals: testE2EConfig.GetIntervals(
flavour,
"wait-helmrelease",
),
ClusterResourceSetIntervals: e2eConfig.GetIntervals(
ClusterResourceSetIntervals: testE2EConfig.GetIntervals(
flavour,
"wait-clusterresourceset",
),
Expand Down
Loading