Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Furkat Gofurov <[email protected]>
  • Loading branch information
furkatgofurov7 committed Jan 8, 2024
1 parent 261112d commit 14fc325
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ SKIP_RESOURCE_CLEANUP ?= false
USE_EXISTING_CLUSTER ?= false
ISOLATED_MODE ?= false
GINKGO_NOCOLOR ?= false
GINKGO_LABEL_FILTER ?= short || full || local
GINKGO_LABEL_FILTER ?= short || full
GINKGO_TESTS ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/suites/...

# to set multiple ginkgo skip flags, if any
Expand Down
26 changes: 23 additions & 3 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,29 @@ This will consequently:
#### Prerequisites

1. Initiate a VPN connection using a client such as OpenVPN or Cisco AnyConnect Secure Mobility Client.
1. Set up all the necessary environment variables. You can start with the [`.envrc.example`](../../.envrc.example) file.
Use [direnv](https://direnv.net/) to load these variables into your shell. Rename the file and modify the values as required.
You can obtain these values from a team common credentials shared location.
1. Set up all the necessary environment variables. You can start with the [`.envrc.example`](../../.envrc.example) file and
use [direnv](https://direnv.net/) to load these variables into your shell. Rename the file and modify the values as required.
You can obtain these values from a team common credentials shared location. Also, they can be fetched by accessing the vcenter
URL and following the steps described on the table below:

| Name | Details | How to get
| -------------------------- | ----------------------------------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| VSPHERE_TLS_THUMBPRINT | sha1 thumbprint of the vcenter certificate: openssl x509 -sha1 -fingerprint -in ca.crt -noout | browse to vcenter URL and check sha-1 fingerprint in the SSL certificate |
| VSPHERE_SERVER | The vCenter server IP or FQDN | once logged in vSphere Client, click on second icon from left to right on top left and select vcenter name (top level name in the folders tree) |
| VSPHERE_DATACENTER | The vSphere datacenter to deploy the management cluster on | `vcenter` name => select `Datacenters` |
| VSPHERE_DATASTORE | The vSphere datastore to deploy the management cluster on | `vcenter` name => `Datacenter` name => select `Datastores` |
| VSPHERE_FOLDER | The VM folder for your VMs. Set to "" to use the root vSphere folder | `vcenter` name => `Datacenter` name => `VMs` => select `VM folders` |
| VSPHERE_TEMPLATE | The VM template to use for your management cluster | `vcenter` name => `Datacenter` name => `VMs` => select `VM Templates` |
| VSPHERE_NETWORK | The VM network to deploy the management cluster on | `vcenter` name => `Datacenter` name => `Networks` => select `Networks` |
| VSPHERE_PASSWORD | The password used to access the remote vSphere endpoint | reach out to team lead |
| VSPHERE_USERNAME | The username used to access the remote vSphere endpoint | reach out to team lead |
| VSPHERE_SSH_AUTHORIZED_KEY | The public ssh authorized key on all machines in this cluster | can be left empty |
| CONTROL_PLANE_ENDPOINT_IP | The IP that kube-vip is going to use as a control plane endpoint | `vcenter` name => `Datacenter` name => `Hosts & Clusters` => `Hosts` => select `host IP` and right click => `Settings` => `Networking` => `Virtual Switches` => click on three dots of `host IP` => `View Settings` => `IPv4 settings` => `Subnet mask`. i.e host IP is 10.10.10.20 and subnet mask is 255.255.255.0, the last IP address of the subnet which is 10.10.10.255 can be used |
| EXP_CLUSTER_RESOURCE_SET | This enables the ClusterResourceSet feature that we are using to deploy CSI | default: true |
| GOVC_URL | The URL of ESXi or vCenter instance to connect to | in the form of `https://<VSPHERE_SERVER>` |
| GOVC_USERNAME | The username to use if not specified in `GOVC_URL` | equivalent of `VSPHERE_USERNAME` |
| GOVC_PASSWORD | The password to use if not specified in `GOVC_URL` | equivalent of `VSPHERE_PASSWORD` |
| GOVC_INSECURE | Disable certificate verification | default: true |

#### Running the tests

Expand Down
8 changes: 4 additions & 4 deletions test/e2e/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const (

AuthSecretName = "basic-auth-secret"

ShortTestLabel = "short"
FullTestLabel = "full"
DontRunLabel = "dontrun"
LocalvSphereTestLabel = "local"
ShortTestLabel = "short"
FullTestLabel = "full"
DontRunLabel = "dontrun"
LocalTestLabel = "local"
)
19 changes: 10 additions & 9 deletions test/e2e/data/capi-operator/capv-provider.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: capv-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
kind: InfrastructureProvider
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: vsphere
namespace: capv-system
spec:
name: vsphere
type: infrastructure
version: v1.8.5
secretName: vsphere-variables
secretNamespace: default
configSecret:
name: vsphere-variables
variables:
CLUSTER_TOPOLOGY: "true"
EXP_CLUSTER_RESOURCE_SET: "true"
EXP_MACHINE_POOL: "true"
12 changes: 8 additions & 4 deletions test/e2e/data/capi-operator/capv-variables.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: capv-system
---
apiVersion: v1
kind: Secret
metadata:
name: vsphere-variables
namespace: default
namespace: vsphere-system
type: Opaque
stringData:
VSPHERE_USERNAME: "${VSPHERE_USERNAME}"
VSPHERE_PASSWORD: "${VSPHERE_PASSWORD}"
CLUSTER_TOPOLOGY: "true"
EXP_CLUSTER_RESOURCE_SET: "true"
VSPHERE_PASSWORD: "${VSPHERE_PASSWORD}"
2 changes: 1 addition & 1 deletion test/e2e/suites/import-gitops/import_gitops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var _ = Describe("[Azure] [AKS] Create and delete CAPI cluster functionality sho
})
})

var _ = Describe("[vSphere] [Kubeadm] Create and delete CAPI cluster functionality should work with namespace auto-import", Label(e2e.LocalvSphereTestLabel), func() {
var _ = Describe("[vSphere] [Kubeadm] Create and delete CAPI cluster functionality should work with namespace auto-import", Label(e2e.LocalTestLabel), func() {

BeforeEach(func() {
SetClient(setupClusterResult.BootstrapClusterProxy.GetClient())
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/suites/import-gitops/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ var _ = BeforeSuite(func() {
WaitDeploymentsReadyInterval: e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers"),
})

if !shortTestOnly() && !localvSphereTestOnly() {
if !shortTestOnly() && !localTestOnly() {
By("Running full tests, deploying additional infrastructure providers")
awsCreds := e2eConfig.GetVariable(e2e.CapaEncodedCredentialsVar)
Expect(awsCreds).ToNot(BeEmpty(), "AWS creds required for full test")
Expand All @@ -183,7 +183,7 @@ var _ = BeforeSuite(func() {
},
},
})
} else if Label(e2e.LocalvSphereTestLabel).MatchesLabelFilter(GinkgoLabelFilter()) {
} else if Label(e2e.LocalTestLabel).MatchesLabelFilter(GinkgoLabelFilter()) {
By("Running local vSphere tests, deploying vSphere infrastructure provider")

testenv.CAPIOperatorDeployProvider(ctx, testenv.CAPIOperatorDeployProviderInput{
Expand Down Expand Up @@ -234,6 +234,6 @@ func shortTestOnly() bool {
return GinkgoLabelFilter() == e2e.ShortTestLabel
}

func localvSphereTestOnly() bool {
return GinkgoLabelFilter() == e2e.LocalvSphereTestLabel
func localTestOnly() bool {
return GinkgoLabelFilter() == e2e.LocalTestLabel
}

0 comments on commit 14fc325

Please sign in to comment.