Skip to content

Commit

Permalink
kubevirtci: move into it's own folder to allow OWNERS
Browse files Browse the repository at this point in the history
We use [kubevirtci] for spinning up virtualized k8s clusters for
testing (locally and on CI). Therefore we source the cluster-up folder
into kubevirts' project folder root. Also we have the
cluster-up-sha.txt which is used to verify which version we use
currently, so that we can determine whether an update is necessary.

Related to how OWNERS files work, and since both of those items are
located in the root folder, we currently need a root approver for
approving pull requests that bump kubevirtci.

Thus, to be able for sig-buildsystem to own kubevirtci we move it to
it's own folder `kubevirtci`. In that folder we place an OWNERS file
with which we as sig-buildsystem claim ownership of kubevirtci.

[kubevirtci]: https://github.com/kubevirt/kubevirtci

Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller committed Sep 25, 2024
1 parent 4917afe commit ffae97f
Show file tree
Hide file tree
Showing 104 changed files with 111 additions and 73 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ cluster-up:
./hack/cluster-up.sh

cluster-down:
./cluster-up/down.sh
./kubevirtci/cluster-up/down.sh

cluster-build:
./hack/cluster-build.sh
Expand Down Expand Up @@ -252,7 +252,7 @@ gofumpt:

update-generated-api-testdata:
./hack/update-generated-api-testdata.sh

.PHONY: \
build-verify \
conformance \
Expand Down
2 changes: 1 addition & 1 deletion automation/perfscale-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

set -ex

kubectl() { KUBEVIRTCI_VERBOSE=false cluster-up/kubectl.sh "$@"; }
kubectl() { KUBEVIRTCI_VERBOSE=false kubevirtci/cluster-up/kubectl.sh "$@"; }

_prometheus_port_forward_pid=""
trap "clean_up" EXIT SIGINT SIGTERM SIGQUIT
Expand Down
4 changes: 2 additions & 2 deletions automation/repeated_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if (( $# > 0 )); then
else
# We only want to use stable providers for flake testing, thus we fetch the k8s version file from kubevirtci.
# we stop at the first provider that is stable (aka doesn't have an rc or beta or alpha version)
for k8s_provider in $(cd cluster-up/cluster && ls -rd k8s-[0-9]\.[0-9][0-9]); do
for k8s_provider in $(cd kubevirtci/cluster-up/cluster && ls -rd k8s-[0-9]\.[0-9][0-9]); do
# shellcheck disable=SC2154
k8s_provider_version=$(curl --fail "https://raw.githubusercontent.com/kubevirt/kubevirtci/${kubevirtci_git_hash}/cluster-provision/k8s/${k8s_provider#"k8s-"}/version")
if [[ "${k8s_provider_version}" =~ -(rc|alpha|beta) ]]; then
Expand All @@ -143,7 +143,7 @@ else
fi
fi
echo "Test lane: ${TEST_LANE}"
[ -d "cluster-up/cluster/${TEST_LANE}" ] || ( echo "provider ${TEST_LANE} does not exist!"; exit 1 )
[ -d "kubevirtci/cluster-up/cluster/${TEST_LANE}" ] || ( echo "provider ${TEST_LANE} does not exist!"; exit 1 )

if [[ -z ${TARGET_COMMIT-} ]]; then
# if there's no commit provided default to the latest merge commit
Expand Down
6 changes: 3 additions & 3 deletions automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if [[ $KUBEVIRT_NUM_NODES = "1" && $KUBEVIRT_INFRA_REPLICAS = "1" ]]; then
export KUBEVIRT_DEPLOY_NFS_CSI=true
fi

if [ ! -d "cluster-up/cluster/$KUBEVIRT_PROVIDER" ]; then
if [ ! -d "kubevirtci/cluster-up/cluster/$KUBEVIRT_PROVIDER" ]; then
echo "The cluster provider $KUBEVIRT_PROVIDER does not exist"
exit 1
fi
Expand Down Expand Up @@ -214,8 +214,8 @@ elif [[ $TARGET =~ windows.* ]]; then
safe_download "$WINDOWS_LOCK_PATH" "$win_image_url" "$win_image" || exit 1
fi

kubectl() { KUBEVIRTCI_VERBOSE=false cluster-up/kubectl.sh "$@"; }
cli() { cluster-up/cli.sh "$@"; }
kubectl() { KUBEVIRTCI_VERBOSE=false kubevirtci/cluster-up/kubectl.sh "$@"; }
cli() { kubevirtci/cluster-up/cli.sh "$@"; }

determine_cri_bin() {
if [ "${KUBEVIRTCI_RUNTIME}" = "podman" ]; then
Expand Down
1 change: 0 additions & 1 deletion cluster-up-sha.txt

This file was deleted.

10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ the VMI's pod and receives lifecycle commands from virt-handler.

### Scripts

* `cluster-up/kubectl.sh`: This is a wrapper around Kubernetes' kubectl command so
* `kubevirtci/cluster-up/kubectl.sh`: This is a wrapper around Kubernetes' kubectl command so
that it can be run directly from this checkout without logging into a node.
* `cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
* `kubevirtci/cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
virtual machine specific commands with it. It is supplement to `kubectl`.
e.g. `cluster-up/virtctl.sh console testvm`.
* `cluster-up/cli.sh` helps you create ephemeral kubernetes and openshift
e.g. `kubevirtci/cluster-up/virtctl.sh console testvm`.
* `kubevirtci/cluster-up/cli.sh` helps you create ephemeral kubernetes and openshift
clusters for testing. This is helpful when direct management or access to
cluster nodes is necessary. e.g. `cluster-up/cli.sh ssh node01`.
cluster nodes is necessary. e.g. `kubevirtci/cluster-up/cli.sh ssh node01`.

### Makefile Commands

Expand Down
12 changes: 6 additions & 6 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Debugging

```bash
cluster-up/kubectl.sh version
kubevirtci/cluster-up/kubectl.sh version
```

will try to connect to the apiserver.

## Retrieving Logs

To investigate the logs of a pod, you can view the logs via
`cluster-up/kubectl.sh logs`. To view the logs of `virt-api`, type
`kubevirtci/cluster-up/kubectl.sh logs`. To view the logs of `virt-api`, type

```bash
cluster-up/kubectl.sh logs virt-api -f
kubevirtci/cluster-up/kubectl.sh logs virt-api -f
```

Sometimes a container in a pod is crashlooping because of an application error
Expand All @@ -22,7 +22,7 @@ attempt, the `--previous` flag can be used. To view the logs of the container
`virt-api` in the pod `virt-api` from the previous run, type

```bash
cluster-up/kubectl.sh logs virt-api -f -c virt-api -p
kubevirtci/cluster-up/kubectl.sh logs virt-api -f -c virt-api -p
```

Note that you always have to select a container inside a pod for fetching old
Expand All @@ -33,7 +33,7 @@ logs with the `--previous` flag.
Both, Kubernetes and KubeVirt are creating events, which can be viewed via

```bash
cluster-up/kubectl.sh get events --all-namespaces --watch
kubevirtci/cluster-up/kubectl.sh get events --all-namespaces --watch
```

This way it is pretty easy to detect if a Pod or a VMI got started.
Expand All @@ -45,7 +45,7 @@ to see what is going wrong. In this case the kubectl `exec` command can be
used. To enter `virt-api` with an interactive shell, type

```bash
cluster-up/kubectl.sh exec virt-api -c virt-api -i -t -- sh
kubevirtci/cluster-up/kubectl.sh exec virt-api -c virt-api -i -t -- sh
```

## Kubelet Logs
Expand Down
2 changes: 1 addition & 1 deletion docs/env-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ All following providers allow a common workflow:
* `make cluster-deploy` to (re)deploy the code (no provider support needed)
* `make cluster-sync` to build and (re)deploy the code
* `make functests` to run the functional tests against KubeVirt
* `cluster-up/kubectl.sh` to talk to the k8s installation
* `kubevirtci/cluster-up/kubectl.sh` to talk to the k8s installation

It is recommended to export the `KUBEVIRT_PROVIDER` variable as part of your `.bashrc`
file.
Expand Down
28 changes: 14 additions & 14 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ If not, try to adjust them to be the same.
See [issue 2667](https://github.com/kubevirt/kubevirt/issues/2667)
for more detailed info.
```
# ./cluster-up/kubectl.sh get pods --all-namespaces
# ./kubevirtci/cluster-up/kubectl.sh get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
cdi cdi-operator-5db567b486-grtk9 0/1 ImagePullBackOff 0 42m
Expand Down Expand Up @@ -200,14 +200,14 @@ Based on the used cluster, node names might be different.
You can get the names from following command:

```bash
# cluster-up/kubectl.sh get nodes
# kubevirtci/cluster-up/kubectl.sh get nodes
NAME STATUS ROLES AGE VERSION
node01 Ready control-plane,worker 13s v1.18.3
```

Then you can execute the following command to access the node:
```
# ./cluster-up/ssh.sh node01
# ./kubevirtci/cluster-up/ssh.sh node01
[vagrant@node01 ~]$
```

Expand Down Expand Up @@ -277,20 +277,20 @@ Finally start a VMI called `vmi-ephemeral`:
# This can be done from your GIT repo, no need to log into a VMI
# Create a VMI
./cluster-up/kubectl.sh create -f examples/vmi-ephemeral.yaml
./kubevirtci/cluster-up/kubectl.sh create -f examples/vmi-ephemeral.yaml
# Sure? Let's list all created VMIs
./cluster-up/kubectl.sh get vmis
./kubevirtci/cluster-up/kubectl.sh get vmis
# Enough, let's get rid of it
./cluster-up/kubectl.sh delete -f examples/vmi-ephemeral.yaml
./kubevirtci/cluster-up/kubectl.sh delete -f examples/vmi-ephemeral.yaml
# You can actually use kubelet.sh to introspect the cluster in general
./cluster-up/kubectl.sh get pods
./kubevirtci/cluster-up/kubectl.sh get pods
# To check the running kubevirt services you need to introspect the `kubevirt` namespace:
./cluster-up/kubectl.sh -n kubevirt get pods
./kubevirtci/cluster-up/kubectl.sh -n kubevirt get pods
```

This will start a VMI on control-plane or one of the running nodes with a macvtap and a
Expand All @@ -299,18 +299,18 @@ tap networking device attached.
#### Example

```bash
$ ./cluster-up/kubectl.sh create -f examples/vmi-ephemeral.yaml
$ ./kubevirtci/cluster-up/kubectl.sh create -f examples/vmi-ephemeral.yaml
vm "vmi-ephemeral" created
$ ./cluster-up/kubectl.sh get pods
$ ./kubevirtci/cluster-up/kubectl.sh get pods
NAME READY STATUS RESTARTS AGE
virt-launcher-vmi-ephemeral9q7es 1/1 Running 0 10s
$ ./cluster-up/kubectl.sh get vmis
$ ./kubevirtci/cluster-up/kubectl.sh get vmis
NAME AGE PHASE IP NODENAME
vmi-ephemeral 11s Running 10.244.140.77 node02
$ ./cluster-up/kubectl.sh get vmis -o json
$ ./kubevirtci/cluster-up/kubectl.sh get vmis -o json
{
"kind": "List",
"apiVersion": "v1",
Expand Down Expand Up @@ -348,12 +348,12 @@ to add virt-viewer installation folder to their `PATH`.
Then, after you made sure that the VMI `vmi-ephemeral` is running, type:
```
cluster-up/virtctl.sh vnc vmi-ephemeral
kubevirtci/cluster-up/virtctl.sh vnc vmi-ephemeral
```
This will start a remote session with `remote-viewer`.
`cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
`kubevirtci/cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
virtual machine specific commands with it and is a supplement to `kubectl`.
**Note:** If accessing your cluster through ssh, be sure to forward your X11 session in order to launch `virtctl vnc`.
Expand Down
12 changes: 6 additions & 6 deletions docs/network/sriov.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ deploy from KubeVirt sources though.

In the following example, we configure the cluster using `local` provider which
is part of kubevirt/kubevirt repo. Please consult
[documentation](https://github.com/kubevirt/kubevirt/blob/main/cluster-up/cluster/local/README.md)
[documentation](https://github.com/kubevirt/kubevirt/blob/main/kubevirtci/cluster-up/cluster/local/README.md)
for general information on setting up a host using the `local` provider.

The `local` provider does not install default CNI plugins like `loopback`. So
Expand Down Expand Up @@ -216,8 +216,8 @@ $ go get -u -d github.com/intel/multus-cni
$ cd $GOPATH/src/github.com/intel/multus-cni/
$ mkdir -p /etc/cni/net.d
$ cp images/70-multus.conf /etc/cni/net.d/
$ ./cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/multus-cni/images/multus-daemonset.yml
$ ./cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/multus-cni/images/flannel-daemonset.yml
$ ./kubevirtci/cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/multus-cni/images/multus-daemonset.yml
$ ./kubevirtci/cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/multus-cni/images/flannel-daemonset.yml
```

Now, deploy SR-IOV device plugin. Adjust config.json file for your particular
Expand All @@ -239,20 +239,20 @@ $ cat <<EOF > /etc/pcidp/config.json
]
}
EOF
$ ./cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-network-device-plugin/images/sriovdp-daemonset.yaml
$ ./kubevirtci/cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-network-device-plugin/images/sriovdp-daemonset.yaml
```

Deploy SR-IOV CNI plugin.

```
$ go get -u -d github.com/intel/sriov-cni/
$ ./cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-cni/images/sriov-cni-daemonset.yaml
$ ./kubevirtci/cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-cni/images/sriov-cni-daemonset.yaml
```

Finally, create a new SR-IOV network CRD that will use SR-IOV device plugin to allocate devices.

```
./cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-network-device-plugin/deployments/sriov-crd.yaml
./kubevirtci/cluster-up/kubectl.sh create -f $GOPATH/src/github.com/intel/sriov-network-device-plugin/deployments/sriov-crd.yaml
```

Just make sure that the network spec refers to the right resource name for
Expand Down
2 changes: 1 addition & 1 deletion docs/software-emulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Enabling software emulation is a cluster-wide setting, and is activated by
editing the `KubeVirt` CR as follows:

```bash
cluster-up/kubectl.sh --namespace kubevirt edit kubevirt kubevirt
kubevirtci/cluster-up/kubectl.sh --namespace kubevirt edit kubevirt kubevirt
```

Add the following snippet to the spec:
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rm -f vendor/libvirt.org/go/libvirt/BUILD.bazel
# generate BUILD files
bazel run \
--config=${ARCHITECTURE} \
//:gazelle -- -exclude vendor/google.golang.org/grpc --exclude cluster-up
//:gazelle -- -exclude vendor/google.golang.org/grpc --exclude kubevirtci/cluster-up

# inject changes to libvirt BUILD file
bazel run \
Expand Down
2 changes: 1 addition & 1 deletion hack/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function kubevirt::bootstrap::regenerate() {
rm .bazeldnf/sandbox.bazelrc -f
# Run gazelle to ensure that nogo has all build files resolved and that we can bootstrap the env.
# This is necessary since some steps remove the vendor build files and nogo would be broken then.
KUBEVIRT_BOOTSTRAPPING=true bazel run --config=${ARCHITECTURE} //:gazelle -- -exclude vendor/google.golang.org/grpc --exclude cluster-up
KUBEVIRT_BOOTSTRAPPING=true bazel run --config=${ARCHITECTURE} //:gazelle -- -exclude vendor/google.golang.org/grpc --exclude kubevirtci/cluster-up
KUBEVIRT_BOOTSTRAPPING=true bazel run --config ${HOST_ARCHITECTURE} //rpm:sandbox_${1}
bazel clean

Expand Down
6 changes: 3 additions & 3 deletions hack/build-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ set -e
function report_dirty_build() {
set +e
echo "Build is not clean:"
cluster-up/virtctl.sh version
kubevirtci/cluster-up/virtctl.sh version
git status
exit 1
}

# Check that "clean" is reported at least once
if [ -z "$(cluster-up/virtctl.sh version | grep clean)" ]; then
if [ -z "$(kubevirtci/cluster-up/virtctl.sh version | grep clean)" ]; then
report_dirty_build
fi

# Check that "dirty" is never reported
if [ -n "$(cluster-up/virtctl.sh version | grep dirty)" ]; then
if [ -n "$(kubevirtci/cluster-up/virtctl.sh version | grep dirty)" ]; then
report_dirty_build
fi
2 changes: 1 addition & 1 deletion hack/ci/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function run_tests() {
OC_PATH=$(get_path_or_empty_string_for_cmd oc)
KUBECTL_PATH=$(get_path_or_empty_string_for_cmd kubectl)

tests.test -v=5 -kubeconfig=${KUBECONFIG} -container-tag=${DOCKER_TAG} -container-tag-alt= -container-prefix=${DOCKER_PREFIX} -image-prefix-alt=-kv -oc-path=${OC_PATH} -kubectl-path=${KUBECTL_PATH} -gocli-path=$(pwd)/cluster-up/cli.sh -test.timeout 420m -ginkgo.noColor -ginkgo.succinct -ginkgo.slow-spec-threshold=60s ${KUBEVIRT_TESTS_FOCUS} -junit-output=${ARTIFACT_DIR}/junit.functest.xml -installed-namespace=kubevirt -previous-release-tag= -previous-release-registry=quay.io/kubevirt -deploy-testing-infra=false
tests.test -v=5 -kubeconfig=${KUBECONFIG} -container-tag=${DOCKER_TAG} -container-tag-alt= -container-prefix=${DOCKER_PREFIX} -image-prefix-alt=-kv -oc-path=${OC_PATH} -kubectl-path=${KUBECTL_PATH} -gocli-path=$(pwd)/kubevirtci/cluster-up/cli.sh -test.timeout 420m -ginkgo.noColor -ginkgo.succinct -ginkgo.slow-spec-threshold=60s ${KUBEVIRT_TESTS_FOCUS} -junit-output=${ARTIFACT_DIR}/junit.functest.xml -installed-namespace=kubevirt -previous-release-tag= -previous-release-registry=quay.io/kubevirt -deploy-testing-infra=false
}

export PATH="$BIN_DIR:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion hack/cluster-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DOCKER_TAG=${DOCKER_TAG:-devel}
DOCKER_TAG_ALT=${DOCKER_TAG_ALT:-devel_alt}

source hack/common.sh
source cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source kubevirtci/cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source hack/config.sh

echo "Building ..."
Expand Down
2 changes: 1 addition & 1 deletion hack/cluster-clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -ex
DOCKER_TAG=${DOCKER_TAG:-devel}

source hack/common.sh
source cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source kubevirtci/cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source hack/config.sh

function patch_remove_finalizers() {
Expand Down
4 changes: 2 additions & 2 deletions hack/cluster-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CDI_DV_GC=${CDI_DV_GC:--1}

source hack/common.sh
# shellcheck disable=SC1090
source cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source kubevirtci/cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source hack/config.sh

function dump_kubevirt() {
Expand All @@ -51,7 +51,7 @@ function _ensure_cdi_deployment() {
_kubectl patch cdi ${cdi_namespace} --type merge -p '{"spec": {"config": {"insecureRegistries": [ "registry:5000", "fakeregistry:5000" ]}}}'

# Configure uploadproxy override for virtctl imageupload
host_port=$(${KUBEVIRT_PATH}cluster-up/cli.sh ports uploadproxy | xargs)
host_port=$(${KUBEVIRT_PATH}kubevirtci/cluster-up/cli.sh ports uploadproxy | xargs)
override="https://127.0.0.1:$host_port"
_kubectl patch cdi ${cdi_namespace} --type merge -p '{"spec": {"config": {"uploadProxyURLOverride": "'"$override"'"}}}'

Expand Down
2 changes: 1 addition & 1 deletion hack/cluster-patch.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

source hack/common.sh
source cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source kubevirtci/cluster-up/cluster/$KUBEVIRT_PROVIDER/provider.sh
source hack/config.sh

function wait_for_rollout() {
Expand Down
3 changes: 3 additions & 0 deletions hack/cluster-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#

set -e
set -x

source hack/config-kubevirtci.sh

TEMP_FILE=$(mktemp -p /tmp -t kubevirt.deploy.XXXX)

Expand Down
Loading

0 comments on commit ffae97f

Please sign in to comment.