|
1 |
| -# Setup |
| 1 | +# Overview |
2 | 2 |
|
3 |
| -## Creation of GCVE |
| 3 | +The code in `k8s-infra-gcp-gcve` sets up the infra required to allow prow jobs to create VMs on vSphere, e.g. to allow testing of the [Cluster API provider vSphere (CAPV)](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere). |
4 | 4 |
|
5 |
| -```sh |
6 |
| -gcloud auth application-default login |
7 |
| -terraform init |
8 |
| -terraform apply |
9 |
| -``` |
| 5 | + |
10 | 6 |
|
11 |
| -## Setup jumphost/vpn for further configuration |
| 7 | +Prow container settings are managed outside of this folder, but understanding high level components could |
| 8 | +help to understand how the `k8s-infra-gcp-gcve` is set up and consumed. |
12 | 9 |
|
13 |
| -See [maintenance-jumphost/README.md](./maintenance-jumphost/README.md). |
| 10 | +More specifically, to allow prow jobs to create VM on vSphere, a few resources are made available to a prow container, so as of today only in the `k8s-infra-prow-build` prow cluster. |
14 | 11 |
|
15 |
| -## Manual creation of a user and other IAM configuration in vSphere |
| 12 | +- A secret, added via the `preset-gcve-e2e-config` [preset](https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes-sigs/cluster-api-provider-vsphere/cluster-api-provider-vsphere-presets.yaml), that provides vSphere URL and vSphere credentials |
| 13 | +- A set of Boskos resources of type `gcve-vsphere-project`, allowing access to: |
| 14 | + - a vSphere folder and a vSphere resources pool where to run VMs during a test. |
| 15 | + - a reserved IP range to be used for the test e.g. for the kube vip load balancer in a CAPV cluster (VM instead will get IPs via DHCP). |
16 | 16 |
|
17 |
| -> **Note:** |
18 |
| -> The configuration described here cannot be done via terraform due to non-existing functionality. |
| 17 | +Also, the network of the prow container is going to be paired to the VMware engine network, thus |
| 18 | +allowing access to both the GCVE management network and the NSX-T network where all the VM are running. |
19 | 19 |
|
20 |
| -First we generate a password for the user which will be used in prow and set it as environment variable: |
| 20 | +The `k8s-infra-gcp-gcve` project sets up the infrastructure that actually runs the VMs created from the prow container. There are ther main components of this infrastracture: |
21 | 21 |
|
22 |
| -```sh |
23 |
| - export GCVE_PROW_CI_PASSWORD="SomePassword" |
24 |
| -``` |
| 22 | +The terraform manifest in this folder, which is applied by test-infra automation (Atlantis), uses the GCP terraform provider for creating. |
| 23 | +- A VMware Engine instance |
| 24 | +- The network infrastructure required for vSphere and for allowing communication between vSphere and Prow container. |
| 25 | + - The network used is `192.168.0.32/21` |
| 26 | + - Usable Host IP Range: `192.168.32.1 - 192.168.39.254` |
| 27 | + - DHCP Range: `192.168.32.11 - 192.168.33.255` |
| 28 | + - IPPool for 40 Projects having 16 IPs each: `192.168.35.0 - 192.168.37.127` |
| 29 | +- The network infrastructure used for maintenance. |
25 | 30 |
|
26 |
| -And set credentials for `govc`: |
| 31 | +See inline comments for more details. |
27 | 32 |
|
28 |
| -```sh |
29 |
| - export GOVC_URL="$(gcloud vmware private-clouds describe k8s-gcp-gcve-pc --location us-central1-a --format='get(vcenter.fqdn)')" |
30 |
| - export GOVC_USERNAME= '[email protected]' |
31 |
| - export GOVC_PASSWORD= "$(gcloud vmware private-clouds vcenter credentials describe --private-cloud=k8s-gcp-gcve-pc [email protected] --location=us-central1-a --format='get(password)')" |
32 |
| -``` |
| 33 | +The terraform manifest in the `/maintenance-jumphost` uses the GCP terraform provider to setup a jumphost VM to be used to set up vSphere or for maintenance pourposes. See |
| 34 | +- [maintenance-jumphost](./maintenance-jumphost/README.md) |
33 | 35 |
|
34 |
| -Run the script to setup the user, groups and IAM in vSphere. |
| 36 | +The terraform manifest in the `/vsphere` folder uses the vSphere and the NSX terraform providers to setup e.g. content libraries, templetes, folders, |
| 37 | +resource pools and other vSphere components required when running tests. See: |
| 38 | +- [vsphere](./vsphere/README.md) |
35 | 39 |
|
36 |
| -``` |
37 |
| -./vsphere/scripts/ensure-users-groups.sh |
38 |
| -``` |
39 |
| - |
40 |
| -Create relevant secrets in Secrets Manager |
41 |
| - |
42 |
| -```sh |
43 |
| -gcloud secrets describe k8s-gcp-gcve-ci-url 2>/dev/null || echo "$GOVC_URL" | gcloud secrets create k8s-gcp-gcve-ci-url --data-file=- |
44 |
| -gcloud secrets describe k8s-gcp-gcve-ci-username 2>/dev/null || echo "[email protected]" | gcloud secrets create k8s-gcp-gcve-ci-username --data-file=- |
45 |
| -gcloud secrets describe k8s-gcp-gcve-ci-password 2>/dev/null || echo "${GCVE_PROW_CI_PASSWORD}" | gcloud secrets create k8s-gcp-gcve-ci-password --data-file=- |
46 |
| -gcloud secrets describe k8s-gcp-gcve-ci-thumbprint 2>/dev/null || echo "$(govc about.cert -json | jq -r '.thumbprintSHA256')" | gcloud secrets create k8s-gcp-gcve-ci-thumbprint --data-file=- |
47 |
| -``` |
48 |
| - |
49 |
| -* `k8s-gcp-gcve-ci-username` with value `[email protected]` |
50 |
| -* `k8s-gcp-gcve-ci-password` with value set above for `GCVE_PROW_CI_PASSWORD` |
51 |
| -* `k8s-gcp-gcve-ci-url` with value set above for `GOVC_URL` |
52 |
| - |
53 |
| -> **Note:** Changing the GCVE CI user's password |
54 |
| -> |
55 |
| -> 1. Set GOVC credentials as above. |
56 |
| -> 2. Run govc command to update password: `govc sso.user.update -p "${GCVE_PROW_CI_PASSWORD}" prow-ci-user` |
57 |
| -> 3. Update secret `k8s-gcp-gcve-ci-password` in secrets-manager: `echo "${GCVE_PROW_CI_PASSWORD}" | gcloud secrets versions add k8s-gcp-gcve-ci-password --data-file=-` |
58 |
| -
|
59 |
| -## Configuration of GCVE |
60 |
| - |
61 |
| -```sh |
62 |
| - |
63 |
| - export TF_VAR_vsphere_password= "$(gcloud vmware private-clouds vcenter credentials describe --private-cloud=k8s-gcp-gcve-pc [email protected] --location=us-central1-a --format='get(password)')" # gcloud command |
64 |
| - export TF_VAR_vsphere_server="$(gcloud vmware private-clouds describe k8s-gcp-gcve-pc --location us-central1-a --format='get(vcenter.fqdn)')" |
65 |
| - export TF_VAR_nsxt_user=admin |
66 |
| - export TF_VAR_nsxt_password="$(gcloud vmware private-clouds nsx credentials describe --private-cloud k8s-gcp-gcve-pc --location us-central1-a --format='get(password)')" |
67 |
| - export TF_VAR_nsxt_server="$(gcloud vmware private-clouds describe k8s-gcp-gcve-pc --location us-central1-a --format='get(nsx.fqdn)')" |
68 |
| - export GOVC_URL="${TF_VAR_vsphere_server}" |
69 |
| - export GOVC_USERNAME="${TF_VAR_vsphere_user}" |
70 |
| - export GOVC_PASSWORD="${TF_VAR_vsphere_password}" |
71 |
| -``` |
72 |
| - |
73 |
| -```sh |
74 |
| -cd vsphere |
75 |
| -terraform init |
76 |
| -terraform apply |
77 |
| -./scripts/ensure-users-permissions.sh |
78 |
| -``` |
79 |
| - |
80 |
| -## Initialize Boskos resources with project information |
81 |
| - |
82 |
| -The script [boskos-userdata.sh](vsphere/scripts/boskos-userdata.sh) calculates and initializes the Boskos resources required for the project. |
83 |
| - |
84 |
| -```sh |
85 |
| -BOSKOS_HOST="" |
86 |
| -vsphere/scripts/boskos-userdata.sh |
87 |
| -``` |
0 commit comments