Skip to content

Commit

Permalink
Minor e2e fixes (#1043)
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot-Parab <[email protected]>

Signed-off-by: Prajyot-Parab <[email protected]>
  • Loading branch information
Prajyot-Parab authored Jan 25, 2023
1 parent 7609a48 commit e698476
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 15 additions & 3 deletions scripts/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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="${?}"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/config/ibmcloud-e2e-powervs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/config/ibmcloud-e2e-vpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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"]
Expand Down

0 comments on commit e698476

Please sign in to comment.