-
Notifications
You must be signed in to change notification settings - Fork 486
Add Ubuntu 18.04 QEMU image for Cluster API #169
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Building Images for OpenStack | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| The `make deps-qemu` target will test that Ansible and Packer are installed and available. If they are not, they will be installed to `images/capi/.bin`. This directory will need to be added to your `$PATH`. | ||
|
|
||
| ### Hypervisor | ||
|
|
||
| The image is built using KVM hypervisor. | ||
|
|
||
| ### Prerequisites for all images | ||
|
|
||
| - [Packer](https://www.packer.io/intro/getting-started/install.html) | ||
| - [Ansible](http://docs.ansible.com/ansible/latest/intro_installation.html) version >= 2.8.0 | ||
|
|
||
| ## Building Images | ||
|
|
||
| ### Building QCOW2 Image | ||
|
|
||
| From the `images/capi` directory, run `make build-qemu-ubuntu-1804`. The image is built and located in `images/capi/output/BUILD_NAME+kube-KUBERNETES_VERSION`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright 2020 The Kubernetes Authors. | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
|
|
||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| --- | ||
| - name: Install cloud-init packages | ||
| apt: | ||
| name: "{{ packages }}" | ||
| state: present | ||
| force_apt_get: yes | ||
| vars: | ||
| packages: | ||
| - cloud-init | ||
| - cloud-guest-utils | ||
| - cloud-initramfs-copymods | ||
| - cloud-initramfs-dyn-netconf | ||
| - cloud-initramfs-growroot | ||
| when: ansible_os_family == "Debian" | ||
|
|
||
| - name: Install cloud-init packages | ||
| yum: | ||
| name: "{{ packages }}" | ||
| state: present | ||
| vars: | ||
| packages: | ||
| - cloud-init | ||
| - cloud-utils-growpart | ||
| when: ansible_os_family == "RedHat" | ||
|
|
||
| #- name: Unlock password | ||
| # replace: | ||
| # path: /etc/cloud/cloud.cfg | ||
| # regexp: '(?i)lock_passwd: True' | ||
| # replace: 'lock_passwd: False' | ||
|
|
||
| - name: Symlink /usr/libexec/cloud-init to /usr/lib/cloud-init | ||
| file: | ||
| src: /usr/libexec/cloud-init | ||
| dest: /usr/lib/cloud-init | ||
| state: link | ||
| when: ansible_os_family == "RedHat" | ||
|
|
||
| - name: Disable Hyper-V KVP protocol daemon on Ubuntu | ||
|
Contributor
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. I also meant to ask if this was something you wanted to keep. In the VMW provider, it made sense because it 1) worked around an Ubuntu kernel bug that made startup times increase by a bunch and 2) wasn't necessary since it would be running on an ESXi hypervisor rather than Hyper-V. For a QEMU image, do you know that you'd never be running on Hyper-V?
Contributor
Author
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. Thanks for explaining why Hyper-V KVP protocol daemon is disabled. I am not sure QEMU image is "NEVER" used on Hyper-V, but typically if we want to use existing image, convert QEMU image to VHD and use it on Hyper-V. |
||
| systemd: | ||
| name: hv-kvp-daemon | ||
| state: stopped | ||
| enabled: false | ||
| when: ansible_os_family == "Debian" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../ova/linux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| { | ||
| "variables": { | ||
| "ansible_common_vars": "", | ||
| "ansible_extra_vars": "", | ||
| "boot_wait": "10s", | ||
| "build_timestamp": "{{timestamp}}", | ||
| "containerd_version": null, | ||
| "containerd_sha256": null, | ||
| "containerd_url": "https://storage.googleapis.com/cri-containerd-release/cri-containerd-{{user `containerd_version`}}.linux-amd64.tar.gz", | ||
| "existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}", | ||
| "extra_debs": "", | ||
| "extra_repos": "", | ||
| "extra_rpms": "", | ||
| "accelerator": "kvm", | ||
| "cpus": "1", | ||
| "disk_size": "20480", | ||
| "memory": "2048", | ||
| "format": "qcow2", | ||
| "headless": "true", | ||
| "kubernetes_cni_deb_version": null, | ||
| "kubernetes_cni_semver": null, | ||
| "kubernetes_cni_source_type": null, | ||
| "kubernetes_cni_http_source": null, | ||
| "kubernetes_series": null, | ||
| "kubernetes_semver": null, | ||
| "kubernetes_source_type": null, | ||
| "kubernetes_http_source": null, | ||
| "kubernetes_rpm_version": null, | ||
| "kubernetes_deb_version": null, | ||
| "kubernetes_rpm_repo": null, | ||
| "kubernetes_rpm_gpg_key": null, | ||
| "kubernetes_deb_repo": null, | ||
| "kubernetes_deb_gpg_key": null, | ||
| "kubernetes_rpm_gpg_check": null, | ||
| "kubernetes_container_registry": null, | ||
| "output_directory": "./output/{{user `build_name`}}-kube-{{user `kubernetes_semver`}}", | ||
| "reenable_public_repos": "true", | ||
| "remove_extra_repos": "false", | ||
| "qemu_binary": "qemu-system-x86_64", | ||
| "ssh_password": "builder", | ||
| "ssh_username": "builder" | ||
| }, | ||
| "builders": [ | ||
| { | ||
| "name": "{{ user `build_name`}}", | ||
| "vm_name": "{{user `build_name`}}-kube-{{user `kubernetes_semver`}}", | ||
| "output_directory": "{{user `output_directory`}}", | ||
| "type": "qemu", | ||
| "accelerator": "{{user `accelerator`}}", | ||
| "cpus": "{{user `cpus`}}", | ||
| "disk_size": "{{user `disk_size`}}", | ||
| "memory": "{{user `memory`}}", | ||
| "boot_wait": "{{user `boot_wait`}}", | ||
| "disk_interface": "virtio-scsi", | ||
| "format": "{{user `format`}}", | ||
| "headless": "{{user `headless`}}", | ||
| "http_directory": "./packer/qemu/linux/{{user `distro_name`}}/http/", | ||
| "iso_checksum": "{{user `iso_checksum`}}", | ||
| "iso_checksum_type": "{{user `iso_checksum_type`}}", | ||
| "iso_url": "{{user `iso_url`}}", | ||
| "boot_command": [ | ||
| "{{user `boot_command_prefix`}}", | ||
| "http://{{ .HTTPIP }}:{{ .HTTPPort }}", | ||
| "{{user `boot_command_suffix`}}" | ||
| ], | ||
| "net_device": "virtio-net", | ||
| "qemu_binary": "{{user `qemu_binary`}}", | ||
| "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S -E sh -c 'usermod -L {{user `ssh_username`}} && {{user `shutdown_command`}}'", | ||
| "ssh_password": "{{user `ssh_password`}}", | ||
| "ssh_username": "{{user `ssh_username`}}", | ||
| "ssh_timeout": "2h" | ||
| } | ||
| ], | ||
| "provisioners": [ | ||
| { | ||
| "type": "ansible", | ||
| "playbook_file": "./ansible/playbook.yml", | ||
| "ansible_env_vars": [ | ||
| "ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} -o IdentitiesOnly=yes'", | ||
| "ANSIBLE_REMOTE_TEMP='/tmp/.ansible/'" | ||
| ], | ||
| "extra_arguments": [ | ||
| "--extra-vars", | ||
| "{{user `ansible_common_vars`}}", | ||
| "--extra-vars", | ||
| "{{user `ansible_extra_vars`}}" | ||
| ] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "build_name": "ubuntu-1804", | ||
| "distro_name": "ubuntu", | ||
| "os_display_name": "Ubuntu 18.04", | ||
| "guest_os_type": "ubuntu-64", | ||
| "iso_url": "http://old-releases.ubuntu.com/releases/18.04.2/ubuntu-18.04.2-server-amd64.iso", | ||
| "iso_checksum": "a2cb36dc010d98ad9253ea5ad5a07fd6b409e3412c48f1860536970b073c98f5", | ||
| "iso_checksum_type": "sha256", | ||
| "boot_command_prefix": "<esc><wait><esc><wait><enter><wait>/install/vmlinuz auto console-setup/ask_detect=false console-setup/layoutcode=us console-setup/modelcode=pc105 debconf/frontend=noninteractive debian-installer=en_US fb=false initrd=/install/initrd.gz kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US netcfg/get_domain=local netcfg/get_hostname=localhost grub-installer/bootdev=/dev/sda preseed/url=", | ||
| "boot_command_suffix": "/18.04/preseed.cfg -- <wait><enter><wait>", | ||
| "shutdown_command": "shutdown -P now" | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.