Skip to content

WIP: run gke e2e on pr ci #1445

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ test: $(SETUP_ENVTEST) ## Run unit and integration tests
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test ./... $(TEST_ARGS)

# Allow overriding the e2e configurations
GINKGO_FOCUS ?= Workload cluster creation
GINKGO_FOCUS ?= Workload cluster creation|GKE workload cluster creation
GINKGO_SKIP ?= API Version Upgrade
GINKGO_NODES ?= 1
GINKGO_NOCOLOR ?= false
Expand Down
1 change: 1 addition & 0 deletions test/e2e/config/gcp-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ providers:
variables:
KUBERNETES_VERSION: "v1.32.5"
KUBERNETES_VERSION_MANAGEMENT: "v1.32.5"
KUBERNETES_VERSION_GKE: "v1.32.4"
ETCD_VERSION_UPGRADE_TO: "3.5.16-0"
COREDNS_VERSION_UPGRADE_TO: "v1.11.3"
KUBERNETES_IMAGE_UPGRADE_FROM: "projects/k8s-staging-cluster-api-gcp/global/images/cluster-api-ubuntu-2204-v1-32-5-nightly"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ metadata:
spec:
project: "${GCP_PROJECT}"
location: "${GCP_REGION}"
version: "${KUBERNETES_VERSION}"
version: "${KUBERNETES_VERSION_GKE}"
releaseChannel: "regular"
---
apiVersion: cluster.x-k8s.io/v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
extraArgs:
cloud-provider: external
allocate-node-cidrs: "false"
kubernetesVersion: "${KUBERNETES_VERSION}"
kubernetesVersion: "${KUBERNETES_VERSION_GKE}"
files:
- content: |
[Global]
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/e2e_gke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ = Describe("GKE workload cluster creation", func() {
namespace *corev1.Namespace
cancelWatches context.CancelFunc
result *ApplyManagedClusterTemplateAndWaitResult
clusterName string
clusterNamePrefix string
clusterctlLogFolder string
)

Expand All @@ -57,7 +57,7 @@ var _ = Describe("GKE workload cluster creation", func() {

Expect(e2eConfig.Variables).To(HaveKey(KubernetesVersion))

clusterName = fmt.Sprintf("capg-e2e-%s", util.RandomString(6))
clusterNamePrefix = fmt.Sprintf("capg-e2e-gke-%s", util.RandomString(6))

// Setup a Namespace where to host objects for this spec and create a watcher for the namespace events.
namespace, cancelWatches = setupSpecNamespace(ctx, specName, bootstrapClusterProxy, artifactFolder)
Expand Down Expand Up @@ -86,6 +86,7 @@ var _ = Describe("GKE workload cluster creation", func() {

Context("Creating a GKE cluster without autopilot", func() {
It("Should create a cluster with 1 machine pool and scale", func() {
clusterName := fmt.Sprintf("%s-single", clusterNamePrefix)
By("Initializes with 1 machine pool")

minPoolSize, ok := e2eConfig.Variables["GKE_MACHINE_POOL_MIN"]
Expand All @@ -103,7 +104,7 @@ var _ = Describe("GKE workload cluster creation", func() {
Flavor: "ci-gke",
Namespace: namespace.Name,
ClusterName: clusterName,
KubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersion),
KubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersionGKE),
ControlPlaneMachineCount: ptr.To[int64](1),
WorkerMachineCount: ptr.To[int64](3),
ClusterctlVariables: map[string]string{
Expand Down Expand Up @@ -138,6 +139,7 @@ var _ = Describe("GKE workload cluster creation", func() {

Context("Creating a GKE cluster with autopilot", func() {
It("Should create a cluster with 1 machine pool and scale", func() {
clusterName := fmt.Sprintf("%s-autopilot", clusterNamePrefix)
By("Initializes with 1 machine pool")

ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{
Expand All @@ -163,6 +165,7 @@ var _ = Describe("GKE workload cluster creation", func() {

Context("Creating a GKE cluster with custom subnet", func() {
It("Should create a cluster with 3 machine pool and custom subnet", func() {
clusterName := fmt.Sprintf("%s-custom-subnet", clusterNamePrefix)
By("Initializes with 3 machine pool")

ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{
Expand Down
1 change: 1 addition & 0 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
const (
KubernetesVersion = "KUBERNETES_VERSION"
KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT"
KubernetesVersionGKE = "KUBERNETES_VERSION_GKE"

CNIPath = "CNI"
CNIResources = "CNI_RESOURCES"
Expand Down