This commit is contained in:
havelight-ee
2023-05-30 14:44:26 +09:00
parent 9a3174deef
commit 4c32a7239d
2598 changed files with 164595 additions and 487 deletions

View File

@@ -0,0 +1,2 @@
deploy:
ansible-playbook -i hosts.ini -e docker_password=$(docker_password) cluster.yml

View File

@@ -0,0 +1,8 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- woopstar
- ant31
reviewers:
- woopstar
- ant31

View File

@@ -0,0 +1,5 @@
---
- hosts: image-builder
gather_facts: false
roles:
- kubevirt-images

View File

@@ -0,0 +1,4 @@
image-builder-1 ansible_ssh_host=xxx.xxx.xxx.xxx
[image-builder]
image-builder-1

View File

@@ -0,0 +1,126 @@
---
images_dir: /images/base
docker_user: kubespray+buildvmimages
docker_host: quay.io
registry: quay.io/kubespray
images:
ubuntu-1604:
filename: xenial-server-cloudimg-amd64-disk1.img
url: https://storage.googleapis.com/kubespray-images/ubuntu/xenial-server-cloudimg-amd64-disk1.img
checksum: sha256:c0d099383cd064390b568e20d1c39a9c68ba864764404b70f754a7b1b2f808f7
converted: false
tag: "latest"
ubuntu-1804:
filename: bionic-server-cloudimg-amd64.img
url: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
checksum: sha256:c3d0e03f4245ffaabd7647e6dabf346b944a62b9934d0a89f3a04b4236386af2
converted: false
tag: "latest"
ubuntu-2004:
filename: focal-server-cloudimg-amd64.img
url: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-disk-kvm.img
checksum: sha256:8faf1f5a27c956ad0c49dac3114a355fbaf1b2d21709e10a18e67213fbb95b81
converted: false
tag: "latest"
ubuntu-2204:
filename: jammy-server-cloudimg-amd64.img
url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
checksum: sha256:d3f3f446bf35b2e58b82c10c8fa65525264efe5b0e398238f00ab670f49528ab
converted: false
tag: "latest"
fedora-35:
filename: Fedora-Cloud-Base-35-1.2.x86_64.qcow2
url: https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2
checksum: sha256:fe84502779b3477284a8d4c86731f642ca10dd3984d2b5eccdf82630a9ca2de6
converted: true
tag: "latest"
fedora-36:
filename: Fedora-Cloud-Base-36-1.5.x86_64.qcow2
url: https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.qcow2
checksum: sha256:ca9e514cc2f4a7a0188e7c68af60eb4e573d2e6850cc65b464697223f46b4605
converted: true
tag: "latest"
fedora-coreos:
filename: fedora-coreos-32.20200601.3.0-openstack.x86_64.qcow2.xz
url: https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200601.3.0/x86_64/fedora-coreos-32.20200601.3.0-openstack.x86_64.qcow2.xz
checksum: sha256:fe78c348189d745eb5f6f80ff9eb2af67da8e84880d264f4301faaf7c2a72646
converted: true
tag: "latest"
centos-7:
filename: CentOS-7-x86_64-GenericCloud-2009.qcow2
url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2
checksum: sha256:e38bab0475cc6d004d2e17015969c659e5a308111851b0e2715e84646035bdd3
converted: true
tag: "latest"
centos-8:
filename: CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2
url: http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2
checksum: sha256:7ec97062618dc0a7ebf211864abf63629da1f325578868579ee70c495bed3ba0
converted: true
tag: "latest"
almalinux-8:
filename: AlmaLinux-8-GenericCloud-latest.x86_64.qcow2
url: https://repo.almalinux.org/almalinux/8.5/cloud/x86_64/images/AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2
checksum: sha256:d629247b12802157be127db53a7fcb484b80fceae9896d750c953a51a8c6688f
converted: true
tag: "latest"
rockylinux-8:
filename: Rocky-8-GenericCloud-8.6-20220515.x86_64.qcow2
url: https://download.rockylinux.org/pub/rocky/8.6/images/Rocky-8-GenericCloud-8.6-20220515.x86_64.qcow2
checksum: sha256:77e79f487c70f6bfa5655d8084e02cb8d31900a2c2a22b2334c3401b40a1231c
converted: true
tag: "latest"
rockylinux-9:
filename: Rocky-9-GenericCloud-9.0-20220830.0.x86_64.qcow2
url: https://download.rockylinux.org/pub/rocky/9.0/images/x86_64/Rocky-9-GenericCloud-9.0-20220830.0.x86_64.qcow2
checksum: sha256:f02570e0ad3653df7f56baa8157739dbe92a003234acd5824dcf94d24694e20b
converted: true
tag: "latest"
debian-9:
filename: debian-9-openstack-amd64.qcow2
url: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
checksum: sha256:01d9345ba7a6523d214d2eaabe07fe7b4b69b28e63d7a6b322521e99e5768719
converted: true
tag: "latest"
debian-10:
filename: debian-10-openstack-amd64.qcow2
url: https://cdimage.debian.org/cdimage/openstack/current-10/debian-10-openstack-amd64.qcow2
checksum: sha512:296ad8345cb49e52464a0cb8bf4365eb0b9e4220c47ebdd73d134d51effc756d5554aee15027fffd038fef4ad5fa984c94208bce60572d58b2ab26f74bb2a5de
converted: true
tag: "latest"
debian-11:
filename: debian-11-generic-amd64-20210814-734.qcow2
url: https://cdimage.debian.org/cdimage/cloud/bullseye/20210814-734/debian-11-generic-amd64-20210814-734.qcow2
checksum: sha512:ed680265ce925e3e02336b052bb476883e2d3b023f7b7d39d064d58ba5f1856869f75dca637c27c0303b731d082ff23a7e45ea2e3f9bcb8f3c4ce0c24332885d
converted: true
tag: "latest"
oracle-7:
filename: oracle-linux-76.qcow2
url: https://storage.googleapis.com/born-images/oracle76/oracle-linux-76.qcow2
checksum: sha256:f396c03e907fa2a0c94d6807b9f62622f23ee3499df4456ae2a15da381fbdca5
converted: true
tag: "latest"
opensuse-leap-15:
filename: openSUSE-Leap-15.3.x86_64-1.0.1-NoCloud-Build2.63.qcow2
url: https://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.3/images/openSUSE-Leap-15.3.x86_64-1.0.1-NoCloud-Build2.63.qcow2
checksum: sha256:289248945e2d058551c71c1bdcb31a361cefe7136c7fd88a09b524eedfaf5215
converted: true
tag: "latest"

View File

@@ -0,0 +1,57 @@
---
- name: Create image directory
file:
state: directory
path: "{{ images_dir }}"
mode: 0755
- name: Download images files
get_url:
url: "{{ item.value.url }}"
dest: "{{ images_dir }}/{{ item.value.filename }}"
checksum: "{{ item.value.checksum }}"
loop: "{{ images|dict2items }}"
- name: Unxz compressed images
command: unxz --force {{ images_dir }}/{{ item.value.filename }}
loop: "{{ images|dict2items }}"
when:
- item.value.filename.endswith('.xz')
- name: Convert images which is not in qcow2 format
command: qemu-img convert -O qcow2 {{ images_dir }}/{{ item.value.filename.rstrip('.xz') }} {{ images_dir }}/{{ item.key }}.qcow2
loop: "{{ images|dict2items }}"
when:
- not (item.value.converted|bool)
- name: Make sure all images are ending with qcow2
command: cp {{ images_dir }}/{{ item.value.filename.rstrip('.xz') }} {{ images_dir }}/{{ item.key }}.qcow2
loop: "{{ images|dict2items }}"
when:
- item.value.converted|bool
- name: Resize images # noqa 301
command: qemu-img resize {{ images_dir }}/{{ item.key }}.qcow2 +8G
loop: "{{ images|dict2items }}"
# STEP 2: Include the images inside a container
- name: Template default Dockerfile
template:
src: Dockerfile
dest: "{{ images_dir }}/Dockerfile"
mode: 0644
- name: Create docker images for each OS # noqa 301
command: docker build -t {{ registry }}/vm-{{ item.key }}:{{ item.value.tag }} --build-arg cloud_image="{{ item.key }}.qcow2" {{ images_dir }}
loop: "{{ images|dict2items }}"
- name: docker login # noqa 301
command: docker login -u="{{ docker_user }}" -p="{{ docker_password }}" "{{ docker_host }}"
- name: docker push image # noqa 301
command: docker push {{ registry }}/vm-{{ item.key }}:{{ item.value.tag }}
loop: "{{ images|dict2items }}"
- name: docker logout # noqa 301
command: docker logout -u="{{ docker_user }}" "{{ docker_host }}"

View File

@@ -0,0 +1,6 @@
FROM kubevirt/registry-disk-v1alpha
ARG cloud_image
MAINTAINER "The Kubespray Project" <kubespray@googlegroups.com>
COPY $cloud_image /disk

View File

@@ -0,0 +1,16 @@
# Docker image published at quay.io/kubespray/vagrant
ARG KUBESPRAY_VERSION
FROM quay.io/kubespray/kubespray:${KUBESPRAY_VERSION}
ENV VAGRANT_VERSION=2.2.19
ENV VAGRANT_DEFAULT_PROVIDER=libvirt
ENV VAGRANT_ANSIBLE_TAGS=facts
RUN apt-get update && apt-get install -y wget libvirt-dev openssh-client rsync git
# Install Vagrant
RUN wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb && \
dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb && \
rm vagrant_${VAGRANT_VERSION}_x86_64.deb && \
vagrant plugin install vagrant-libvirt

View File

@@ -0,0 +1,24 @@
# vagrant docker image
This image is used for the vagrant CI jobs. It is using the libvirt driver.
## Usage
```console
$ docker run --net host --rm -it -v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock quay.io/kubespray/vagrant
$ vagrant up
Bringing machine 'k8s-1' up with 'libvirt' provider...
Bringing machine 'k8s-2' up with 'libvirt' provider...
Bringing machine 'k8s-3' up with 'libvirt' provider...
[...]
```
## Cache
You can set `/root/kubespray_cache` as a volume to keep cache between runs.
## Building
```shell
./build.sh v2.12.5
```

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -euo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 tag" >&2
exit 1
fi
VERSION="$1"
IMG="quay.io/kubespray/vagrant:${VERSION}"
docker build . --build-arg "KUBESPRAY_VERSION=${VERSION}" --tag "$IMG"
docker push "$IMG"