Skip to content
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

Remove patch for building OVAs using content library #2988

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/aws/image-builder/GIT_TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.4.0
v0.4.1
11 changes: 3 additions & 8 deletions projects/aws/image-builder/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## **Image Builder Tool**
![Version](https://img.shields.io/badge/version-v0.4.0-blue)
![Version](https://img.shields.io/badge/version-v0.4.1-blue)
![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiRHQ0UnNzTElaQyt5eDI5OG9XYUhYQW85WXE5RzI3Sjd5YWFwK2d2aHBVb2R4dS8xek5aeUcrVHJFN05JR2JnbWx2aGRURlAxdDZrNFQwMFRaMzY4MWU0PSIsIml2UGFyYW1ldGVyU3BlYyI6InIxUHNId1RQcCs3SzlFWWQiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)

Image Builder Tool is a cli that builds EKS-A compatible Kubernetes node images. The tool is based on upstream
Expand Down Expand Up @@ -92,11 +92,7 @@ sudo apt install jq unzip make ansible -y
sudo snap install yq
```
2. Build or download the image builder tool
3. Create a content library on vSphere
```
govc library.create "<library name>"
```
4. Create vsphere-connection.json config file
3. Create vsphere-connection.json config file
```
{
"cluster":"<vsphere cluster used for image building>",
Expand All @@ -112,10 +108,9 @@ govc library.create "<library name>"
"resource_pool":"<resource pool used for image building vm>",
"username":"<vcenter username>",
"vcenter_server":"<vcenter fqdn>",
"vsphere_library_name": "<vsphere content library name>"
}
```
5. Run the image builder tool for appropriate release channel
4. Run the image builder tool for appropriate release channel
```
image-builder build --os ubuntu --hypervisor vsphere --vsphere-config <path to above json file> --release-channel <release channel, ex 1-23>
```
Expand Down
3 changes: 0 additions & 3 deletions projects/aws/image-builder/builder/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ type VsphereConfig struct {
ResourcePool string `json:"resource_pool"`
Template string `json:"template"`
VcenterServer string `json:"vcenter_server"`
VsphereLibraryName string `json:"vsphere_library_name"`
Username string `json:"username"`
Password string `json:"password"`
AdditionalFiles []File `json:"files"`
IsoConfig
RhelConfig
ProxyConfig
Expand All @@ -81,7 +79,6 @@ type VsphereConfig struct {
}

type BaremetalConfig struct {
AdditionalFiles []File `json:"files"`
IsoConfig
RhelConfig
ProxyConfig
Expand Down
1 change: 0 additions & 1 deletion projects/kubernetes-sigs/image-builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ include $(BASE_DIRECTORY)/Common.mk


export PATH:=$(MAKE_ROOT)/$(IMAGE_BUILDER_DIR)/.local/bin:$(PATH)
export GOVC_INSECURE?=true

######################## DEPS #################################
.PHONY: setup-ami-share
Expand Down
7 changes: 2 additions & 5 deletions projects/kubernetes-sigs/image-builder/buildspecs/ova.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ env:
CLI_FOLDER: "projects/aws/image-builder"
GOPATH: "/home/imagebuilder/go"
secrets-manager:
GOVC_DATACENTER: "vsphere_colo_connection:vsphere_datacenter"
GOVC_URL: "vsphere_colo_connection:vsphere_url"
VSPHERE_URL: "vsphere_colo_connection:vsphere_url"
VSPHERE_IP: "vsphere_colo_connection:vsphere_ip"
GOVC_USERNAME: "vsphere_colo_connection:vsphere_username"
GOVC_PASSWORD: "vsphere_colo_connection:vsphere_password"
VSPHERE_CONNECTION_DATA: "vsphere_colo_connection:vsphere_connection_data"

phases:
Expand All @@ -21,7 +18,7 @@ phases:
commands:
- git config --global credential.helper '!aws codecommit credential-helper $@'
- git config --global credential.UseHttpPath true
- echo "${VSPHERE_IP} ${GOVC_URL}" >> /etc/hosts
- echo "${VSPHERE_IP} ${VSPHERE_URL}" >> /etc/hosts

build:
commands:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
From 4f22a0f719be7fbb75c1065b1b9311d603056508 Mon Sep 17 00:00:00 2001
From df0fd823551a8daea918118f26dac217f1f2d4da Mon Sep 17 00:00:00 2001
From: Vignesh Goutham Ganesh <[email protected]>
Date: Tue, 11 Jan 2022 21:05:13 -0800
Subject: [PATCH 01/11] OVA improvements
Subject: [PATCH 01/10] OVA improvements

- Creat /etc/pki/tls/certs dir as part of image-builds
- Create /etc/pki/tls/certs dir as part of image-builds
- Tweak Product info in OVF
- Output vsphere builds to content library instead of exports

Signed-off-by: Vignesh Goutham Ganesh <[email protected]>
---
.../capi/ansible/roles/sysprep/tasks/main.yml | 9 ++++
images/capi/hack/ovf_template.xml | 10 +----
images/capi/packer/ova/packer-node.json | 41 +++++++++++++------
3 files changed, 40 insertions(+), 20 deletions(-)
images/capi/ansible/roles/sysprep/tasks/main.yml | 9 +++++++++
images/capi/hack/ovf_template.xml | 10 ++--------
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/images/capi/ansible/roles/sysprep/tasks/main.yml b/images/capi/ansible/roles/sysprep/tasks/main.yml
index a9fa954d5..a526528ea 100644
Expand Down Expand Up @@ -60,99 +58,6 @@ index 316427ec3..ca23db5f9 100644
<Category>Cluster API Provider (CAPI)</Category>
<Property ovf:userConfigurable="false" ovf:value="${BUILD_TIMESTAMP}" ovf:type="string" ovf:key="BUILD_TIMESTAMP"/>
<Property ovf:userConfigurable="false" ovf:value="${BUILD_DATE}" ovf:type="string" ovf:key="BUILD_DATE"/>
diff --git a/images/capi/packer/ova/packer-node.json b/images/capi/packer/ova/packer-node.json
index 1b7b2d13d..f46df3cee 100644
--- a/images/capi/packer/ova/packer-node.json
+++ b/images/capi/packer/ova/packer-node.json
@@ -184,6 +184,12 @@
}
],
"type": "vsphere-iso",
+ "content_library_destination": {
+ "name": "{{user `build_version`}}",
+ "library": "{{user `vsphere_library_name`}}",
+ "ovf": true,
+ "destroy": true
+ },
"username": "{{user `username`}}",
"vcenter_server": "{{user `vcenter_server`}}",
"vm_name": "{{user `base_build_version`}}",
@@ -207,11 +213,6 @@
"datastore": "{{user `datastore`}}",
"destroy": "{{user `destroy`}}",
"disk_controller_type": "{{user `disk_controller_type`}}",
- "export": {
- "force": true,
- "manifest": "{{ user `export_manifest`}}",
- "output_directory": "{{user `output_dir`}}"
- },
"firmware": "{{user `firmware`}}",
"floppy_dirs": "{{ user `floppy_dirs`}}",
"folder": "{{user `folder`}}",
@@ -248,6 +249,12 @@
}
],
"type": "vsphere-iso",
+ "content_library_destination": {
+ "name": "{{user `build_version`}}",
+ "library": "{{user `vsphere_library_name`}}",
+ "ovf": true,
+ "destroy": true
+ },
"username": "{{user `username`}}",
"vcenter_server": "{{user `vcenter_server`}}",
"vm_name": "{{user `build_version`}}",
@@ -263,11 +270,6 @@
"create_snapshot": "{{user `create_snapshot`}}",
"datacenter": "{{user `datacenter`}}",
"datastore": "{{user `datastore`}}",
- "export": {
- "force": true,
- "manifest": "{{ user `export_manifest`}}",
- "output_directory": "{{user `output_dir`}}"
- },
"folder": "{{user `folder`}}",
"host": "{{user `host`}}",
"insecure_connection": "{{user `insecure_connection`}}",
@@ -290,6 +292,13 @@
}
],
"post-processors": [
+ {
+ "inline": [
+ "mkdir -p {{user `output_dir`}}"
+ ],
+ "name": "create-output-dir",
+ "type": "shell-local"
+ },
{
"custom_data": {
"build_date": "{{isotime}}",
@@ -324,7 +333,14 @@
"vsphere-iso-base"
],
"inline": [
- "./hack/image-build-ova.py --vmx {{user `vmx_version`}} --eula ./hack/ovf_eula.txt --ovf_template ./hack/ovf_template.xml --vmdk_file {{user `build_version`}}-disk-0.vmdk {{user `output_dir`}}"
+ "while true; do govc library.session.ls &> /dev/null || true; sleep 2m; done &",
+ "PID=$!",
+ "trap \"kill $PID\" EXIT",
+ "govc library.export /{{user `vsphere_library_name`}}/{{user `build_version`}}/{{user `build_version`}}.ovf {{user `output_dir`}}/{{user `build_version`}}.ovf",
+ "govc library.export /{{user `vsphere_library_name`}}/{{user `build_version`}}/{{user `build_version`}}-1.vmdk {{user `output_dir`}}/{{user `build_version`}}-1.vmdk",
+ "govc library.export /{{user `vsphere_library_name`}}/{{user `build_version`}}/{{user `build_version`}}-2.nvram {{user `output_dir`}}/{{user `build_version`}}-2.nvram",
+ "govc library.rm /{{user `vsphere_library_name`}}/{{user `build_version`}}",
+ "./hack/image-build-ova.py --vmx {{user `vmx_version`}} --eula ./hack/ovf_eula.txt --ovf_template ./hack/ovf_template.xml --vmdk_file {{user `build_version`}}-1.vmdk {{user `output_dir`}}"
],
"name": "vsphere",
"type": "shell-local"
@@ -509,6 +525,7 @@
"resource_pool": "",
"username": "",
"vcenter_server": "",
- "vsphere_guest_os_type": null
+ "vsphere_guest_os_type": null,
+ "vsphere_library_name": ""
}
}
--
2.39.3 (Apple Git-145)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From f5fddefc341474427b45eaf41222325fa831ee6e Mon Sep 17 00:00:00 2001
From 48ff6678b232a40aaff06c8551dcac607351b481 Mon Sep 17 00:00:00 2001
From: Vignesh Goutham Ganesh <[email protected]>
Date: Tue, 11 Jan 2022 18:36:56 -0800
Subject: [PATCH 02/11] EKS-D support and changes
Subject: [PATCH 02/10] EKS-D support and changes

- Add goss validations for EKS-D artifacts
- Add etcdadm and etcd.tar.gz to image for unstacked etcd support
Expand Down Expand Up @@ -162,7 +162,7 @@ index 9cce0a96a..37fd9e4eb 100644
"kubernetes_series": "v1.26",
"kubernetes_source_type": "pkg",
diff --git a/images/capi/packer/goss/goss-command.yaml b/images/capi/packer/goss/goss-command.yaml
index 19c202319..a72ed6f17 100644
index 4c94e64da..1ce7508f5 100644
--- a/images/capi/packer/goss/goss-command.yaml
+++ b/images/capi/packer/goss/goss-command.yaml
@@ -37,6 +37,11 @@ command:
Expand Down Expand Up @@ -264,10 +264,10 @@ index 959005df8..2d88c2fb6 100644
"version": "{{user `goss_version`}}"
}
diff --git a/images/capi/packer/ova/packer-node.json b/images/capi/packer/ova/packer-node.json
index e85dbe077..feeaf1a37 100644
index 1b7b2d13d..a55c78038 100644
--- a/images/capi/packer/ova/packer-node.json
+++ b/images/capi/packer/ova/packer-node.json
@@ -464,7 +464,12 @@
@@ -451,7 +451,12 @@
"kubernetes_deb_version": "{{ user `kubernetes_deb_version` }}",
"kubernetes_rpm_version": "{{ split (user `kubernetes_rpm_version`) \"-\" 0 }}",
"kubernetes_source_type": "{{user `kubernetes_source_type`}}",
Expand Down Expand Up @@ -318,5 +318,5 @@ index 152041455..a04be4e8f 100644
"version": "{{user `goss_version`}}"
}
--
2.39.3 (Apple Git-145)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5d046d6ec6b28e6827c3ff0b5df8547d3c411cc0 Mon Sep 17 00:00:00 2001
From c878d0011c9ffb7720ba7f462689b54a2056961a Mon Sep 17 00:00:00 2001
From: Abhay Krishna Arunachalam <[email protected]>
Date: Thu, 2 Feb 2023 01:39:15 -0800
Subject: [PATCH 03/11] Snow AMI support
Subject: [PATCH 03/10] Snow AMI support

- Add instance metadata options to Packer config
- Rename Snow node image to reflect appropriate CAPI provider
Expand Down Expand Up @@ -47,5 +47,5 @@ index eb4552a4c..f5856f4c3 100644
"ib_version": "{{env `IB_VERSION`}}",
"iops": "3000",
--
2.39.3 (Apple Git-145)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 46ea9af97300b99632ca0557ea5ffd01e4460afb Mon Sep 17 00:00:00 2001
From 91e25d9f32abe319fdef1aeea07c40f2750cbacd Mon Sep 17 00:00:00 2001
From: Jackson West <[email protected]>
Date: Fri, 23 Jun 2023 10:50:08 -0500
Subject: [PATCH 04/11] Ubuntu 22 support and improvements
Subject: [PATCH 04/10] Ubuntu 22 support and improvements

- uses latest ubuntu 22.04 iso
- adds support for raw ubuntu 22.04 builds
Expand Down Expand Up @@ -394,5 +394,5 @@ index 000000000..c9cfe7381
+ "shutdown_command": "shutdown -P now"
+ }
--
2.39.3 (Apple Git-145)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5bd56bd23692f84b4fcfb99ed331831edde522f4 Mon Sep 17 00:00:00 2001
From fc9896eda26f6d36b15bd294b3031c815aeb9f64 Mon Sep 17 00:00:00 2001
From: Vignesh Goutham Ganesh <[email protected]>
Date: Tue, 6 Dec 2022 15:42:02 -0600
Subject: [PATCH 05/11] RHEL support and improvements
Subject: [PATCH 05/10] RHEL support and improvements

- Exclude kernel and cloud-init from yum updates
- Patch cloud-init systemd unit to wait for network manager online
Expand All @@ -20,7 +20,7 @@ Signed-off-by: Vignesh Goutham Ganesh <[email protected]>
.../ansible/roles/providers/tasks/main.yml | 15 ++++
.../capi/ansible/roles/setup/tasks/redhat.yml | 84 +++++++++++++++++++
images/capi/packer/config/ansible-args.json | 2 +-
6 files changed, 148 insertions(+), 3 deletions(-)
6 files changed, 137 insertions(+), 1 deletion(-)
create mode 100644 images/capi/ansible/roles/node/tasks/redhat.yml
create mode 100644 images/capi/ansible/roles/providers/files/etc/systemd/system/cloud-init.service.d/boot-order.conf

Expand Down Expand Up @@ -113,7 +113,7 @@ index b55b78099..a58f0e7c0 100644
# Enable all cloud-init services on boot.
- name: Make sure all cloud init services are enabled
diff --git a/images/capi/ansible/roles/setup/tasks/redhat.yml b/images/capi/ansible/roles/setup/tasks/redhat.yml
index 74329afd4..4ebe7d732 100644
index 74329afd4..e20e3da6c 100644
--- a/images/capi/ansible/roles/setup/tasks/redhat.yml
+++ b/images/capi/ansible/roles/setup/tasks/redhat.yml
@@ -22,6 +22,74 @@
Expand Down Expand Up @@ -229,6 +229,6 @@ index d7e50f852..22225c7d3 100644
+ "ansible_common_vars": "containerd_url={{user `containerd_url`}} containerd_sha256={{user `containerd_sha256`}} pause_image={{user `pause_image`}} containerd_additional_settings={{user `containerd_additional_settings`}} containerd_cri_socket={{user `containerd_cri_socket`}} containerd_version={{user `containerd_version`}} containerd_wasm_shims_url={{user `containerd_wasm_shims_url`}} containerd_wasm_shims_version={{user `containerd_wasm_shims_version`}} containerd_wasm_shims_sha256={{user `containerd_wasm_shims_sha256`}} containerd_wasm_shims_runtimes=\"{{user `containerd_wasm_shims_runtimes`}}\" containerd_wasm_shims_runtime_versions=\"{{user `containerd_wasm_shims_runtime_versions`}}\" crictl_url={{user `crictl_url`}} crictl_sha256={{user `crictl_sha256`}} crictl_source_type={{user `crictl_source_type`}} custom_role_names=\"{{user `custom_role_names`}}\" firstboot_custom_roles_pre=\"{{user `firstboot_custom_roles_pre`}}\" firstboot_custom_roles_post=\"{{user `firstboot_custom_roles_post`}}\" node_custom_roles_pre=\"{{user `node_custom_roles_pre`}}\" node_custom_roles_post=\"{{user `node_custom_roles_post`}}\" disable_public_repos={{user `disable_public_repos`}} extra_debs=\"{{user `extra_debs`}}\" extra_repos=\"{{user `extra_repos`}}\" extra_rpms=\"{{user `extra_rpms`}}\" http_proxy={{user `http_proxy`}} https_proxy={{user `https_proxy`}} kubeadm_template={{user `kubeadm_template`}} kubernetes_apiserver_port={{user `kubernetes_apiserver_port`}} kubernetes_cni_http_source={{user `kubernetes_cni_http_source`}} kubernetes_cni_http_checksum={{user `kubernetes_cni_http_checksum`}} kubernetes_goarch={{user `kubernetes_goarch`}} kubernetes_http_source={{user `kubernetes_http_source`}} kubernetes_container_registry={{user `kubernetes_container_registry`}} kubernetes_rpm_repo={{user `kubernetes_rpm_repo`}} kubernetes_rpm_gpg_key={{user `kubernetes_rpm_gpg_key`}} kubernetes_rpm_gpg_check={{user `kubernetes_rpm_gpg_check`}} kubernetes_deb_repo={{user `kubernetes_deb_repo`}} kubernetes_deb_gpg_key={{user `kubernetes_deb_gpg_key`}} kubernetes_cni_deb_version={{user `kubernetes_cni_deb_version`}} kubernetes_cni_rpm_version={{user `kubernetes_cni_rpm_version`}} kubernetes_cni_semver={{user `kubernetes_cni_semver`}} kubernetes_cni_source_type={{user `kubernetes_cni_source_type`}} kubernetes_semver={{user `kubernetes_semver`}} kubernetes_source_type={{user `kubernetes_source_type`}} kubernetes_load_additional_imgs={{user `kubernetes_load_additional_imgs`}} kubernetes_deb_version={{user `kubernetes_deb_version`}} kubernetes_rpm_version={{user `kubernetes_rpm_version`}} no_proxy={{user `no_proxy`}} pip_conf_file={{user `pip_conf_file`}} python_path={{user `python_path`}} redhat_epel_rpm={{user `redhat_epel_rpm`}} epel_rpm_gpg_key={{user `epel_rpm_gpg_key`}} reenable_public_repos={{user `reenable_public_repos`}} remove_extra_repos={{user `remove_extra_repos`}} systemd_prefix={{user `systemd_prefix`}} sysusr_prefix={{user `sysusr_prefix`}} sysusrlocal_prefix={{user `sysusrlocal_prefix`}} load_additional_components={{ user `load_additional_components`}} additional_registry_images={{ user `additional_registry_images`}} additional_registry_images_list={{ user `additional_registry_images_list`}} additional_url_images={{ user `additional_url_images`}} additional_url_images_list={{ user `additional_url_images_list`}} additional_executables={{ user `additional_executables`}} additional_executables_list={{ user `additional_executables_list`}} additional_executables_destination_path={{ user `additional_executables_destination_path`}} additional_s3={{ user `additional_s3`}} build_target={{ user `build_target`}} amazon_ssm_agent_rpm={{ user `amazon_ssm_agent_rpm` }} enable_containerd_audit={{ user `enable_containerd_audit` }} kubernetes_enable_automatic_resource_sizing={{ user `kubernetes_enable_automatic_resource_sizing` }} etcd_http_source={{user `etcd_http_source`}} etcd_version={{user `etcd_version`}} etcdadm_http_source={{user `etcdadm_http_source`}} etcd_sha256={{user `etcd_sha256`}} etcdadm_version={{user `etcdadm_version`}} rhsm_server_hostname={{ user `rhsm_server_hostname` }} rhsm_server_release_version={{ user `rhsm_server_release_version` }} rhsm_server_proxy_hostname={{ user `rhsm_server_proxy_hostname` }} rhsm_server_proxy_port={{ user `rhsm_server_proxy_port` }}",
"ansible_scp_extra_args": "{{env `ANSIBLE_SCP_EXTRA_ARGS`}}"
}
--
2.34.1
--
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 56c9245719b1ff798bcab6fcbe0cc344fdc84920 Mon Sep 17 00:00:00 2001
From 88728dfcd01eb686f7323d02d6f2aa698607aa4e Mon Sep 17 00:00:00 2001
From: Ilya Alekseyev <[email protected]>
Date: Wed, 11 Oct 2023 22:07:22 -0400
Subject: [PATCH 06/11] Nutanix RHEL support for AWS image-builder
Subject: [PATCH 06/10] Nutanix RHEL support for AWS image-builder

---
images/capi/packer/nutanix/packer.json | 1 +
Expand Down Expand Up @@ -46,5 +46,5 @@ index b7dddb4f2..921a9729f 100644
"shutdown_command": "shutdown -P now",
"user_data": "I2Nsb3VkLWNvbmZpZwp1c2VyczoKICAtIG5hbWU6IGJ1aWxkZXIKICAgIHN1ZG86IFsnQUxMPShBTEwpIE5PUEFTU1dEOkFMTCddCmNocGFzc3dkOgogIGxpc3Q6IHwKICAgIGJ1aWxkZXI6YnVpbGRlcgogIGV4cGlyZTogRmFsc2UKc3NoX3B3YXV0aDogVHJ1ZQ=="
--
2.39.3 (Apple Git-145)
2.39.3 (Apple Git-146)

Loading