-
Notifications
You must be signed in to change notification settings - Fork 888
[WIP] gcve: Add tags for failure domain testing, reprovision for vsphere 8 and add inline comments #8148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrischdi
wants to merge
13
commits into
kubernetes:main
Choose a base branch
from
chrischdi:pr-gcve-add-tags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+661
−332
Open
[WIP] gcve: Add tags for failure domain testing, reprovision for vsphere 8 and add inline comments #8148
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8cd6ff8
gcve: fxup documentation
chrischdi bb5af64
gcve: Add tags for failure domain testing
chrischdi 99bf46b
gcve: add comments to the terraform files
chrischdi 50647a8
Adjust comments and godocs
chrischdi 39c3569
address linter findings and remove unused resources
chrischdi 16c5ce7
review fixes
chrischdi 3da9d98
gcve: Enable essentialcontacts api and script
chrischdi c1fa3fc
gcve: fixup essential contacts
chrischdi 8eecae4
gcve: reprovision using different cidrs for vSphere 8
chrischdi ba3730a
gcve: fixup essential contacts
chrischdi 2acf0a8
gcve: fixup overview image
chrischdi a10c77f
gcve: fixup vsphere readme and add dependency to nsx for datasource
chrischdi 093a1eb
Review fixes
chrischdi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
216 changes: 0 additions & 216 deletions
216
infra/gcp/terraform/k8s-infra-gcp-gcve/docs/images/GVCE.drawio
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
|
||
See [README.md](https://github.com/kubernetes/k8s.io/tree/main/infra/gcp/terraform) for a general intro about using terraform in k8s.io. | ||
|
||
In order to apply terraform manifests you must be enabled to use the "broadcom-451918" project, please reach to [owners](../OWNERS) in case of need. | ||
In order to apply terraform manifests you must be enabled to use the "broadcom-451918" project, please reach out to [owners](../OWNERS) in case of need. | ||
|
||
Quick reference: | ||
|
||
Go to the folder of interest | ||
- [maintenance-jumphost](../maintenance-jumphost/) | ||
- [vsphere](../vsphere/) | ||
- [maintenance-jumphost](../maintenance-jumphost/README.md) | ||
- [vsphere](../vsphere/README.md) | ||
|
||
Note: the terraform script in the top folder is usually managed by test-infra automation (Atlantis); we don't have to run it manually. | ||
|
||
|
@@ -19,26 +19,35 @@ You can use terraform from your local workstation or via a docker container prov | |
docker run -it --rm -v $(pwd):/workspace --entrypoint=/bin/bash gcr.io/k8s-staging-infra-tools/k8s-infra:v20241217-f8b07a049 | ||
``` | ||
|
||
From your local workstatin / from inside the terraform container: | ||
From your local workstation / from inside the terraform container: | ||
|
||
Login to GCP to get an authentication token to use with terraform. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did l.27 just work for you? I needed some combination of the following commands to get it to work gcloud config set project xxx
gcloud auth login (not sure what the minimum set of commands is) |
||
```bash | ||
gcloud auth application-default login | ||
gcloud auth login | ||
gcloud config set project broadcom-451918 | ||
``` | ||
|
||
Ensure all the env variables expected by the terraform manifest you are planning to run are set: | ||
- [vsphere](../vsphere/) | ||
- [vsphere](../vsphere/README.md) | ||
|
||
Ensure the right terraform version expected by the terraform manifest you are planning to run is installed (Note: this requires `tfswitch` which is pre-installed in the docker image. In case of version mismatches, terraform will make you know): | ||
|
||
```bash | ||
cd infra/gcp/terraform/k8s-infra-gcp-gcve/ | ||
tfswitch | ||
``` | ||
|
||
Additionally, if applying the vsphere terraform manifest, use the following script to generate `/etc/hosts` entries for vSphere and NSX. | ||
|
||
```sh | ||
gcloud vmware private-clouds describe k8s-gcp-gcve-pc --location us-central1-a --format='json' | jq -r '.vcenter.internalIp + " " + .vcenter.fqdn +"\n" + .nsx.internalIp + " " + .nsx.fqdn' | ||
gcloud vmware private-clouds describe k8s-gcp-gcve --location us-central1-a --format='json' | jq -r '.vcenter.internalIp + " " + .vcenter.fqdn +"\n" + .nsx.internalIp + " " + .nsx.fqdn' | ||
``` | ||
|
||
Add those entry to `/etc/hosts`. | ||
Add those entries to `/etc/hosts`. | ||
|
||
At this point you are ready to start using `terraform init`, `terraform plan`, `terraform apply` etc. | ||
At this point you are ready to start using `terraform init`, `terraform plan`, `terraform apply` etc. | ||
|
||
Notes: | ||
- Terraform state is stored in a gcs bucket with name `k8s-infra-tf-gcp-gcve`, with a folder for each one of the terraform scripts managed in the `k8s-infra-gcp-gcve` folder (gcve, gcve-vcenter, maintenance-jumphost). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
infra/gcp/terraform/k8s-infra-gcp-gcve/nsx-gateway/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# NSX Gateway | ||
|
||
TODO: describe what this does | ||
TODO: link from top-level readme's | ||
|
||
The wireguard config will look like | ||
|
||
```ini | ||
[Interface] | ||
PrivateKey = ... | ||
Address = 192.168.29.6/24 | ||
PostUp = iptables -t nat -I POSTROUTING -o wg0 -j MASQUERADE | ||
PostDown = iptables -t nat -D POSTROUTING -o wg0 -j MASQUERADE | ||
|
||
[Peer] | ||
Endpoint = 192.168.28.3:51820 | ||
PublicKey = ... | ||
PersistentKeepalive = 25 | ||
# all except private networks | ||
AllowedIPs = 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 224.0.0.0/3 | ||
``` | ||
|
||
To get SSH access to the VM, redeploy using: | ||
|
||
```sh | ||
export TF_VAR_ssh_public_key="ssh-rsa ..." | ||
terraform taint vsphere_virtual_machine.gateway_vm | ||
terraform apply | ||
``` | ||
|
||
Note: Redeployment causes connection issues for running CI jobs. |
29 changes: 29 additions & 0 deletions
29
infra/gcp/terraform/k8s-infra-gcp-gcve/nsx-gateway/cloud-config.yaml.tftpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#cloud-config | ||
|
||
write_files: | ||
- path: /etc/wireguard/wg0.conf | ||
content: "${wg0}" | ||
encoding: b64 | ||
permissions: "0600" | ||
|
||
- path: /etc/sysctl.d/10-wireguard.conf | ||
content: | | ||
net.ipv4.ip_forward = 1 | ||
|
||
users: | ||
- name: ubuntu | ||
primary_group: ubuntu | ||
sudo: ALL=(ALL) NOPASSWD:ALL | ||
shell: /bin/bash | ||
groups: sudo, wheel | ||
ssh_import_id: None | ||
lock_passwd: true | ||
ssh_authorized_keys: | ||
- "${ssh_public_key}" | ||
|
||
runcmd: | ||
- apt-get update | ||
- apt install wireguard -q -y | ||
- sysctl -p /etc/sysctl.d/10-wireguard.conf | ||
- systemctl enable wg-quick@wg0 | ||
- systemctl start wg-quick@wg0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: remove the
-pc
in the image too