Skip to content

Commit

Permalink
Update OVN-K image, download kind script
Browse files Browse the repository at this point in the history
Fixes submariner-io#703

This patch ensures that the upstreamed submariner kind hacks
for ovn-kubernetes are properly used, and ensures we pull
the ovn-k image from the correct location

it also removes the ovn-kubernetes submodule since all we really
need is the OVN-K kind scripts and templates which we now download
on the fly from ovn-kubernetes master.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
  • Loading branch information
astoycos committed Apr 4, 2022
1 parent d4924b5 commit 3f4bd9e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ junit.xml
*.out
*.coverprofile
*~
/ovn-kubernetes
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "submodules/ovn-kubernetes"]
path = submodules/ovn-kubernetes
url = https://github.com/submariner-io/ovn-kubernetes.git
7 changes: 2 additions & 5 deletions package/Dockerfile.shipyard-dapper-base
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ FROM fedora:35
ARG UPX_LEVEL=-5
ENV DAPPER_HOST_ARCH=amd64 SHIPYARD_DIR=/opt/shipyard SHELL=/bin/bash \
DAPPER_RUN_ARGS="--net=kind"
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/usr/local/go/bin:$PATH \
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/root/.local/bin:/go/bin:/usr/local/go/bin:$PATH \
GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${DAPPER_HOST_ARCH} \
GOPATH=/go GO111MODULE=on GOFLAGS=-mod=vendor GOPROXY=https://proxy.golang.org \
SCRIPTS_DIR=${SHIPYARD_DIR}/scripts OVN_DIR=${SHIPYARD_DIR}/ovn-kubernetes
SCRIPTS_DIR=${SHIPYARD_DIR}/scripts

# Requirements:
# Component | Usage
Expand Down Expand Up @@ -83,9 +83,6 @@ COPY scripts/shared/lib/kubecfg /etc/profile.d/kubecfg.sh
# Copy shared files so that downstream projects can use them
COPY Makefile.* .gitlint ${SHIPYARD_DIR}/

# Copy ovn-kubernetes to share with other projects
COPY submodules/ovn-kubernetes ${OVN_DIR}

# Copy CI deployment scripts into image to share with all submariner-io/* projects
WORKDIR $SCRIPTS_DIR
COPY scripts/shared/ .
21 changes: 17 additions & 4 deletions scripts/shared/clusters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,18 @@ function deploy_ovn_cni(){
}

function deploy_kind_ovn(){
local OVN_SRC_IMAGE="quay.io/vthapar/ovn-daemonset-f:latest"
local OVN_SRC_IMAGE="ghcr.io/ovn-org/ovn-kubernetes/ovn-kube-f:master"
export K8s_VERSION="${k8s_version}"
export NET_CIDR_IPV4="${cluster_CIDRs[${cluster}]}"
export SVC_CIDR_IPV4="${service_CIDRs[${cluster}]}"
export KIND_CLUSTER_NAME="${cluster}"

export OVN_IMAGE="localhost:5000/ovn-daemonset-f:latest"
export REGISTRY_IP="kind-registry"
docker pull "${OVN_SRC_IMAGE}"
docker tag "${OVN_SRC_IMAGE}" "${OVN_IMAGE}"
docker push "${OVN_IMAGE}"
sed -i 's/^kind load/#kind load/g' $OVN_DIR/contrib/kind.sh

( cd ${OVN_DIR}/contrib; ./kind.sh; ) &
( ./ovn-kubernetes/contrib/kind.sh -ov $OVN_IMAGE -cn ${KIND_CLUSTER_NAME} -ric -lr -dd ${KIND_CLUSTER_NAME}.local; ) &
if ! wait $! ; then
echo "Failed to install kind with OVN"
kind delete cluster --name=${cluster}
Expand Down Expand Up @@ -304,13 +302,28 @@ function warn_inotify() {
fi
}

# If any of the clusters use OVN-K as the CNI then clone the
# ovn-kubernetes repo from master in order to access the required
# kind scripts, and manifest generation templates.
function download_ovnk() {
if [[ ${cluster_cni[*]} != *"ovn"* ]]; then
return
fi

echo "Cloning ovn-kubernetes from source"
rm -rf ovn-kubernetes/
git clone https://github.com/ovn-org/ovn-kubernetes.git \
|| { git -C ovn-kubernetes fetch && git -C ovn-kubernetes reset --hard origin/master; }
}

### Main ###

rm -rf ${KUBECONFIGS_DIR}
mkdir -p ${KUBECONFIGS_DIR}

download_kind
load_settings
download_ovnk
run_local_registry
declare_cidrs

Expand Down
1 change: 0 additions & 1 deletion submodules/ovn-kubernetes
Submodule ovn-kubernetes deleted from 2523ea

0 comments on commit 3f4bd9e

Please sign in to comment.