Skip to content

Commit

Permalink
Merge pull request #2864 from fabriziopandini/how-to-connect-VCenterS…
Browse files Browse the repository at this point in the history
…imulator

📖 Document how to connect to VCenterSimulators
  • Loading branch information
k8s-ci-robot authored Apr 3, 2024
2 parents f90c2e0 + 9a47efd commit 47f8878
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
48 changes: 48 additions & 0 deletions test/infrastructure/vcsim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,54 @@ $ source vcsim.env
$ cat <your template> | envsubst | kubectl apply -f -
```

#### Using govc with vcsim

[govc](https://github.com/vmware/govmomi/tree/main/govc) is a vSphere CLI built on top of govmomi.

The [vcsim.sh](scripts/vcsim.sh) script described above, also sets the `GOVC_URL` and the `GOVC_INSECURE` env vars required to
use govc against the vcsim instance generated by applying the `VCenterSimulator` resource.

It is required to setup connectivity to the pod where this vcsim instance in running first.

From terminal window #1:

```shell
source vcsim.env
kubectl port-forward -n vcsim-system deployments/vcsim-controller-manager ${VSPHERE_SERVER##*:}
```

From terminal window 2:

```shell
source vcsim.env
govc ls
```

#### Accessing the workload cluster

Even if the workload cluster running on vcsim machines is fake, it could be interesting to use kubectl to
query the fake API server.

Also in this case it is required to setup connectivity to the pod where the fake API server in running first;
this connection must be used when using kubectl.

From terminal window #1:

```shell
# from terminal window 1
source vcsim.env
kubectl port-forward -n vcsim-system deployments/vcsim-controller-manager $CONTROL_PLANE_ENDPOINT_PORT
```

From terminal window 2:

```shell
source vcsim.env

clusterctl get kubeconfig -n $NAMESPACE $CLUSTER_NAME > /tmp/kubeconfig
kubectl --kubeconfig=/tmp/kubeconfig --server=https://127.0.0.1:$CONTROL_PLANE_ENDPOINT_PORT get nodes
```

### Cluster provisioning with vcsim

In the previous paragraph we explained the process and the components to setup a test environment with a
Expand Down
16 changes: 9 additions & 7 deletions test/infrastructure/vm-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ As you might notice, it is required to have an additional component taking care
and vCenter as required by the vm-operator. This component exist in different variants according to the use cases
described in following paragraphs.

## Building and pushing the VM-operator manifest

Run `make release-vm-operator` to build build & publish vm-operator manifest and image to the CAPV staging bucket.

Note: we are maintaining a copy of those artefacts to ensure CAPV test isolation and to allow small customizations
that makes it easier to run the vm-operator in the "limited version of the supervisor", but this might change in the future.

## Tilt for CAPV in supervisor mode using vcsim

NOTE: As of today we are not supporting Tilt development of CAPV in supervisor mode when targeting a real vCenter.
Expand All @@ -45,6 +38,8 @@ To use vsphere in supervisor mode it is required to add it to the list of enable
(note that we are also adding `vsphere-supervisor`, which is a variant that deploys the supervisor's CRDs);
in this case, it is also required to add both the `vm-operator` and `vcsim.

NOTE: before using `vm-operator` for the first time, you have to run `make vm-operator-manifest-build` in the CAPV folder.

```yaml
...
provider_repos:
Expand Down Expand Up @@ -100,3 +95,10 @@ A subset of CAPV E2E tests can be executed using the supervisor mode and vcsim a
Note: The code responsible for E2E tests setup will take care of creating the `VCenterSimulator`, the `ControlPlaneEndpoint`
and to grab required variables from the corresponding `EnvVar`. On top of that, the setup code will also
create the required `VMOperatorDependencies` resource for configuring the test namespace.

## Building and pushing the VM-operator manifest

Run `make release-vm-operator` to build & publish vm-operator manifest and image to the CAPV staging bucket.

Note: we are maintaining a copy of those artefacts to ensure CAPV test isolation and to allow small customizations
that makes it easier to run the vm-operator in the "limited version of the supervisor", but this might change in the future.

0 comments on commit 47f8878

Please sign in to comment.