Skip to content

Commit 47f8878

Browse files
authored
Merge pull request #2864 from fabriziopandini/how-to-connect-VCenterSimulator
📖 Document how to connect to VCenterSimulators
2 parents f90c2e0 + 9a47efd commit 47f8878

File tree

2 files changed

+57
-7
lines changed

2 files changed

+57
-7
lines changed

test/infrastructure/vcsim/README.md

+48
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,54 @@ $ source vcsim.env
7272
$ cat <your template> | envsubst | kubectl apply -f -
7373
```
7474

75+
#### Using govc with vcsim
76+
77+
[govc](https://github.com/vmware/govmomi/tree/main/govc) is a vSphere CLI built on top of govmomi.
78+
79+
The [vcsim.sh](scripts/vcsim.sh) script described above, also sets the `GOVC_URL` and the `GOVC_INSECURE` env vars required to
80+
use govc against the vcsim instance generated by applying the `VCenterSimulator` resource.
81+
82+
It is required to setup connectivity to the pod where this vcsim instance in running first.
83+
84+
From terminal window #1:
85+
86+
```shell
87+
source vcsim.env
88+
kubectl port-forward -n vcsim-system deployments/vcsim-controller-manager ${VSPHERE_SERVER##*:}
89+
```
90+
91+
From terminal window 2:
92+
93+
```shell
94+
source vcsim.env
95+
govc ls
96+
```
97+
98+
#### Accessing the workload cluster
99+
100+
Even if the workload cluster running on vcsim machines is fake, it could be interesting to use kubectl to
101+
query the fake API server.
102+
103+
Also in this case it is required to setup connectivity to the pod where the fake API server in running first;
104+
this connection must be used when using kubectl.
105+
106+
From terminal window #1:
107+
108+
```shell
109+
# from terminal window 1
110+
source vcsim.env
111+
kubectl port-forward -n vcsim-system deployments/vcsim-controller-manager $CONTROL_PLANE_ENDPOINT_PORT
112+
```
113+
114+
From terminal window 2:
115+
116+
```shell
117+
source vcsim.env
118+
119+
clusterctl get kubeconfig -n $NAMESPACE $CLUSTER_NAME > /tmp/kubeconfig
120+
kubectl --kubeconfig=/tmp/kubeconfig --server=https://127.0.0.1:$CONTROL_PLANE_ENDPOINT_PORT get nodes
121+
```
122+
75123
### Cluster provisioning with vcsim
76124

77125
In the previous paragraph we explained the process and the components to setup a test environment with a

test/infrastructure/vm-operator/README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ As you might notice, it is required to have an additional component taking care
2828
and vCenter as required by the vm-operator. This component exist in different variants according to the use cases
2929
described in following paragraphs.
3030

31-
## Building and pushing the VM-operator manifest
32-
33-
Run `make release-vm-operator` to build build & publish vm-operator manifest and image to the CAPV staging bucket.
34-
35-
Note: we are maintaining a copy of those artefacts to ensure CAPV test isolation and to allow small customizations
36-
that makes it easier to run the vm-operator in the "limited version of the supervisor", but this might change in the future.
37-
3831
## Tilt for CAPV in supervisor mode using vcsim
3932

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

41+
NOTE: before using `vm-operator` for the first time, you have to run `make vm-operator-manifest-build` in the CAPV folder.
42+
4843
```yaml
4944
...
5045
provider_repos:
@@ -100,3 +95,10 @@ A subset of CAPV E2E tests can be executed using the supervisor mode and vcsim a
10095
Note: The code responsible for E2E tests setup will take care of creating the `VCenterSimulator`, the `ControlPlaneEndpoint`
10196
and to grab required variables from the corresponding `EnvVar`. On top of that, the setup code will also
10297
create the required `VMOperatorDependencies` resource for configuring the test namespace.
98+
99+
## Building and pushing the VM-operator manifest
100+
101+
Run `make release-vm-operator` to build & publish vm-operator manifest and image to the CAPV staging bucket.
102+
103+
Note: we are maintaining a copy of those artefacts to ensure CAPV test isolation and to allow small customizations
104+
that makes it easier to run the vm-operator in the "limited version of the supervisor", but this might change in the future.

0 commit comments

Comments
 (0)