Skip to content

Commit db2bd78

Browse files
authored
Merge pull request #1847 from nutanix-cloud-native/fix/nutanix-windows
fix: Windows support with Nutanix builder
2 parents e573a18 + 7f95371 commit db2bd78

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

docs/book/src/capi/goss/goss.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ to test if the images have all requisite components to work with cluster API.
1010
### Support Matrix
1111
*For stock server-specs shipped with repo
1212

13-
| OS | Builder |
14-
|-------------------------|----------------------|
15-
| Amazon Linux | aws |
16-
| Azure Linux | azure |
17-
| CentOS | aws, ova |
18-
| Flatcar Container Linux | aws, azure, ova |
19-
| PhotonOS | ova |
20-
| Ubuntu | aws, azure, gcp, ova |
21-
| Windows | aws, azure, ova |
13+
| OS | Builder |
14+
|-------------------------|-------------------------------|
15+
| Amazon Linux | aws |
16+
| Azure Linux | azure |
17+
| CentOS | aws, nutanix, ova |
18+
| Flatcar Container Linux | aws, azure, nutanix, ova |
19+
| PhotonOS | ova |
20+
| Ubuntu | aws, azure, gcp, nutanix, ova |
21+
| Windows | aws, azure, nutanix, ova |
2222

2323

2424
### Prerequisites for Running Goss

images/capi/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,11 @@ $(POWERVS_VALIDATE_TARGETS): deps-powervs
620620

621621
.PHONY: $(NUTANIX_BUILD_TARGETS)
622622
$(NUTANIX_BUILD_TARGETS): deps-nutanix set-ssh-password
623-
$(eval NUTANIX_USERDATA:=$(shell cat $(abspath packer/nutanix/linux/cloud-init/$(subst -,/,$(if $(findstring ubuntu,$@),$(call GET_UBUNTU_DOTTED_SEMVER,$(subst build-nutanix-,,$@)),$(subst build-nutanix-,,$@)))/user-data) | base64 -w0))
624-
$(eval NUTANIX_VAR_FILE:=$(abspath packer/nutanix/$(subst build-nutanix-,,$@).json))
625-
jq '.user_data = "$(NUTANIX_USERDATA)"' $(NUTANIX_VAR_FILE) > $(NUTANIX_VAR_FILE).templated && mv $(NUTANIX_VAR_FILE).templated $(NUTANIX_VAR_FILE)
623+
$(if $(findstring windows,$@),,$(eval NUTANIX_USERDATA:=$(shell cat $(abspath packer/nutanix/linux/cloud-init/$(subst -,/,$(if $(findstring ubuntu,$@),$(call GET_UBUNTU_DOTTED_SEMVER,$(subst build-nutanix-,,$@)),$(subst build-nutanix-,,$@)))/user-data) | base64 -w0)))
624+
$(if $(findstring windows,$@),,$(eval NUTANIX_VAR_FILE:=$(abspath packer/nutanix/$(subst build-nutanix-,,$@).json)))
625+
$(if $(findstring windows,$@),,jq '.user_data = "$(NUTANIX_USERDATA)"' $(NUTANIX_VAR_FILE) > $(NUTANIX_VAR_FILE).templated && mv $(NUTANIX_VAR_FILE).templated $(NUTANIX_VAR_FILE))
626626
# This uses a packer file builder to input unattend variables into a JSON file to be consumed by the python script before running the nutanix provisioner
627+
$(if $(findstring windows,$@),$(PACKER) build $(PACKER_WINDOWS_NODE_FLAGS) -var-file="packer/nutanix/nutanix.json" -var-file="$(abspath packer/nutanix/$(subst build-nutanix-,,$@).json)" -only=file $(ABSOLUTE_PACKER_VAR_FILES) packer/nutanix/packer$(if $(findstring windows,$@),-windows,).json,)
627628
$(if $(findstring windows,$@),hack/windows-unattend.py --unattend-file='./packer/nutanix/windows/$(subst build-nutanix-,,$@)/autounattend.xml',)
628629
$(PACKER) build $(if $(findstring windows,$@),$(PACKER_WINDOWS_NODE_FLAGS),$(PACKER_NODE_FLAGS)) -var-file="packer/nutanix/nutanix.json" -var-file="$(abspath packer/nutanix/$(subst build-nutanix-,,$@).json)" $(ABSOLUTE_PACKER_VAR_FILES) packer/nutanix/packer$(if $(findstring windows,$@),-windows,).json
629630

images/capi/packer/nutanix/packer-windows.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"builders": [
3+
{
4+
"content": "{\n \"unattend_timezone\" : \"{{user `unattend_timezone`}}\"\n, \"admin_password\" : \"{{user `windows_admin_password`}}\"\n}",
5+
"target": "./packer_cache/unattend.json",
6+
"type": "file"
7+
},
38
{
49
"boot_type": "{{user `boot_type`}}",
510
"cd_files": [
@@ -54,6 +59,7 @@
5459
],
5560
"provisioners": [
5661
{
62+
"except": "file",
5763
"extra_arguments": [
5864
"-e",
5965
"ansible_winrm_server_cert_validation=ignore",
@@ -70,12 +76,14 @@
7076
"user": "Administrator"
7177
},
7278
{
79+
"except": "file",
7380
"restart_timeout": "10m",
7481
"type": "windows-restart"
7582
},
7683
{
7784
"arch": "{{user `goss_arch`}}",
7885
"download_path": "{{user `goss_download_path`}}",
86+
"except": "file",
7987
"format": "{{user `goss_format`}}",
8088
"format_options": "{{user `goss_format_options`}}",
8189
"goss_file": "{{user `goss_entry_file`}}",
@@ -91,7 +99,8 @@
9199
"url": "{{user `goss_url`}}",
92100
"use_sudo": false,
93101
"vars_env": {
94-
"GOSS_MAX_CONCURRENT": "1"
102+
"GOSS_MAX_CONCURRENT": "1",
103+
"GOSS_USE_ALPHA": "1"
95104
},
96105
"vars_file": "{{user `goss_vars_file`}}",
97106
"vars_inline": {
@@ -107,6 +116,7 @@
107116
"version": "{{user `goss_version`}}"
108117
},
109118
{
119+
"except": "file",
110120
"inline": [
111121
"rm -Force -Recurse C:\\var\\log\\kubelet\\*"
112122
],
@@ -155,6 +165,7 @@
155165
"nutanix_subnet_name": "{{env `NUTANIX_SUBNET_NAME`}}",
156166
"nutanix_username": "{{env `NUTANIX_USERNAME`}}",
157167
"scp_extra_vars": "",
158-
"vm_force_delete": "false"
168+
"vm_force_delete": "false",
169+
"windows_admin_password": "{{env `WINDOWS_ADMIN_PASSWORD`}}"
159170
}
160171
}

images/capi/packer/nutanix/windows-2022.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"runtime": "containerd",
77
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
88
"source_image_name": "en-us_windows_server_2022_x64_dvd_620d7eac",
9-
"virtio_image_name": "Nutanix-VirtIO-1.2.1"
9+
"virtio_image_name": "Nutanix-VirtIO-1.2.5"
1010
}

0 commit comments

Comments
 (0)