From e69847607d745ff6f988c74a58e19361cacd40ed Mon Sep 17 00:00:00 2001 From: Prajyot Parab Date: Wed, 25 Jan 2023 11:36:12 +0530 Subject: [PATCH] Minor e2e fixes (#1043) Signed-off-by: Prajyot-Parab Signed-off-by: Prajyot-Parab --- Makefile | 8 ++++---- api/v1beta1/ibmvpccluster_types.go | 4 ++-- api/v1beta2/ibmvpccluster_types.go | 4 ++-- ...ucture.cluster.x-k8s.io_ibmvpcclusters.yaml | 8 ++++---- scripts/ci-e2e.sh | 18 +++++++++++++++--- ...=> cluster-template-vpc-load-balancer.yaml} | 0 test/e2e/config/ibmcloud-e2e-powervs.yaml | 4 ++-- test/e2e/config/ibmcloud-e2e-vpc.yaml | 5 +++-- .../kustomization.yaml | 0 .../mhc-powervs.yaml | 0 10 files changed, 32 insertions(+), 19 deletions(-) rename templates/{cluster-template-load-balancer.yaml => cluster-template-vpc-load-balancer.yaml} (100%) rename test/e2e/data/templates/{cluster-template-md-remediation => cluster-template-powervs-md-remediation}/kustomization.yaml (100%) rename test/e2e/data/templates/{cluster-template-md-remediation => cluster-template-powervs-md-remediation}/mhc-powervs.yaml (100%) diff --git a/Makefile b/Makefile index aa408c82b..4aade1749 100644 --- a/Makefile +++ b/Makefile @@ -160,8 +160,8 @@ generate-go-conversions: $(CONVERSION_GEN) ## Generate conversions go code .PHONY: generate-e2e-templates generate-e2e-templates: $(KUSTOMIZE) -ifneq ($(E2E_FLAVOR), vpc) - $(KUSTOMIZE) build $(E2E_TEMPLATES)/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-md-remediation.yaml +ifeq ($(E2E_FLAVOR), powervs-md-remediation) + $(KUSTOMIZE) build $(E2E_TEMPLATES)/cluster-template-powervs-md-remediation --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-powervs-md-remediation.yaml endif .PHONY: generate-modules @@ -172,7 +172,7 @@ generate-modules: ## Runs go mod to ensure modules are up to date images: docker-build set-flavor: -ifeq ($(E2E_FLAVOR), vpc) +ifeq ($(findstring vpc,$(E2E_FLAVOR)),vpc) $(eval E2E_CONF_FILE=$(REPO_ROOT)/test/e2e/config/ibmcloud-e2e-vpc.yaml) else $(eval E2E_CONF_FILE=$(REPO_ROOT)/test/e2e/config/ibmcloud-e2e-powervs.yaml) @@ -203,7 +203,7 @@ test: generate fmt vet setup-envtest $(GOTESTSUM) ## Run tests GINKGO_FOCUS ?= Workload cluster creation GINKGO_NODES ?= 3 GINKGO_NOCOLOR ?= false -E2E_FLAVOR ?= powervs +E2E_FLAVOR ?= powervs-md-remediation JUNIT_FILE ?= junit.e2e_suite.1.xml GINKGO_ARGS ?= -v --trace --tags=e2e --focus=$(GINKGO_FOCUS) --nodes=$(GINKGO_NODES) --no-color=$(GINKGO_NOCOLOR) --output-dir="$(ARTIFACTS)" --junit-report="$(JUNIT_FILE)" ARTIFACTS ?= $(REPO_ROOT)/_artifacts diff --git a/api/v1beta1/ibmvpccluster_types.go b/api/v1beta1/ibmvpccluster_types.go index 74c0cbd95..813b3df7b 100644 --- a/api/v1beta1/ibmvpccluster_types.go +++ b/api/v1beta1/ibmvpccluster_types.go @@ -59,8 +59,8 @@ type IBMVPCClusterSpec struct { // VPCLoadBalancerSpec defines the desired state of an VPC load balancer. type VPCLoadBalancerSpec struct { // Name sets the name of the VPC load balancer. - // +kubebuilder:validation:MaxLength:=64 - // +kubebuilder:validation:Pattern=`^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$` + // +kubebuilder:validation:MaxLength:=63 + // +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$` // +optional Name string `json:"name,omitempty"` } diff --git a/api/v1beta2/ibmvpccluster_types.go b/api/v1beta2/ibmvpccluster_types.go index 8203dbefc..993315002 100644 --- a/api/v1beta2/ibmvpccluster_types.go +++ b/api/v1beta2/ibmvpccluster_types.go @@ -59,8 +59,8 @@ type IBMVPCClusterSpec struct { // VPCLoadBalancerSpec defines the desired state of an VPC load balancer. type VPCLoadBalancerSpec struct { // Name sets the name of the VPC load balancer. - // +kubebuilder:validation:MaxLength:=64 - // +kubebuilder:validation:Pattern=`^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$` + // +kubebuilder:validation:MaxLength:=63 + // +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$` // +optional Name string `json:"name,omitempty"` } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml index 6d2db2805..f962f3002 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml @@ -67,8 +67,8 @@ spec: properties: name: description: Name sets the name of the VPC load balancer. - maxLength: 64 - pattern: ^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$ + maxLength: 63 + pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$ type: string type: object region: @@ -242,8 +242,8 @@ spec: properties: name: description: Name sets the name of the VPC load balancer. - maxLength: 64 - pattern: ^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$ + maxLength: 63 + pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$ type: string type: object region: diff --git a/scripts/ci-e2e.sh b/scripts/ci-e2e.sh index e33c60a10..c1ce48067 100755 --- a/scripts/ci-e2e.sh +++ b/scripts/ci-e2e.sh @@ -125,9 +125,17 @@ prerequisites_vpc(){ export LOGLEVEL=5 } +prerequisites_vpc_load_balancer(){ + # Assigning VPC LoadBalancer variables + export PROVIDER_ID_FORMAT=v2 + export EXP_CLUSTER_RESOURCE_SET=true + export IBMACCOUNT_ID=${IBMACCOUNT_ID:-"7cfbd5381a434af7a09289e795840d4e"} + export BASE64_API_KEY=$(echo -n $IBMCLOUD_API_KEY | base64) +} + main(){ - [ "${E2E_FLAVOR}" = "vpc" ] && RESOURCE_TYPE="vpc-service" + [[ "${E2E_FLAVOR}" == "vpc"* ]] && RESOURCE_TYPE="vpc-service" # If BOSKOS_HOST is set then acquire an IBM Cloud resource from Boskos. if [ -n "${BOSKOS_HOST:-}" ]; then @@ -156,15 +164,19 @@ main(){ HEART_BEAT_PID=$(echo $!) fi - if [[ "${E2E_FLAVOR}" == "powervs" || "${E2E_FLAVOR}" == "md-remediation" ]]; then + if [[ "${E2E_FLAVOR}" == "powervs" || "${E2E_FLAVOR}" == "powervs-md-remediation" ]]; then prerequisites_powervs init_network_powervs fi - if [[ "${E2E_FLAVOR}" == "vpc" ]]; then + if [[ "${E2E_FLAVOR}" == "vpc"* ]]; then prerequisites_vpc fi + if [[ "${E2E_FLAVOR}" == "vpc-load-balancer" ]]; then + prerequisites_vpc_load_balancer + fi + # Run the e2e tests make test-e2e E2E_FLAVOR=${E2E_FLAVOR} test_status="${?}" diff --git a/templates/cluster-template-load-balancer.yaml b/templates/cluster-template-vpc-load-balancer.yaml similarity index 100% rename from templates/cluster-template-load-balancer.yaml rename to templates/cluster-template-vpc-load-balancer.yaml diff --git a/test/e2e/config/ibmcloud-e2e-powervs.yaml b/test/e2e/config/ibmcloud-e2e-powervs.yaml index 4f3ff5874..6a757cb0e 100644 --- a/test/e2e/config/ibmcloud-e2e-powervs.yaml +++ b/test/e2e/config/ibmcloud-e2e-powervs.yaml @@ -38,8 +38,8 @@ providers: files: - sourcePath: "${PWD}/metadata.yaml" targetName: "metadata.yaml" - - sourcePath: "${PWD}/test/e2e/data/templates/cluster-template-md-remediation.yaml" - targetName: "cluster-template-md-remediation.yaml" + - sourcePath: "${PWD}/test/e2e/data/templates/cluster-template-powervs-md-remediation.yaml" + targetName: "cluster-template-powervs-md-remediation.yaml" variables: KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.25.1}" diff --git a/test/e2e/config/ibmcloud-e2e-vpc.yaml b/test/e2e/config/ibmcloud-e2e-vpc.yaml index c859ae85b..8f28d8368 100644 --- a/test/e2e/config/ibmcloud-e2e-vpc.yaml +++ b/test/e2e/config/ibmcloud-e2e-vpc.yaml @@ -38,8 +38,8 @@ providers: files: - sourcePath: "${PWD}/metadata.yaml" targetName: "metadata.yaml" - - sourcePath: "${PWD}/templates/cluster-template.yaml" - targetName: "cluster-template-vpc.yaml" + - sourcePath: "${PWD}/templates/cluster-template-vpc-load-balancer.yaml" + targetName: "cluster-template-vpc-load-balancer.yaml" variables: KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.25.2}" @@ -56,6 +56,7 @@ variables: IBMVPC_IMAGE_NAME: "${IBMVPC_IMAGE_NAME:-}" IBMVPC_PROFILE: "${IBMVPC_PROFILE:-}" IBMVPC_SSHKEY_NAME: "${IBMVPC_SSHKEY_NAME:-}" + IBMACCOUNT_ID: "${IBMACCOUNT_ID:-}" intervals: default/wait-controllers: ["3m", "10s"] diff --git a/test/e2e/data/templates/cluster-template-md-remediation/kustomization.yaml b/test/e2e/data/templates/cluster-template-powervs-md-remediation/kustomization.yaml similarity index 100% rename from test/e2e/data/templates/cluster-template-md-remediation/kustomization.yaml rename to test/e2e/data/templates/cluster-template-powervs-md-remediation/kustomization.yaml diff --git a/test/e2e/data/templates/cluster-template-md-remediation/mhc-powervs.yaml b/test/e2e/data/templates/cluster-template-powervs-md-remediation/mhc-powervs.yaml similarity index 100% rename from test/e2e/data/templates/cluster-template-md-remediation/mhc-powervs.yaml rename to test/e2e/data/templates/cluster-template-powervs-md-remediation/mhc-powervs.yaml