-
Notifications
You must be signed in to change notification settings - Fork 8
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
[kubevirtci]: refactor cluster-sync target to work with kubevirtci #85
Open
enp0s3
wants to merge
5
commits into
openshift-virtualization:main
Choose a base branch
from
enp0s3:adapt-ci-to-new-kci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,098
−12
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63a3759
add scripts and target for kubevirtci bump
enp0s3 34e6511
initial from-scratch bump of kubevirtci
enp0s3 3806687
adding false positive for the common.key file in kci
enp0s3 f089024
ci: refactor cluster-up and cluster-down to use kubevirtci
enp0s3 3ce175d
ci: refactor cluster-sync to support kubevirtci
enp0s3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[allowlist] | ||
description = "kubevirtci allowlist" | ||
paths = [ | ||
'''kubevirtci\/cluster-up\/hack\/common.key$''', | ||
] |
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
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 |
---|---|---|
|
@@ -44,5 +44,6 @@ VENDOR_DIR=${WASP_DIR}/vendor | |
ARCHITECTURE="${BUILD_ARCH:-$(uname -m)}" | ||
HOST_ARCHITECTURE="$(uname -m)" | ||
WASP_CRI="$(determine_wasp_bin)" | ||
KUBEVIRT_RELEASE=${KUBEVIRT_RELEASE:-"latest_nightly"} | ||
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. WDYT about changing this the latest_stable i think that it's good enough since wasp is not coupled with kubevirt. |
||
|
||
|
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,10 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
source $(dirname "$0")/config.sh | ||
|
||
val=$(curl -L https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest) | ||
sed -i "/^[[:blank:]]*kubevirtci_git_hash[[:blank:]]*=/s/=.*/=\"${val}\"/" hack/config.sh | ||
|
||
hack/sync-kubevirtci.sh |
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,26 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This file is part of the KubeVirt project | ||
# | ||
# 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. | ||
# | ||
# Copyright 2021 Red Hat, Inc. | ||
# | ||
|
||
set -e | ||
set -x | ||
|
||
source hack/config-kubevirtci.sh | ||
KUBEVIRT_DEPLOY_CDI=${KUBEVIRT_DEPLOY_CDI:-true} | ||
KUBEVIRT_SWAP_ON=${KUBEVIRT_SWAP_ON:-true} | ||
source "${KUBEVIRTCI_PATH}up.sh" |
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,22 @@ | ||
# | ||
# This file is part of the KubeVirt project | ||
# | ||
# 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. | ||
# | ||
# Copyright the KubeVirt Authors. | ||
# | ||
# | ||
|
||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
KUBEVIRTCI_PATH="${BASE_DIR}/kubevirtci/cluster-up/" | ||
KUBEVIRTCI_CONFIG_PATH="${BASE_DIR}/kubevirtci/_ci-configs" |
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 @@ | ||
kubevirtci_git_hash="2412171619-fbd31717" |
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,57 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# Required for kubevirtci_git_hash | ||
source $(dirname "$0")/config.sh | ||
|
||
WASP_DIR="$( | ||
cd "$(dirname "$BASH_SOURCE[0]")/../" | ||
pwd | ||
)" | ||
|
||
# update cluster-up if needed | ||
version_file="kubevirtci/cluster-up/version.txt" | ||
sha_file="kubevirtci/cluster-up-sha.txt" | ||
download_cluster_up=true | ||
function getClusterUpShasum() { | ||
( | ||
cd ${WASP_DIR} | ||
# We use LC_ALL=C to make sort canonical between machines, this is | ||
# from sort man page [1]: | ||
# ``` | ||
# *** WARNING *** The locale specified by the environment affects sort | ||
# order. Set LC_ALL=C to get the traditional sort order that uses | ||
# native byte values. | ||
# ``` | ||
# [1] https://man7.org/linux/man-pages/man1/sort.1.html | ||
find kubevirtci/cluster-up -type f | LC_ALL=C sort | xargs sha1sum | sha1sum | awk '{print $1}' | ||
) | ||
} | ||
|
||
# check if we got a new cluster-up git commit hash | ||
if [[ -f "${version_file}" ]] && [[ $(cat ${version_file}) == ${kubevirtci_git_hash} ]]; then | ||
# check if files are modified | ||
current_sha=$(getClusterUpShasum) | ||
if [[ -f "${sha_file}" ]] && [[ $(cat ${sha_file}) == ${current_sha} ]]; then | ||
echo "cluster-up is up to date and not modified" | ||
download_cluster_up=false | ||
else | ||
echo "cluster-up was modified" | ||
fi | ||
else | ||
echo "cluster-up git commit hash was updated" | ||
fi | ||
if [[ "$download_cluster_up" == true ]]; then | ||
echo "downloading cluster-up" | ||
rm -rf kubevirtci/cluster-up | ||
( | ||
cd kubevirtci | ||
curl --fail -L https://github.com/kubevirt/kubevirtci/archive/refs/tags/${kubevirtci_git_hash}.tar.gz | tar xz kubevirtci-${kubevirtci_git_hash}/cluster-up --strip-component 1 | ||
) | ||
|
||
echo ${kubevirtci_git_hash} >${version_file} | ||
new_sha=$(getClusterUpShasum) | ||
echo ${new_sha} >${sha_file} | ||
echo "KUBEVIRTCI_TAG=${kubevirtci_git_hash}" >>kubevirtci/cluster-up/hack/common.sh | ||
fi |
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 @@ | ||
c8e41b0449bf6b53024d0f1b6eb4f07a7795e9ee |
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 @@ | ||
cluster/kind-k8s-sriov*/certcreator/*.cert |
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,36 @@ | ||
# cluster-up | ||
|
||
## Prerequisites: podman or docker | ||
|
||
cluster-up requires that either podman or docker be installed on the host. | ||
|
||
If podman is being used, it is also necessary to enable podman socket with: | ||
|
||
``` | ||
sudo systemctl enable podman.socket | ||
sudo systemctl start podman.socket | ||
``` | ||
|
||
for more information see: | ||
|
||
https://github.com/kubevirt/kubevirtci/blob/main/PODMAN.md | ||
|
||
|
||
## How to use cluster-up | ||
|
||
This directory provides a wrapper around gocli. It can be vendored into other | ||
git repos and integrated to provide in the kubevirt well-known cluster commands | ||
like `make cluster-up` and `make cluster-down`. | ||
|
||
In order to properly use it, one has to vendor this folder from a git tag, | ||
which can be found on the github release page. | ||
|
||
Then, before calling one of the make targets, the environment variable | ||
`KUBEVIRTCI_TAG` must be exported and set to the tag which was used to vendor | ||
kubevirtci. It allow the content to find the right `gocli` version. | ||
|
||
``` | ||
export KUBEVIRTCI_TAG=`curl -L -Ss https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest` | ||
``` | ||
|
||
Find more kubevirtci tags at https://quay.io/repository/kubevirtci/gocli?tab=tags. |
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,60 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This file is part of the KubeVirt project | ||
# | ||
# 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. | ||
# | ||
# Copyright 2019 Red Hat, Inc. | ||
# | ||
|
||
set -e | ||
if [ ! -c /dev/kvm ]; then | ||
echo "[ERR ] missing /dev/kvm" | ||
else | ||
echo "[ OK ] found /dev/kvm" | ||
fi | ||
|
||
KVM_ARCH="" | ||
KVM_NESTED="unknown" | ||
KVM_HPAGE="unknown" | ||
if [ -f "/sys/module/kvm_intel/parameters/nested" ]; then | ||
KVM_NESTED=$( cat /sys/module/kvm_intel/parameters/nested ) | ||
KVM_ARCH="intel" | ||
elif [ -f "/sys/module/kvm_amd/parameters/nested" ]; then | ||
KVM_NESTED=$( cat /sys/module/kvm_amd/parameters/nested ) | ||
KVM_ARCH="amd" | ||
elif [ -f "/sys/module/kvm/parameters/nested" ]; then | ||
KVM_NESTED=$( cat /sys/module/kvm/parameters/nested ) | ||
KVM_ARCH="s390x" | ||
KVM_HPAGE=$( cat /sys/module/kvm/parameters/hpage ) | ||
fi | ||
|
||
function is_enabled() { | ||
if [ "$1" == "1" ]; then | ||
return 0 | ||
fi | ||
if [ "$1" == "Y" ] || [ "$1" == "y" ]; then | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
|
||
if is_enabled "$KVM_NESTED"; then | ||
echo "[ OK ] $KVM_ARCH nested virtualization enabled" | ||
else | ||
echo "[ERR ] $KVM_ARCH nested virtualization not enabled" | ||
fi | ||
|
||
if is_enabled "$KVM_HPAGE" && [ "$(uname -m)" = "s390x" ]; then | ||
echo "[ERR ] $KVM_HPAGE KVM hugepage enabled. It needs to be disabled while nested virtualization is enabled for s390x" | ||
fi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add KUBEVIRT_RELEASE and KUBEVIRT_SWAP_ON here