Skip to content

Commit

Permalink
kubevirtci: replace kci/cluster/virtctl.sh calls
Browse files Browse the repository at this point in the history
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller committed Sep 25, 2024
1 parent ffae97f commit c3cc15a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/sidecars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ see if the desired changes to baseboard manufacturer get reflected:

```shell
# Once the VM is ready, connect to its display and login using name and password "fedora"
cluster/virtctl.sh vnc vmi-with-sidecar-hook-configmap
hack/virtctl.sh vnc vmi-with-sidecar-hook-configmap
# Check whether the base board manufacturer value was successfully overwritten
sudo dmidecode -s baseboard-manufacturer
# or
cat /sys/devices/virtual/dmi/id/board_vendor
```
```
2 changes: 1 addition & 1 deletion cmd/sidecars/smbios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ annotations:
cluster/kubectl.sh create -f examples/vmi-with-sidecar-hook.yaml

# Once the VM is ready, connect to its display and login using name and password "fedora"
cluster/virtctl.sh vnc vm-with-sidecar-hook
hack/virtctl.sh vnc vm-with-sidecar-hook

# Install dmidecode
sudo dnf install -y dmidecode
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ the VMI's pod and receives lifecycle commands from virt-handler.

* `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.
* `kubevirtci/cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
* `hack/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
virtual machine specific commands with it. It is supplement to `kubectl`.
e.g. `kubevirtci/cluster-up/virtctl.sh console testvm`.
e.g. `hack/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. `kubevirtci/cluster-up/cli.sh ssh node01`.
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
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:
```
kubevirtci/cluster-up/virtctl.sh vnc vmi-ephemeral
hack/virtctl.sh vnc vmi-ephemeral
```
This will start a remote session with `remote-viewer`.
`kubevirtci/cluster-up/virtctl.sh` is a wrapper around `virtctl`. `virtctl` brings all
`hack/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
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:"
kubevirtci/cluster-up/virtctl.sh version
hack/virtctl.sh version
git status
exit 1
}

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

# Check that "dirty" is never reported
if [ -n "$(kubevirtci/cluster-up/virtctl.sh version | grep dirty)" ]; then
if [ -n "$(hack/virtctl.sh version | grep dirty)" ]; then
report_dirty_build
fi
36 changes: 36 additions & 0 deletions hack/virtctl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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 2018 Red Hat, Inc.
#

set -e

source hack/config-kubevirtci.sh

source ${KUBEVIRTCI_PATH}/hack/common.sh
source ${KUBEVIRTCI_CLUSTER_PATH}/$KUBEVIRT_PROVIDER/provider.sh
source ${KUBEVIRTCI_PATH}/hack/config.sh

CONFIG_ARGS=

if [ -n "$kubeconfig" ]; then
CONFIG_ARGS="--kubeconfig=${kubeconfig}"
elif [ -n "$KUBECONFIG" ]; then
CONFIG_ARGS="--kubeconfig=${KUBECONFIG}"
fi

_out/cmd/virtctl/virtctl $CONFIG_ARGS "$@"

0 comments on commit c3cc15a

Please sign in to comment.