Skip to content

Commit 8ddd6da

Browse files
authored
Merge pull request #446 from akutz/feature/mv-machine-image-scripts
Relocate scripts for building machine images
2 parents 74f274e + 5a838ce commit 8ddd6da

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

build/images/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ The `vmware-iso` builder supports building against a remote VMware ESX server, b
2121
- [Ansible](http://docs.ansible.com/ansible/latest/intro_installation.html) version >= 2.8.0
2222
- [goss](https://github.com/YaleUniversity/packer-provisioner-goss)
2323

24-
The program `../../hack/image-tools.sh` can be used to download and install the goss plug-in.
24+
The program `hack/image-tools.sh` can be used to download and install the goss plug-in.
2525

2626
## The `cloudinit` Directory
2727

28-
The `images` directory contains a child directory, `cloudinit`. The files in this directory:
28+
The `cloudinit` contains files that:
2929

3030
- **Are** example data used for testing
3131
- Are **not** included in any of the images
@@ -76,7 +76,7 @@ The images are uploaded to the GCS bucket `capv-images`. The path to the image d
7676
Uploading the images requires the `gcloud` and `gsutil` programs, an active Google Cloud account, or a service account with an associated key file. The latter may be specified via the environment variable `KEY_FILE`.
7777

7878
```shell
79-
../../hack/image-upload.py --key-file KEY_FILE BUILD_DIR
79+
hack/image-upload.py --key-file KEY_FILE BUILD_DIR
8080
```
8181

8282
First the images are checksummed (SHA256). If a matching checksum already exists remotely then the image is not re-uploaded. Otherwise the images are uploaded to the GCS bucket.
@@ -104,11 +104,11 @@ Images may be downloaded via HTTP:
104104

105105
#### Accessing Local VMs
106106

107-
After the images are built, the VMs from they are built are prepped for local testing. Simply boot the VM locally with Fusion or Workstation and the machine will be initialized with cloud-init data from the `cloudinit` directory. The VMs may be accessed via SSH by using the command `../../hack/image-ssh.sh BUILD_DIR`.
107+
After the images are built, the VMs from they are built are prepped for local testing. Simply boot the VM locally with Fusion or Workstation and the machine will be initialized with cloud-init data from the `cloudinit` directory. The VMs may be accessed via SSH by using the command `hack/image-ssh.sh BUILD_DIR`.
108108

109109
#### Accessing Remote VMs
110110

111-
After deploying an image to vSphere, use `../../hack/image-govc-cloudinit.sh VM` to snapshot the image and update it with cloud-init data from the `cloudinit` directory. The VM may now be accessed with `ssh -i cloudinit/id_rsa.capi SSH_USER@VM_IP`.
111+
After deploying an image to vSphere, use `hack/image-govc-cloudinit.sh VM` to snapshot the image and update it with cloud-init data from the `cloudinit` directory. The VM may now be accessed with `ssh -i cloudinit/id_rsa.capi SSH_USER@VM_IP`.
112112

113113
### Initialize a CNI
114114

File renamed without changes.
File renamed without changes.
File renamed without changes.

hack/image-post-create-config.sh renamed to build/images/hack/image-post-create-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if grep -q 'guestinfo.userdata' "${VMX_FILE}"; then
6767
echo "image-post-create-config: skipping cloud-init data; already exists"
6868
else
6969
echo "image-post-create-config: insert cloud-init data"
70-
CIDATA_DIR="$(dirname "${BASH_SOURCE[0]}")/../build/images/cloudinit"
70+
CIDATA_DIR="$(dirname "${BASH_SOURCE[0]}")/../cloudinit"
7171
cat <<EOF >>"${VMX_FILE}"
7272
guestinfo.userdata = "$({ base64 -w0 || base64; } 2>/dev/null <"${CIDATA_DIR}/user-data")"
7373
guestinfo.userdata.encoding = "base64"

hack/image-ssh.sh renamed to build/images/hack/image-ssh.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ fi
5858
IP_ADDR="$(vmrun getGuestIPAddress "${VMX_FILE}")"
5959

6060
# SSH into the VM with the provided user.
61-
SSH_KEY="$(dirname "${BASH_SOURCE[0]}")/../build/images/cloudinit/id_rsa.capi"
61+
SSH_KEY="$(dirname "${BASH_SOURCE[0]}")/../cloudinit/id_rsa.capi"
6262
echo "image-ssh: ssh -i ${SSH_KEY} ${SSH_USER}@${IP_ADDR}"
6363
exec ssh -o UserKnownHostsFile=/dev/null -i "${SSH_KEY}" "${SSH_USER}"@"${IP_ADDR}"
File renamed without changes.
File renamed without changes.

build/images/packer/packer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@
8686
},
8787
{
8888
"type": "shell-local",
89-
"command": "../../../hack/image-build-ova.py ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
89+
"command": "../hack/image-build-ova.py ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
9090
},
9191
{
9292
"type": "shell-local",
93-
"command": "../../../hack/image-post-create-config.sh ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
93+
"command": "../hack/image-post-create-config.sh ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
9494
}
9595
]
9696
}

0 commit comments

Comments
 (0)