From 9efcdf07bdeab23a537687931e5e34bf0ce69c4f Mon Sep 17 00:00:00 2001 From: Daniel Farrell Date: Thu, 10 Aug 2023 15:36:54 -0400 Subject: [PATCH] Add OVN IC CI Fixes: submariner-io/enhancements#209 Signed-off-by: Daniel Farrell --- .github/workflows/testing.yml | 5 ++++- Makefile | 6 +++++- Makefile.inc | 1 + scripts/shared/lib/clusters_kind | 29 +++++++++++++++++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a89583769..efc1f18c4 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -122,8 +122,11 @@ jobs: lighthouse: lighthouse - extra-toggles: air-gap ovn: ovn + - extra-toggles: air-gap + ovn: ovn-ic - extra-toggles: dual-stack - extra-toggles: ovn + - extra-toggles: ovn-ic - deploytool: operator extra-toggles: lighthouse - deploytool: helm @@ -132,7 +135,7 @@ jobs: - extra-toggles: prometheus steps: - name: Reclaim space on GHA host (if the job needs it) - if: ${{ matrix.ovn != '' }} + if: ${{ matrix.ovn != '' }} || ${{ matrix.ovn-ic != '' }} run: rm -rf /usr/share/dotnet - name: Check out the repository diff --git a/Makefile b/Makefile index e9711c52c..bdd3365af 100644 --- a/Makefile +++ b/Makefile @@ -13,12 +13,16 @@ ifneq (,$(DAPPER_HOST_ARCH)) # Running in Dapper -ifneq (,$(filter ovn,$(USING))) +ifneq (,$(filter ovn%,$(USING))) SETTINGS ?= $(DAPPER_SOURCE)/.shipyard.e2e.ovn.yml else SETTINGS ?= $(DAPPER_SOURCE)/.shipyard.e2e.yml endif +ifneq (,$(filter ovn-ic,$(USING))) +OVN_IC = true +endif + export LAZY_DEPLOY = false scale: SETTINGS = $(DAPPER_SOURCE)/.shipyard.scale.yml diff --git a/Makefile.inc b/Makefile.inc index 282bba60b..eda620098 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -148,6 +148,7 @@ override PRELOAD_IMAGES += submariner-globalnet endif ifneq (,$(shell grep -w ovn $(SETTINGS))) override PRELOAD_IMAGES += submariner-networkplugin-syncer +# TODO Peload OVN IC image for air-gapped endif ifeq ($(LIGHTHOUSE),true) override PRELOAD_IMAGES += lighthouse-agent lighthouse-coredns diff --git a/scripts/shared/lib/clusters_kind b/scripts/shared/lib/clusters_kind index a5507b1f1..dd6f2b1ab 100755 --- a/scripts/shared/lib/clusters_kind +++ b/scripts/shared/lib/clusters_kind @@ -105,6 +105,8 @@ function provider_create_cluster() { deploy_kind_ovn return fi + fi + generate_cluster_yaml local image_flag='' @@ -202,7 +204,8 @@ function deploy_kind_ovn(){ docker tag "${OVN_SRC_IMAGE}" "${OVN_IMAGE}" docker push "${OVN_IMAGE}" - delete_cluster_on_fail ./ovn-kubernetes/contrib/kind.sh -ov "$OVN_IMAGE" -cn "${KIND_CLUSTER_NAME}" -ric -lr -dd "${KIND_CLUSTER_NAME}.local" + [[ "$OVN_IC" = true ]] && delete_cluster_on_fail ./ovn-kubernetes/contrib/kind.sh -ov "$OVN_IMAGE" -cn "${KIND_CLUSTER_NAME}" -ric -ic -npz 1 -wk 3 -lr -dd "${KIND_CLUSTER_NAME}.local" + [[ "$OVN_IC" != true ]] && delete_cluster_on_fail ./ovn-kubernetes/contrib/kind.sh -ov "$OVN_IMAGE" -cn "${KIND_CLUSTER_NAME}" -ric -lr -dd "${KIND_CLUSTER_NAME}.local" [[ "$AIR_GAPPED" = true ]] && air_gap_iptables } @@ -264,11 +267,33 @@ function download_ovnk() { ) } +function build_ovnk_ic() { + echo "Building ovn-kubernetes with IC from source" + rm -rf ovn-kubernetes || true + git clone https://github.com/ovn-org/ovn-kubernetes + + # Build some binaries TODO better description of what they are/why needed + pushd go-controller + make + popd + + # Copy binaries to container build directory, note SHA of built commit + cp go-controller/_output/go/bin/* dist/images + pushd dist/images + echo "ref: $(git rev-parse --symbolic-full-name HEAD) commit: $(git rev-parse HEAD)" > git_info + + # Build OVN IC container image and push to local registry + local OVN_IMAGE="${KIND_REGISTRY}/ovn-daemonset-f:latest" + docker build -t "${OVN_IMAGE}" -f Dockerfile.fedora . + docker push "${OVN_IMAGE}" || echo "Failed to push ${OVN_IMAGE} to registry." +} + function provider_prepare() { [[ -z "${K8S_VERSION}" ]] && K8S_VERSION="${DEFAULT_K8S_VERSION}" [[ -n "${kind_k8s_versions[$K8S_VERSION]}" ]] && K8S_VERSION="${kind_k8s_versions[$K8S_VERSION]}" download_kind - [[ "${cluster_cni[*]}" != *"ovn"* ]] || download_ovnk + [[ "${cluster_cni[*]}" = *"ovn"* ]] && [[ "$OVN_IC" = true ]] && build_ovnk_ic + [[ "${cluster_cni[*]}" = *"ovn"* ]] && [[ "$OVN_IC" != true ]] && download_ovnk run_local_registry }