Test dependencies
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
2023-02-22 21:24:42 +01:00
commit f2b0a5e7c7
429 changed files with 20330 additions and 0 deletions

8
packer/raw/OWNERS Normal file
View File

@ -0,0 +1,8 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- image-builder-raw-maintainers
reviewers:
- image-builder-raw-maintainers
- image-builder-raw-reviewers

View File

@ -0,0 +1,15 @@
# Copyright 2019 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.
d-i preseed/include string ../base/preseed.cfg

View File

@ -0,0 +1,15 @@
# Copyright 2021 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.
d-i preseed/include string ../base/preseed-efi.cfg

View File

@ -0,0 +1,15 @@
# Copyright 2019 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.
d-i preseed/include string ../base/preseed.cfg

View File

@ -0,0 +1,128 @@
# Copyright 2021 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.
# Configure the locale
d-i debian-installer/locale string en_US.utf8
d-i console-setup/ask_detect boolean false
d-i console-setup/layout string us
# Configure the clock
d-i time/zone string UTC
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
# Configure the keyboard
d-i kbd-chooser/method select American English
# Configure networking
d-i netcfg/wireless_wep string
# Select the kernel
d-i base-installer/kernel/override-image string linux-server
# Configure a non-interactive install
debconf debconf/frontend select Noninteractive
# Configure the base installation
d-i pkgsel/install-language-support boolean false
d-i pkgsel/language-packs multiselect
tasksel tasksel/first multiselect # standard, ubuntu-server
### Simple GPT configuration w/o LVM
d-i partman-auto/disk string /dev/sda
d-i partman/alignment string cylinder
d-i partman/confirm_write_new_label boolean true
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select gpt-boot-root-swap
d-i partman-auto/expert_recipe string \
gpt-boot-root-swap :: \
1 1 1 free \
$bios_boot{ } \
method{ biosgrub } . \
200 200 200 fat32 \
$primary{ } \
method{ efi } format{ } . \
# 512 512 512 ext3 \
# $primary{ } $bootable{ } \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ /boot } . \
512 20000 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } .
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Create the default user.
d-i passwd/user-fullname string builder
d-i passwd/username string builder
d-i passwd/user-password password builder
d-i passwd/user-password-again password builder
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
# Disable upgrading packages upon installation.
d-i pkgsel/upgrade select none
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
d-i pkgsel/update-policy select none
# Disable use of the apt mirror during base install
# This means only packages available in the ISO can be installed
d-i apt-setup/use_mirror boolean false
# Disable the security repo as well (it's on by default)
d-i apt-setup/services-select multiselect none
# Customize the list of packages installed.
d-i pkgsel/include string openssh-server
# Ensure questions about these packages do not bother the installer.
libssl1.1 libssl1.1/restart-without-asking boolean true
libssl1.1:amd64 libssl1.1/restart-without-asking boolean true
libssl1.1 libssl1.1/restart-services string
libssl1.1:amd64 libssl1.1/restart-services string
# This command runs after all other steps; it:
# 1. Ensures the "builder" user doesn't require a password to use sudo
# 2. Cleans up any packages that are no longer required
# 3. Cleans the package cache
# 4. Removes the cached list of packages
# 5. Disables swapfiles
# 6. Removes the existing swapfile
# 7. Removes the swapfile entry from /etc/fstab
d-i preseed/late_command string \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >/target/etc/sudoers.d/builder ; \
in-target chmod 440 /etc/sudoers.d/builder ; \
in-target swapoff -a ; \
in-target rm -f /swapfile ; \
in-target sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab ; \
in-target rm -f /etc/udev/rules.d/70-persistent-net.rules

View File

@ -0,0 +1,126 @@
# Copyright 2019 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.
# Configure the locale
d-i debian-installer/locale string en_US.utf8
d-i debian-installer/add-kernel-opts console=ttyS0
d-i console-setup/ask_detect boolean false
d-i console-setup/layout string us
# Configure the clock
d-i time/zone string UTC
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
# Configure the keyboard
d-i kbd-chooser/method select American English
# Configure networking
d-i netcfg/wireless_wep string
# Select the kernel
d-i base-installer/kernel/override-image string linux-server
# Configure a non-interactive install
debconf debconf/frontend select Noninteractive
# Configure the base installation
d-i pkgsel/install-language-support boolean false
d-i pkgsel/language-packs multiselect
tasksel tasksel/first multiselect # standard, ubuntu-server
# Create a single-partition with no swap space. For more information
# on how partitioning is configured, please refer to
# https://github.com/xobs/debian-installer/blob/master/doc/devel/partman-auto-recipe.txt.
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto-lvm/guided_size string max
# Again, this creates a single-partition with no swap. Kubernetes
# really dislikes the idea of anyone else managing memory.
d-i partman-auto/expert_recipe string \
slash :: \
0 0 -1 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-partitioning/no_bootable_gpt_biosgrub boolean true
d-i partman-partitioning/no_bootable_gpt_efi boolean false
d-i partman-efi/non_efi_system boolean false
# Create the default user.
d-i passwd/user-fullname string builder
d-i passwd/username string builder
d-i passwd/user-password password builder
d-i passwd/user-password-again password builder
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
# Disable upgrading packages upon installation.
d-i pkgsel/upgrade select none
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
d-i pkgsel/update-policy select none
# Disable use of the apt mirror during base install
# This means only packages available in the ISO can be installed
d-i apt-setup/use_mirror boolean false
# Disable the security repo as well (it's on by default)
d-i apt-setup/services-select multiselect none
# Customize the list of packages installed.
d-i pkgsel/include string openssh-server
# Ensure questions about these packages do not bother the installer.
libssl1.1 libssl1.1/restart-without-asking boolean true
libssl1.1:amd64 libssl1.1/restart-without-asking boolean true
libssl1.1 libssl1.1/restart-services string
libssl1.1:amd64 libssl1.1/restart-services string
# This command runs after all other steps; it:
# 1. Ensures the "builder" user doesn't require a password to use sudo
# 2. Cleans up any packages that are no longer required
# 3. Cleans the package cache
# 4. Removes the cached list of packages
# 5. Disables swapfiles
# 6. Removes the existing swapfile
# 7. Removes the swapfile entry from /etc/fstab
d-i preseed/late_command string \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >/target/etc/sudoers.d/builder ; \
in-target chmod 440 /etc/sudoers.d/builder ; \
in-target swapoff -a ; \
in-target rm -f /swapfile ; \
in-target sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab ; \
in-target rm -f /etc/udev/rules.d/70-persistent-net.rules

179
packer/raw/packer.json Normal file
View File

@ -0,0 +1,179 @@
{
"builders": [
{
"accelerator": "{{user `accelerator`}}",
"boot_command": [
"{{user `boot_command_prefix`}}",
"{{user `boot_media_path`}}",
"{{user `boot_command_suffix`}}"
],
"boot_wait": "{{user `boot_wait`}}",
"cpus": "{{user `cpus`}}",
"disk_compression": "{{ user `disk_compression`}}",
"disk_discard": "{{user `disk_discard`}}",
"disk_interface": "virtio-scsi",
"disk_size": "{{user `disk_size`}}",
"firmware": "{{user `firmware`}}",
"format": "{{user `format`}}",
"headless": "{{user `headless`}}",
"http_directory": "{{user `http_directory`}}",
"iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
"iso_url": "{{user `iso_url`}}",
"memory": "{{user `memory`}}",
"net_device": "virtio-net",
"output_directory": "{{user `output_directory`}}",
"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_timeout": "2h",
"ssh_username": "{{user `ssh_username`}}",
"type": "qemu",
"vm_name": "{{user `build_name`}}-kube-{{user `kubernetes_semver`}}"
}
],
"post-processors": [
{
"output": "./output/{{user `build_name`}}-kube-{{user `kubernetes_semver`}}.gz",
"type": "compress"
},
{
"environment_vars": [
"CUSTOM_POST_PROCESSOR={{user `custom_post_processor`}}"
],
"inline": [
"if [ \"$CUSTOM_POST_PROCESSOR\" != \"true\" ]; then exit 0; fi",
"{{user `custom_post_processor_command`}}"
],
"name": "custom-post-processor",
"type": "shell-local"
}
],
"provisioners": [
{
"execute_command": "BUILD_NAME={{user `build_name`}}; if [[ \"${BUILD_NAME}\" == *\"flatcar\"* ]]; then sudo {{.Vars}} -S -E bash '{{.Path}}'; fi",
"script": "./packer/files/flatcar/scripts/bootstrap-flatcar.sh",
"type": "shell"
},
{
"ansible_env_vars": [
"ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
],
"extra_arguments": [
"--extra-vars",
"{{user `ansible_common_vars`}}",
"--extra-vars",
"{{user `ansible_extra_vars`}}",
"--extra-vars",
"{{user `ansible_user_vars`}}",
"--scp-extra-args",
"{{user `ansible_scp_extra_args`}}"
],
"playbook_file": "./ansible/firstboot.yml",
"type": "ansible",
"user": "builder"
},
{
"expect_disconnect": true,
"inline": [
"sudo reboot now"
],
"inline_shebang": "/bin/bash -e",
"type": "shell"
},
{
"ansible_env_vars": [
"ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} -o IdentitiesOnly=yes'"
],
"extra_arguments": [
"--extra-vars",
"{{user `ansible_common_vars`}}",
"--extra-vars",
"{{user `ansible_extra_vars`}}",
"--extra-vars",
"{{user `ansible_user_vars`}}",
"--scp-extra-args",
"{{user `ansible_scp_extra_args`}}"
],
"playbook_file": "./ansible/node.yml",
"type": "ansible",
"user": "builder"
},
{
"arch": "{{user `goss_arch`}}",
"format": "{{user `goss_format`}}",
"format_options": "{{user `goss_format_options`}}",
"goss_file": "{{user `goss_entry_file`}}",
"inspect": "{{user `goss_inspect_mode`}}",
"tests": [
"{{user `goss_tests_dir`}}"
],
"type": "goss",
"url": "{{user `goss_url`}}",
"use_sudo": true,
"vars_file": "{{user `goss_vars_file`}}",
"vars_inline": {
"ARCH": "amd64",
"OS": "{{user `distro_name` | lower}}",
"PROVIDER": "raw",
"containerd_version": "{{user `containerd_version`}}",
"kubernetes_cni_deb_version": "{{ user `kubernetes_cni_deb_version` }}",
"kubernetes_cni_rpm_version": "{{ split (user `kubernetes_cni_rpm_version`) \"-\" 0 }}",
"kubernetes_cni_source_type": "{{user `kubernetes_cni_source_type`}}",
"kubernetes_cni_version": "{{user `kubernetes_cni_semver` | replace \"v\" \"\" 1}}",
"kubernetes_deb_version": "{{ user `kubernetes_deb_version` }}",
"kubernetes_rpm_version": "{{ split (user `kubernetes_rpm_version`) \"-\" 0 }}",
"kubernetes_source_type": "{{user `kubernetes_source_type`}}",
"kubernetes_version": "{{user `kubernetes_semver` | replace \"v\" \"\" 1}}"
},
"version": "{{user `goss_version`}}"
}
],
"variables": {
"accelerator": "kvm",
"ansible_common_vars": "",
"ansible_extra_vars": "ansible_python_interpreter=/usr/bin/python3",
"ansible_scp_extra_args": "",
"ansible_user_vars": "",
"boot_media_path": "http://{{ .HTTPIP }}:{{ .HTTPPort }}",
"boot_wait": "10s",
"build_timestamp": "{{timestamp}}",
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_version": null,
"cpus": "1",
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"crictl_version": null,
"disk_compression": "false",
"disk_discard": "unmap",
"disk_size": "6144",
"existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
"firmware": "",
"format": "raw",
"headless": "true",
"http_directory": "./packer/raw/linux/{{user `distro_name`}}/http/",
"kubernetes_cni_deb_version": null,
"kubernetes_cni_http_source": null,
"kubernetes_cni_semver": null,
"kubernetes_cni_source_type": null,
"kubernetes_container_registry": null,
"kubernetes_deb_gpg_key": null,
"kubernetes_deb_repo": null,
"kubernetes_deb_version": null,
"kubernetes_http_source": null,
"kubernetes_load_additional_imgs": null,
"kubernetes_rpm_gpg_check": null,
"kubernetes_rpm_gpg_key": null,
"kubernetes_rpm_repo": null,
"kubernetes_rpm_version": null,
"kubernetes_semver": null,
"kubernetes_series": null,
"kubernetes_source_type": null,
"machine_id_mode": "444",
"memory": "2048",
"output_directory": "./output/{{user `build_name`}}-kube-{{user `kubernetes_semver`}}",
"python_path": "",
"qemu_binary": "qemu-system-x86_64",
"ssh_password": "builder",
"ssh_username": "builder"
}
}

View File

@ -0,0 +1,24 @@
{
"ansible_extra_vars": "ansible_python_interpreter=/opt/bin/python",
"boot_command_prefix": "sudo systemctl mask sshd.socket --now<enter>curl -sLo /tmp/ignition.json ",
"boot_command_suffix": "/bootstrap.json<enter>sed -i \"s|BUILDERPASSWORDHASH|$(mkpasswd -5 {{user `ssh_password`}})|\" /tmp/ignition.json<enter>sudo flatcar-install -d /dev/sda -C {{user `channel_name`}} -V {{user `release_version`}} -i /tmp/ignition.json<enter>sudo reboot<enter>",
"boot_wait": "120s",
"build_name": "flatcar-{{env `FLATCAR_CHANNEL`}}-{{env `FLATCAR_VERSION`}}",
"channel_name": "{{env `FLATCAR_CHANNEL`}}",
"crictl_source_type": "http",
"distro_name": "flatcar",
"guest_os_type": "linux-64",
"http_directory": "./packer/files/flatcar/ignition/",
"iso_checksum": "https://{{env `FLATCAR_CHANNEL`}}.release.flatcar-linux.net/amd64-usr/{{env `FLATCAR_VERSION`}}/flatcar_production_iso_image.iso.DIGESTS.asc",
"iso_checksum_type": "file",
"iso_url": "https://{{env `FLATCAR_CHANNEL`}}.release.flatcar-linux.net/amd64-usr/{{env `FLATCAR_VERSION`}}/flatcar_production_iso_image.iso",
"kubernetes_cni_source_type": "http",
"kubernetes_source_type": "http",
"os_display_name": "Flatcar Container Linux ({{env `FLATCAR_CHANNEL`}} channel release {{env `FLATCAR_VERSION`}})",
"python_path": "/opt/bin/builder-env/site-packages",
"release_version": "{{env `FLATCAR_VERSION`}}",
"shutdown_command": "shutdown -P now",
"systemd_prefix": "/etc/systemd",
"sysusr_prefix": "/opt",
"sysusrlocal_prefix": "/opt"
}

View File

@ -0,0 +1,13 @@
{
"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 -- <enter>",
"build_name": "ubuntu-1804",
"build_target": "raw",
"distro_name": "ubuntu",
"guest_os_type": "ubuntu-64",
"iso_checksum": "f5cbb8104348f0097a8e513b10173a07dbc6684595e331cb06f93f385d0aecf6",
"iso_checksum_type": "sha256",
"iso_url": "http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.6-server-amd64.iso",
"os_display_name": "Ubuntu 18.04",
"shutdown_command": "shutdown -P now"
}

View File

@ -0,0 +1,14 @@
{
"boot_command_prefix": "<esc><wait><esc><wait><enter><wait>linux /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 kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US netcfg/get_domain=local netcfg/get_hostname=localhost preseed/url=",
"boot_command_suffix": "/20.04/preseed-efi.cfg -- <wait><enter>initrd /install/initrd.gz<enter>boot<enter><wait>",
"build_name": "ubuntu-2004",
"build_target": "raw",
"distro_name": "ubuntu",
"firmware": "OVMF.fd",
"guest_os_type": "ubuntu-64",
"iso_checksum": "f11bda2f2caed8f420802b59f382c25160b114ccc665dbac9c5046e7fceaced2",
"iso_checksum_type": "sha256",
"iso_url": "http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04.1-legacy-server-amd64.iso",
"os_display_name": "Ubuntu 20.04",
"shutdown_command": "shutdown -P now"
}

View File

@ -0,0 +1,13 @@
{
"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": "/20.04/preseed.cfg -- <wait><enter><wait>",
"build_name": "ubuntu-2004",
"build_target": "raw",
"distro_name": "ubuntu",
"guest_os_type": "ubuntu-64",
"iso_checksum": "f11bda2f2caed8f420802b59f382c25160b114ccc665dbac9c5046e7fceaced2",
"iso_checksum_type": "sha256",
"iso_url": "http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04.1-legacy-server-amd64.iso",
"os_display_name": "Ubuntu 20.04",
"shutdown_command": "shutdown -P now"
}