Sync from SUSE:ALP:Source:Standard:1.0 kubevirt revision 15de2c8b5e85ad856a7f585528b325f4

This commit is contained in:
Adrian Schröter 2024-02-21 14:05:42 +01:00
commit 762ce1bb2e
11 changed files with 2381 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,29 @@
From aa6647c263408bdf0518d74da2d4c37d3bb42de0 Mon Sep 17 00:00:00 2001
From: Vasiliy Ulyanov <vulyanov@suse.de>
Date: Wed, 13 Dec 2023 08:10:37 +0100
Subject: [PATCH] tests: Adapt VM phase expectation
When CDI uses volume populators with malformed DataVolume, the VM
initially transitions to Scheduling phase.
Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
---
tests/storage/datavolume.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/storage/datavolume.go b/tests/storage/datavolume.go
index 46677257d..9d86d0eac 100644
--- a/tests/storage/datavolume.go
+++ b/tests/storage/datavolume.go
@@ -536,7 +536,7 @@ var _ = SIGDescribe("DataVolume Integration", func() {
vm, err = virtClient.VirtualMachine(vm.Namespace).Create(context.Background(), vm)
Expect(err).ToNot(HaveOccurred())
- Eventually(ThisVMIWith(vm.Namespace, vm.Name), 100).Should(BeInPhase(v1.Pending))
+ Eventually(ThisVMIWith(vm.Namespace, vm.Name), 100).Should(Or(BeInPhase(v1.Pending), BeInPhase(v1.Scheduling)))
By("Creating a service which makes the registry reachable")
_, err = virtClient.CoreV1().Services(vm.Namespace).Create(context.Background(), &k8sv1.Service{
--
2.43.0

8
_constraints Normal file
View File

@ -0,0 +1,8 @@
<constraints>
<!-- Kubevirt needs larger disk for builds -->
<hardware>
<disk>
<size unit="G">10</size>
</disk>
</hardware>
</constraints>

18
_service Normal file
View File

@ -0,0 +1,18 @@
<services>
<service name="tar_scm" mode="manual">
<param name="filename">kubevirt</param>
<param name="revision">v1.1.1</param>
<param name="scm">git</param>
<param name="submodules">disable</param>
<param name="url">https://github.com/kubevirt/kubevirt</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">[v]?([^\+]+)(.*)</param>
<param name="versionrewrite-replacement">\1</param>
</service>
<service name="recompress" mode="manual">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="manual"/>
<service name="download_files" mode="manual"/>
</services>

View File

@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: disks-images-provider
namespace: kubevirt
labels:
kubevirt.io: "disks-images-provider"
spec:
selector:
matchLabels:
kubevirt.io: "disks-images-provider"
template:
metadata:
labels:
name: disks-images-provider
kubevirt.io: disks-images-provider
name: disks-images-provider
spec:
tolerations:
- key: CriticalAddonsOnly
operator: Exists
serviceAccountName: kubevirt-testing
containers:
- name: target
image: quay.io/kubevirt/disks-images-provider:v1.1.1
imagePullPolicy: Always
lifecycle:
preStop:
exec:
command: ["/bin/sh","-c","source /etc/bashrc && chroot /host umount ${LOOP_DEVICE_HP} && chroot /host losetup -d ${LOOP_DEVICE_HP}"]
volumeMounts:
- name: images
mountPath: /hostImages
- name: local-storage
mountPath: /local-storage
- name: host-dir
mountPath: /host
mountPropagation: Bidirectional
securityContext:
privileged: true
readinessProbe:
exec:
command:
- cat
- /ready
initialDelaySeconds: 10
periodSeconds: 5
volumes:
- name: images
hostPath:
path: /tmp/hostImages
type: DirectoryOrCreate
- name: local-storage
hostPath:
path: /mnt/local-storage
type: DirectoryOrCreate
- name: host-dir
hostPath:
path: /

BIN
kubevirt-1.1.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

1
kubevirt-rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter("statically-linked-binary")

1823
kubevirt.changes Normal file

File diff suppressed because it is too large Load Diff

388
kubevirt.spec Normal file
View File

@ -0,0 +1,388 @@
#
# spec file for package kubevirt
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?sle_version} && !0%{?is_opensuse}
# SLE
%define _exclusive_arch x86_64
%else
%if 0%{?suse_version} == 1600
# ALP
%define _exclusive_arch x86_64
%else
# TW
%define _exclusive_arch x86_64 aarch64
%endif
%endif
Name: kubevirt
Version: 1.1.1
Release: 0
Summary: Container native virtualization
License: Apache-2.0
Group: System/Packages
URL: https://github.com/kubevirt/kubevirt
Source0: %{name}-%{version}.tar.gz
Source1: kubevirt_containers_meta
Source2: kubevirt_containers_meta.service
Source3: %{url}/releases/download/v%{version}/disks-images-provider.yaml
Source100: %{name}-rpmlintrc
Patch1: 0001-tests-Adapt-VM-phase-expectation.patch
BuildRequires: glibc-devel-static
BuildRequires: golang-packaging
BuildRequires: pkgconfig
BuildRequires: rsync
BuildRequires: sed
BuildRequires: golang(API) >= 1.19
BuildRequires: pkgconfig(libvirt)
ExclusiveArch: %{_exclusive_arch}
%description
Kubevirt is a virtual machine management add-on for Kubernetes
%package virtctl
Summary: Client for managing kubevirt
Group: System/Packages
%description virtctl
The virtctl client is a command-line utility for managing container native virtualization resources
%package virt-api
Summary: Kubevirt API server
Group: System/Packages
%description virt-api
The virt-api package provides the kubernetes API extension for kubevirt
%package container-disk
Summary: Container disk for kubevirt
Group: System/Packages
%description container-disk
The containter-disk package provides a container disk functionality for kubevirt
%package virt-controller
Summary: Controller for kubevirt
Group: System/Packages
%description virt-controller
The virt-controller package provides a controller for kubevirt
%package virt-exportproxy
Summary: Export proxy for kubevirt
Group: System/Packages
%description virt-exportproxy
The virt-exportproxy package provides a proxy for kubevirt to pass
requests to virt-exportserver
%package virt-exportserver
Summary: Export server for kubevirt
Group: System/Packages
%description virt-exportserver
The virt-exportserver package provides an http server for kubevirt to
serve the data of VirtualMachineExport resource in different formats
%package virt-handler
Summary: Handler component for kubevirt
Group: System/Packages
%description virt-handler
The virt-handler package provides a handler for kubevirt
%package virt-launcher
Summary: Launcher component for kubevirt
Group: System/Packages
# Starting from v1.1.0, KubeVirt ships /usr/bin/virt-tail which conflicts with
# the respective guestfs tool.
Conflicts: guestfs-tools
%description virt-launcher
The virt-launcher package provides a launcher for kubevirt
%package virt-operator
Summary: Operator component for kubevirt
Group: System/Packages
%description virt-operator
The virt-opertor package provides an operator for kubevirt CRD
%package pr-helper-conf
Summary: Configuration files for persistent reservation helper
Group: System/Packages
%description pr-helper-conf
The pr-helper-conf package provides configuration files for persistent
reservation helper
%package manifests
Summary: YAML manifests used to install kubevirt
Group: System/Packages
%description manifests
This contains the built YAML manifests used to install kubevirt into a
kubernetes installation with kubectl apply.
%package tests
Summary: Kubevirt functional tests
Group: System/Packages
%description tests
The package provides Kubevirt end-to-end tests.
%package -n obs-service-kubevirt_containers_meta
Summary: Kubevirt containers meta information (build service)
Group: System/Packages
%description -n obs-service-kubevirt_containers_meta
The package provides meta information that is used during the build of
the Kubevirt container images.
%prep
%autosetup -p1
%build
# Hackery to determine which registry path to use in kubevirt-operator.yaml
# when building the manifests
#
# The 'kubevirt_registry_path' macro can be used to define an explicit path in
# the project config, e.g.
#
# Macros:
# %kubevirt_registry_path registry.opensuse.org/Virtualization/container
# :Macros
#
# 'kubevirt_registry_path' can also be defined when building locally, e.g.
#
# osc build --define='kubevirt_registry_path registry.opensuse.org/foo/bar/baz' ...
#
# If 'kubevirt_registry_path' is not specified, the standard publish location
# for SLE and openSUSE-based containers is used.
#
distro='%{?sle_version}:%{?is_opensuse}%{!?is_opensuse:0}'
case "${distro}" in
150500:0)
tagprefix=suse/sles/15.5
labelprefix=com.suse.kubevirt
registry=registry.suse.com
;;
150600:0)
tagprefix=suse/sles/15.6
labelprefix=com.suse.kubevirt
registry=registry.suse.com
;;
*:1)
tagprefix=kubevirt
labelprefix=org.opensuse.kubevirt
registry=registry.opensuse.org
;;
*)
%if 0%{?suse_version} == 1600
tagprefix=alp/kubevirt
labelprefix=com.suse.kubevirt
registry=registry.suse.com
%else
echo "Unsupported distro: ${distro}" >&2
exit 1
%endif
;;
esac
%if "%{?kubevirt_registry_path}" == ""
reg_path="${registry}/${tagprefix}"
%else
reg_path='%{kubevirt_registry_path}'
%endif
sed -i"" \
-e "s#_TAGPREFIX_#${tagprefix}#g" \
-e "s#_LABELPREFIX_#${labelprefix}#g" \
-e "s#_REGISTRY_#${registry}#g" \
-e "s#_PKG_VERSION_#%{version}#g" \
-e "s#_PKG_RELEASE_#%{release}#g" \
-e "s#_DISTRO_#${distro}#g" \
%{S:1}
mkdir -p go/src/kubevirt.io go/pkg
ln -s ../../../ go/src/kubevirt.io/kubevirt
export GOPATH=${PWD}/go
export GOFLAGS="-buildmode=pie"
cd ${GOPATH}/src/kubevirt.io/kubevirt
env \
KUBEVIRT_GO_BASE_PKGDIR="${GOPATH}/pkg" \
KUBEVIRT_VERSION=%{version} \
KUBEVIRT_SOURCE_DATE_EPOCH="$(date -r LICENSE +%s)" \
KUBEVIRT_GIT_COMMIT='v%{version}' \
KUBEVIRT_GIT_VERSION='v%{version}' \
KUBEVIRT_GIT_TREE_STATE="clean" \
build_tests="true" \
./hack/build-go.sh install \
cmd/virt-api \
cmd/virt-chroot \
cmd/virt-controller \
cmd/virt-exportproxy \
cmd/virt-exportserver \
cmd/virt-freezer \
cmd/virt-handler \
cmd/virt-launcher \
cmd/virt-launcher-monitor \
cmd/virt-operator \
cmd/virt-probe \
cmd/virt-tail \
cmd/virtctl \
%{nil}
# Note: the generated manifests will point to the images based on SLE15 SP5 BCI.
env \
DOCKER_PREFIX=registry.suse.com/suse/sles/15.5 \
DOCKER_TAG=1.1.1-150500.8.9.1 \
KUBEVIRT_NO_BAZEL=true \
./hack/build-manifests.sh
%install
mkdir -p %{buildroot}%{_bindir}
install -p -m 0755 _out/cmd/container-disk-v2alpha/container-disk %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virtctl/virtctl %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-api/virt-api %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-controller/virt-controller %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-chroot/virt-chroot %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-exportproxy/virt-exportproxy %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-exportserver/virt-exportserver %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-handler/virt-handler %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-launcher/virt-launcher %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-launcher-monitor/virt-launcher-monitor %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-freezer/virt-freezer %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-probe/virt-probe %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-tail/virt-tail %{buildroot}%{_bindir}/
install -p -m 0755 _out/cmd/virt-operator/virt-operator %{buildroot}%{_bindir}/
install -p -m 0755 _out/tests/tests.test %{buildroot}%{_bindir}/virt-tests
install -p -m 0755 cmd/virt-launcher/node-labeller/node-labeller.sh %{buildroot}%{_bindir}/
# Install network stuff
mkdir -p %{buildroot}%{_datadir}/kube-virt/virt-handler
install -p -m 0644 cmd/virt-handler/nsswitch.conf %{buildroot}%{_datadir}/kube-virt/virt-handler/
# virt-launcher SELinux policy needs to land in virt-handler container
install -p -m 0644 cmd/virt-handler/virt_launcher.cil %{buildroot}%{_datadir}/kube-virt/virt-handler/
# Persistent reservation helper configuration files
mkdir -p %{buildroot}%{_datadir}/kube-virt/pr-helper
install -p -m 0644 cmd/pr-helper/multipath.conf %{buildroot}%{_datadir}/kube-virt/pr-helper/
# Install release manifests
mkdir -p %{buildroot}%{_datadir}/kube-virt/manifests/release
install -m 0644 _out/manifests/release/kubevirt-operator.yaml %{buildroot}%{_datadir}/kube-virt/manifests/release/
install -m 0644 _out/manifests/release/kubevirt-cr.yaml %{buildroot}%{_datadir}/kube-virt/manifests/release/
# Install manifests for testing
mkdir -p %{buildroot}%{_datadir}/kube-virt/manifests/testing
install -m 0644 _out/manifests/testing/* %{buildroot}%{_datadir}/kube-virt/manifests/testing/
# The generated disks-images-provider.yaml refers to nonexistent container
# images. Overwrite it with the upstream version for testing.
install -m 0644 %{S:3} %{buildroot}/%{_datadir}/kube-virt/manifests/testing/
install -m 0644 tests/default-config.json %{buildroot}%{_datadir}/kube-virt/manifests/testing/
# Install kubevirt_containers_meta build service
mkdir -p %{buildroot}%{_prefix}/lib/obs/service
install -m 0755 %{S:1} %{buildroot}%{_prefix}/lib/obs/service
install -m 0644 %{S:2} %{buildroot}%{_prefix}/lib/obs/service
%files virtctl
%license LICENSE
%doc README.md
%{_bindir}/virtctl
%files virt-api
%license LICENSE
%doc README.md
%{_bindir}/virt-api
%files container-disk
%license LICENSE
%doc README.md
%{_bindir}/container-disk
%files virt-controller
%license LICENSE
%doc README.md
%{_bindir}/virt-controller
%files virt-exportproxy
%license LICENSE
%doc README.md
%{_bindir}/virt-exportproxy
%files virt-exportserver
%license LICENSE
%doc README.md
%{_bindir}/virt-exportserver
%files virt-handler
%license LICENSE
%doc README.md
%dir %{_datadir}/kube-virt
%dir %{_datadir}/kube-virt/virt-handler
%{_bindir}/virt-handler
%{_bindir}/virt-chroot
%{_datadir}/kube-virt/virt-handler
%files virt-launcher
%license LICENSE
%doc README.md
%{_bindir}/virt-launcher
%{_bindir}/virt-launcher-monitor
%{_bindir}/virt-freezer
%{_bindir}/virt-probe
%{_bindir}/virt-tail
%{_bindir}/node-labeller.sh
%files virt-operator
%license LICENSE
%doc README.md
%{_bindir}/virt-operator
%files pr-helper-conf
%license LICENSE
%doc README.md
%dir %{_datadir}/kube-virt
%dir %{_datadir}/kube-virt/pr-helper
%{_datadir}/kube-virt/pr-helper
%files manifests
%license LICENSE
%doc README.md
%dir %{_datadir}/kube-virt
%dir %{_datadir}/kube-virt/manifests
%{_datadir}/kube-virt/manifests/release
%files tests
%license LICENSE
%doc README.md
%dir %{_datadir}/kube-virt
%dir %{_datadir}/kube-virt/manifests
%{_bindir}/virt-tests
%{_datadir}/kube-virt/manifests/testing
%files -n obs-service-kubevirt_containers_meta
%license LICENSE
%doc README.md
%dir %{_prefix}/lib/obs
%{_prefix}/lib/obs/service
%changelog

24
kubevirt_containers_meta Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash -xe
TAGPREFIX=_TAGPREFIX_
LABELPREFIX=_LABELPREFIX_
REGISTRY=_REGISTRY_
PKG_VERSION=_PKG_VERSION_
PKG_RELEASE=_PKG_RELEASE_
DISTRO=_DISTRO_
# Set HOME=/root as a workaround for
# https://github.com/openSUSE/obs-build/issues/901
_distro=$(HOME=/root rpm --eval '%{?sle_version}:%{?is_opensuse}%{!?is_opensuse:0}')
[ "${DISTRO}" == "${_distro}" ] || exit 1
if [ -n "${pkg}" ]; then
if rpm -q ${pkg}; then
PKG_VERSION=$(rpm -q --queryformat=%{version} ${pkg})
PKG_RELEASE=$(rpm -q --queryformat=%{release} ${pkg})
else
_pkg=$(find ./repos -name "${pkg}*.rpm")
PKG_VERSION=$(rpm -qp --queryformat=%{version} ${_pkg})
PKG_RELEASE=$(rpm -qp --queryformat=%{release} ${_pkg})
fi
fi

View File

@ -0,0 +1,5 @@
<service name="kubevirt_containers_meta">
<summary>Containers meta information for Kubevirt (build service)</summary>
<description>Provides meta information that is used during the build of
the Kubevirt container images.</description>
</service>