Skip to content

Commit

Permalink
Bump kubevirtci
Browse files Browse the repository at this point in the history
a2b389f Fix typos (kubevirt#539)
2b799fe sriov, Parameterize kind version (kubevirt#540)
9306210 Reflect current reviewer state (kubevirt#543)
4a15921 Allow more than 8 nodes cluster (kubevirt#542)
7b758be sriov, Improve CNI downloading (kubevirt#531)
a2af136 Subject: [PATCH] enable kind cluster-up works on multi-arch (kubevirt#537)
6ca1f85 SRIOV provider fine tunes: Logs and Missing Configurations (kubevirt#470)

Signed-off-by: Or Shoval <[email protected]>
  • Loading branch information
oshoval committed Feb 15, 2021
1 parent d65556f commit 67dfc12
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cluster-up-sha.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a59b741886df49dd675427344403a84567990599
3fa819617bcb429e9c9fdd5460e0860633c50b98
3 changes: 1 addition & 2 deletions cluster-up/cluster/k8s-1.17/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ root 1 0 36 13:39 ? 00:05:22 qemu-system-x86_64 -enable-kvm -
* Apply additional manifests, such as flannel.
* Wait for pods to become ready.
* Pull needed images such as Ceph CSI, fluentd logger.
* Create local volume directiories.
* Create local volume directories.
* Shutdown the vm and commit its container.

# Flow of K8s cluster-up (1.17 for example)
Expand Down Expand Up @@ -146,4 +146,3 @@ kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$custom_manifest"
* The new manifest.
* Updated cluster-provision/k8s/scripts/provision.sh
* Updated cluster-up/cluster/images.sh.

3 changes: 1 addition & 2 deletions cluster-up/cluster/k8s-1.18/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ root 1 0 36 13:39 ? 00:05:22 qemu-system-x86_64 -enable-kvm -
* Apply additional manifests, such as flannel.
* Wait for pods to become ready.
* Pull needed images such as Ceph CSI, fluentd logger.
* Create local volume directiories.
* Create local volume directories.
* Shutdown the vm and commit its container.

# Flow of K8s cluster-up (1.18 for example)
Expand Down Expand Up @@ -146,4 +146,3 @@ kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$custom_manifest"
* The new manifest.
* Updated cluster-provision/k8s/scripts/provision.sh
* Updated cluster-up/cluster/images.sh.

3 changes: 1 addition & 2 deletions cluster-up/cluster/k8s-1.19/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ root 1 0 36 13:39 ? 00:05:22 qemu-system-x86_64 -enable-kvm -
* Apply additional manifests, such as flannel.
* Wait for pods to become ready.
* Pull needed images such as Ceph CSI, fluentd logger.
* Create local volume directiories.
* Create local volume directories.
* Shutdown the vm and commit its container.

# Flow of K8s cluster-up (1.19 for example)
Expand Down Expand Up @@ -146,4 +146,3 @@ kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$custom_manifest"
* The new manifest.
* Updated cluster-provision/k8s/scripts/provision.sh
* Updated cluster-up/cluster/images.sh.

3 changes: 1 addition & 2 deletions cluster-up/cluster/k8s-1.20/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ root 1 0 36 13:39 ? 00:05:22 qemu-system-x86_64 -enable-kvm -
* Apply additional manifests, such as flannel.
* Wait for pods to become ready.
* Pull needed images such as Ceph CSI, fluentd logger.
* Create local volume directiories.
* Create local volume directories.
* Shutdown the vm and commit its container.

# Flow of K8s cluster-up (1.20 for example)
Expand Down Expand Up @@ -146,4 +146,3 @@ kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$custom_manifest"
* The new manifest.
* Updated cluster-provision/k8s/scripts/provision.sh
* Updated cluster-up/cluster/images.sh.

12 changes: 12 additions & 0 deletions cluster-up/cluster/kind-k8s-sriov-1.17.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@ make cluster-down

This destroys the whole cluster.

## Setting a custom kind version

In order to use a custom kind image / kind version,
export KIND_NODE_IMAGE, KIND_VERSION, KUBECTL_PATH before running cluster-up.
For example in order to use kind 0.9.0 (which is based on k8s-1.19.1) use:
```bash
export KIND_NODE_IMAGE="kindest/node:v1.19.1@sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600"
export KIND_VERSION="0.9.0"
export KUBECTL_PATH="/usr/bin/kubectl"
```
This allows users to test or use custom images / different kind versions before making them official.
See https://github.com/kubernetes-sigs/kind/releases for details about node images according to the kind version.
14 changes: 12 additions & 2 deletions cluster-up/cluster/kind-k8s-sriov-1.17.0/provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
set -e

export CLUSTER_NAME="sriov"
export KIND_NODE_IMAGE="kindest/node:v1.17.0"

source ${KUBEVIRTCI_PATH}/cluster/kind/common.sh
function set_kind_params() {
export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-kindest/node:v1.17.0}"
export KIND_VERSION="${KIND_VERSION:-0.7.0}"
export KUBECTL_PATH="${KUBECTL_PATH:-/kind/bin/kubectl}"
}

function up() {
if [[ "$KUBEVIRT_NUM_NODES" -ne 2 ]]; then
Expand All @@ -22,5 +25,12 @@ function up() {

kind_up

# remove the rancher.io kind default storageClass
_kubectl delete sc standard

${KUBEVIRTCI_PATH}/cluster/$KUBEVIRT_PROVIDER/config_sriov.sh
}

set_kind_params

source ${KUBEVIRTCI_PATH}/cluster/kind/common.sh
71 changes: 56 additions & 15 deletions cluster-up/cluster/kind/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

set -e

# check CPU arch
PLATFORM=$(uname -m)
case ${PLATFORM} in
x86_64* | i?86_64* | amd64*)
ARCH="amd64"
;;
ppc64le)
ARCH="ppc64le"
;;
aarch64* | arm64*)
ARCH="arm64"
;;
*)
echo "invalid Arch, only support x86_64, ppc64le, aarch64"
exit 1
;;
esac

NODE_CMD="docker exec -it -d "
export KIND_MANIFESTS_DIR="${KUBEVIRTCI_PATH}/cluster/kind/manifests"
export KIND_NODE_CLI="docker exec -it "
Expand Down Expand Up @@ -34,11 +52,13 @@ function _wait_containers_ready {
}

function _fetch_kind() {
if [ ! -f ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind ]; then
wget https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-linux-amd64 -O ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind
chmod +x ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind
KIND="${KUBEVIRTCI_CONFIG_PATH}"/"$KUBEVIRT_PROVIDER"/.kind
current_kind_version=$($KIND --version |& awk '{print $3}')
if [[ $current_kind_version != $KIND_VERSION ]]; then
echo "Downloading kind v$KIND_VERSION"
curl -LSs https://github.com/kubernetes-sigs/kind/releases/download/v$KIND_VERSION/kind-linux-${ARCH} -o "$KIND"
chmod +x "$KIND"
fi
KIND=${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind
}

function _configure-insecure-registry-and-reload() {
Expand Down Expand Up @@ -74,6 +94,35 @@ function _configure_registry_on_node() {
${NODE_CMD} $1 sh -c "echo $(docker inspect --format '{{.NetworkSettings.IPAddress }}' $REGISTRY_NAME)'\t'registry >> /etc/hosts"
}

function _install_cnis {
_install_cni_plugins
_install_calico_cni
}

function _install_cni_plugins {
local CNI_VERSION="v0.8.5"
local CNI_ARCHIVE="cni-plugins-linux-${ARCH}-$CNI_VERSION.tgz"
local CNI_URL="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION/$CNI_ARCHIVE"
if [ ! -f ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/$CNI_ARCHIVE ]; then
echo "Downloading $CNI_ARCHIVE"
curl -sSL -o ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/$CNI_ARCHIVE $CNI_URL
fi

for node in $(_get_nodes | awk '{print $1}'); do
docker cp "${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/$CNI_ARCHIVE" $node:/
docker exec $node /bin/sh -c "tar xf $CNI_ARCHIVE -C /opt/cni/bin"
done
}

function _install_calico_cni {
echo "Installing Calico CNI plugin"
calico_manifest="$KIND_MANIFESTS_DIR/kube-calico.yaml.in"
patched_diff=$(_patch_calico_manifest_diff $calico_manifest)
echo "Log Calico manifest diff:"
echo "$patched_diff"
_patch_calico_manifest "$calico_manifest" "$patched_diff" | _kubectl apply -f -
}

function prepare_config() {
BASE_PATH=${KUBEVIRTCI_CONFIG_PATH:-$PWD}
cat >$BASE_PATH/$KUBEVIRT_PROVIDER/config-provider-$KUBEVIRT_PROVIDER.sh <<EOF
Expand Down Expand Up @@ -154,7 +203,7 @@ function setup_kind() {
$KIND --loglevel debug create cluster --retain --name=${CLUSTER_NAME} --config=${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml --image=$KIND_NODE_IMAGE
$KIND get kubeconfig --name=${CLUSTER_NAME} > ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kubeconfig

docker cp ${CLUSTER_NAME}-control-plane:/kind/bin/kubectl ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kubectl
docker cp ${CLUSTER_NAME}-control-plane:$KUBECTL_PATH ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kubectl
chmod u+x ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kubectl

if [ $KUBEVIRT_WITH_KIND_ETCD_IN_MEMORY == "true" ]; then
Expand All @@ -168,16 +217,7 @@ function setup_kind() {
done
fi

for node in $(_get_nodes | awk '{print $1}'); do
docker exec $node /bin/sh -c "curl -L https://github.com/containernetworking/plugins/releases/download/v0.8.5/cni-plugins-linux-amd64-v0.8.5.tgz | tar xz -C /opt/cni/bin"
done

echo "Installing Calico CNI plugin"
calico_manifest="$KIND_MANIFESTS_DIR/kube-calico.yaml.in"
patched_diff=$(_patch_calico_manifest_diff $calico_manifest)
echo "Log Calico manifest diff:"
echo "$patched_diff"
_patch_calico_manifest "$calico_manifest" "$patched_diff" | _kubectl apply -f -
_install_cnis

_wait_kind_up
_kubectl cluster-info
Expand Down Expand Up @@ -284,5 +324,6 @@ function down() {
return
fi
$KIND delete cluster --name=${CLUSTER_NAME}
docker rm -f $REGISTRY_NAME >> /dev/null
rm -f ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
}
2 changes: 1 addition & 1 deletion cluster-up/hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ provider_prefix=${JOB_NAME:-${KUBEVIRT_PROVIDER}}${EXECUTOR_NUMBER}
job_prefix=${JOB_NAME:-kubevirt}${EXECUTOR_NUMBER}

mkdir -p $KUBEVIRTCI_CONFIG_PATH/$KUBEVIRT_PROVIDER
KUBEVIRTCI_TAG=2101201235-f99d551
KUBEVIRTCI_TAG=2102102051-a2b389f
2 changes: 1 addition & 1 deletion cluster-up/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2101201235-f99d551
2102102051-a2b389f
2 changes: 1 addition & 1 deletion hack/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cdi_namespace=cdi
image_pull_policy=${IMAGE_PULL_POLICY:-IfNotPresent}
verbosity=${VERBOSITY:-2}
package_name=${PACKAGE_NAME:-kubevirt-dev}
kubevirtci_git_hash="2101201235-f99d551"
kubevirtci_git_hash="2102102051-a2b389f"

# try to derive csv_version from docker tag. But it must start with x.y.z, without leading v
default_csv_version="${docker_tag/latest/0.0.0}"
Expand Down

0 comments on commit 67dfc12

Please sign in to comment.