generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding virtualbox local build for local environment base box
- Loading branch information
Showing
16 changed files
with
575 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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 @@ | ||
# Building Images for VirtualBox | ||
|
||
## Hypervisor | ||
|
||
The image is built using Oracle VM VirtualBox hypervisor. | ||
|
||
### Installing VirtualBox package | ||
|
||
Oracle VirtualBox install instructions and packages are available at the [official page](https://www.virtualbox.org/wiki/Downloads). | ||
|
||
## Building Images | ||
|
||
### Validating | ||
|
||
The build [prerequisites](../capi.md#prerequisites) for using `image-builder` for | ||
building vbox images are managed by running: | ||
|
||
```bash | ||
cd image-builder/images/capi | ||
make deps-vbox | ||
``` | ||
|
||
### Generating a VirtualBox image | ||
|
||
Only Windows 2019 images are available for VirtualBox hypervisor for now, to build local images | ||
for development are made by running: | ||
|
||
```bash | ||
cd image-builder/images/capi | ||
make build-node-vbox-local-windows-2019 | ||
``` |
This file contains 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 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 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,4 @@ | ||
# See the OWNERS docs at https://go.k8s.io/owners | ||
|
||
approvers: | ||
- cluster-api-vsphere-maintainers |
This file contains 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,33 @@ | ||
{ | ||
"boot_wait": "10s", | ||
"convert_to_template": "false", | ||
"cpu": "4", | ||
"cpu_cores": "1", | ||
"disk_controller_type": "pvscsi", | ||
"disk_thin_provisioned": "true", | ||
"disk_type_id": "0", | ||
"firmware": "bios", | ||
"format": "", | ||
"guestinfo_datasource_ref": "v1.4.0", | ||
"guestinfo_datasource_script": "{{user `guestinfo_datasource_slug`}}/{{user `guestinfo_datasource_ref`}}/install.sh", | ||
"guestinfo_datasource_slug": "https://raw.githubusercontent.com/vmware/cloud-init-vmware-guestinfo", | ||
"headless": "true", | ||
"insecure_connection": "false", | ||
"memory": "8192", | ||
"network": "", | ||
"network_card": "vmxnet3", | ||
"remote_datastore": "", | ||
"remote_host": "", | ||
"remote_password": "", | ||
"remote_type": "", | ||
"remote_username": "", | ||
"skip_compaction": "false", | ||
"ssh_password": "builder", | ||
"ssh_timeout": "60m", | ||
"ssh_username": "builder", | ||
"vmx_version": "15", | ||
"vnc_bind_address": "127.0.0.1", | ||
"vnc_disable_password": "false", | ||
"vnc_port_max": "6000", | ||
"vnc_port_min": "5900" | ||
} |
This file contains 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,130 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"boot_wait": "{{user `boot_wait`}}", | ||
"communicator": "winrm", | ||
"cpus": "{{user `cpu`}}", | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"./packer/vbox/windows/{{user `build_name`}}/autounattend.xml", | ||
"./packer/vbox/windows/disable-network-discovery.cmd", | ||
"./packer/vbox/windows/disable-winrm.ps1", | ||
"./packer/vbox/windows/enable-winrm.ps1", | ||
"./packer/vbox/windows/sysprep.ps1" | ||
], | ||
"guest_additions_mode": "disable", | ||
"guest_os_type": "{{user `local_guest_os_type`}}", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_urls": [ | ||
"{{user `os_iso_url`}}" | ||
], | ||
"memory": "{{user `memory`}}", | ||
"name": "virtualbox-iso", | ||
"output_directory": "{{user `output_dir`}}", | ||
"shutdown_command": "powershell A:/sysprep.ps1", | ||
"shutdown_timeout": "1h", | ||
"type": "virtualbox-iso", | ||
"vm_name": "{{user `build_version`}}", | ||
"winrm_password": "S3cr3t0!", | ||
"winrm_timeout": "4h", | ||
"winrm_username": "Administrator" | ||
} | ||
], | ||
"post-processors": [ | ||
{ | ||
"keep_input_artifact": true, | ||
"output": "./output/windows-2019.box", | ||
"type": "vagrant", | ||
"vagrantfile_template": "./packer/vbox/vagrantfile-windows_2019.template" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"extra_arguments": [ | ||
"-e", | ||
"ansible_winrm_scheme=http", | ||
"--extra-vars", | ||
"{{user `ansible_common_vars`}}", | ||
"--extra-vars", | ||
"{{user `ansible_extra_vars`}}", | ||
"--extra-vars", | ||
"{{user `ansible_user_vars`}}" | ||
], | ||
"playbook_file": "ansible/windows/node_windows.yml", | ||
"type": "ansible", | ||
"use_proxy": false, | ||
"user": "Administrator" | ||
}, | ||
{ | ||
"restart_check_command": "powershell -command \"& {if ((get-content C:\\ProgramData\\lastboot.txt) -eq (Get-WmiObject win32_operatingsystem).LastBootUpTime) {Write-Output 'Sleeping for 600 seconds to wait for reboot'; start-sleep 600} else {Write-Output 'Reboot complete'}}\"", | ||
"restart_command": "powershell \"& {(Get-WmiObject win32_operatingsystem).LastBootUpTime > C:\\ProgramData\\lastboot.txt; Restart-Computer -force}\"", | ||
"type": "windows-restart" | ||
}, | ||
{ | ||
"arch": "{{user `goss_arch`}}", | ||
"download_path": "{{user `goss_download_path`}}", | ||
"format": "{{user `goss_format`}}", | ||
"format_options": "{{user `goss_format_options`}}", | ||
"goss_file": "{{user `goss_entry_file`}}", | ||
"inspect": "{{user `goss_inspect_mode`}}", | ||
"remote_folder": "{{user `goss_remote_folder`}}", | ||
"remote_path": "{{user `goss_remote_path`}}", | ||
"skip_install": "{{user `goss_skip_install`}}", | ||
"target_os": "Windows", | ||
"tests": [ | ||
"{{user `goss_tests_dir`}}" | ||
], | ||
"type": "goss", | ||
"url": "{{user `goss_url`}}", | ||
"use_sudo": false, | ||
"vars_env": { | ||
"GOSS_MAX_CONCURRENT": "1", | ||
"GOSS_USE_ALPHA": "1" | ||
}, | ||
"vars_file": "{{user `goss_vars_file`}}", | ||
"vars_inline": { | ||
"OS": "{{user `distro_name` | lower}}", | ||
"PROVIDER": "ova", | ||
"containerd_version": "{{user `containerd_version`}}", | ||
"distribution_version": "{{user `distro_version`}}", | ||
"docker_ee_version": "{{user `docker_ee_version`}}", | ||
"kubernetes_version": "{{user `kubernetes_semver`}}", | ||
"pause_image": "{{user `pause_image`}}", | ||
"runtime": "{{user `runtime`}}" | ||
}, | ||
"version": "{{user `goss_version`}}" | ||
} | ||
], | ||
"variables": { | ||
"additional_debug_files": null, | ||
"ansible_common_vars": "", | ||
"ansible_extra_vars": "", | ||
"ansible_user_vars": "", | ||
"build_name": null, | ||
"build_timestamp": "{{timestamp}}", | ||
"build_version": "{{user `build_name`}}-kube-{{user `kubernetes_semver`}}", | ||
"cloudbase_init_url": "https://github.com/cloudbase/cloudbase-init/releases/download/{{user `cloudbase_init_version`}}/CloudbaseInitSetup_{{user `cloudbase_init_version` | replace_all `.` `_` }}_x64.msi", | ||
"cloudbase_metadata_services": "cloudbaseinit.metadata.services.vmwareguestinfoservice.VMwareGuestInfoService", | ||
"cloudbase_metadata_services_unattend": "cloudbaseinit.metadata.services.vmwareguestinfoservice.VMwareGuestInfoService", | ||
"cloudbase_plugins": "cloudbaseinit.plugins.common.ephemeraldisk.EphemeralDiskPlugin, cloudbaseinit.plugins.common.mtu.MTUPlugin, cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin, cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin, cloudbaseinit.plugins.common.userdata.UserDataPlugin, cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin, cloudbaseinit.plugins.windows.createuser.CreateUserPlugin, cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin", | ||
"cloudbase_plugins_unattend": "cloudbaseinit.plugins.common.mtu.MTUPlugin", | ||
"containerd_sha256": null, | ||
"containerd_url": "", | ||
"containerd_version": null, | ||
"disable_hypervisor": null, | ||
"disk_size": "81920", | ||
"ib_version": "{{env `IB_VERSION`}}", | ||
"kubernetes_base_url": "https://kubernetesreleases.blob.core.windows.net/kubernetes/{{user `kubernetes_semver`}}/binaries/node/windows/{{user `kubernetes_goarch`}}", | ||
"kubernetes_http_package_url": "", | ||
"kubernetes_typed_version": "kube-{{user `kubernetes_semver`}}", | ||
"manifest_output": "manifest.json", | ||
"netbios_host_name_compatibility": null, | ||
"nssm_url": null, | ||
"output_dir": "./output/{{user `build_version`}}", | ||
"prepull": null, | ||
"windows_service_manager": null, | ||
"windows_updates_categories": null, | ||
"windows_updates_kbs": null, | ||
"wins_url": "https://github.com/rancher/wins/releases/download/v{{user `wins_version`}}/wins.exe" | ||
} | ||
} |
This file contains 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,28 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.require_version ">= 1.6.2" | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.define "vagrant-windows-2019" | ||
config.vm.box = "windows_2019" | ||
config.vm.communicator = "winrm" | ||
|
||
# Admin user name and password | ||
config.winrm.username = "Administrator" | ||
config.winrm.password = "S3cr3t0!" | ||
|
||
config.vm.guest = :windows | ||
config.windows.halt_timeout = 15 | ||
|
||
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true | ||
|
||
config.vm.provider :virtualbox do |v, override| | ||
#v.gui = true | ||
v.customize ["modifyvm", :id, "--memory", 2048] | ||
v.customize ["modifyvm", :id, "--cpus", 2] | ||
v.customize ["modifyvm", :id, "--vram", 128] | ||
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"] | ||
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ] | ||
end | ||
end |
This file contains 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,11 @@ | ||
{ | ||
"build_name": "windows-2019", | ||
"distro_arch": "amd64", | ||
"distro_name": "windows", | ||
"distro_version": "2019", | ||
"guest_os_type": "Windows2019Server-64", | ||
"iso_checksum": "none", | ||
"local_guest_os_type": "windows9srv-64", | ||
"os_display_name": "Windows Server 2019", | ||
"os_iso_url": "file:/path/en_windows_server_2019_x64_dvd_4cb967d8.iso" | ||
} |
Oops, something went wrong.