From ddb425a93b5c25ee9b824d9d23987b12b8719292 Mon Sep 17 00:00:00 2001 From: Daniel Farrell Date: Thu, 10 Aug 2023 15:36:54 -0400 Subject: [PATCH 1/3] Add OVN IC CI Fixes: submariner-io/enhancements#209 Co-authored-by: Mike Kolesnik Signed-off-by: Daniel Farrell --- Makefile | 6 +++- scripts/shared/lib/clusters_kind | 49 ++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fa5f91729..d6b2ae2c2 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,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))) +export OVN_IC = true +endif + export LAZY_DEPLOY = false scale: SETTINGS = $(DAPPER_SOURCE)/.shipyard.scale.yml diff --git a/scripts/shared/lib/clusters_kind b/scripts/shared/lib/clusters_kind index d2477f644..03721ad5d 100755 --- a/scripts/shared/lib/clusters_kind +++ b/scripts/shared/lib/clusters_kind @@ -184,18 +184,14 @@ EOF } function deploy_kind_ovn(){ - 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" - docker pull "${OVN_SRC_IMAGE}" - 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" + local ovn_flags=() + [[ "$OVN_IC" != true ]] || ovn_flags=( -ic -npz 1 -wk 3 ) + delete_cluster_on_fail ./ovn-kubernetes/contrib/kind.sh -ov "$OVN_IMAGE" -cn "${KIND_CLUSTER_NAME}" -ric "${ovn_flags[@]}" -lr -dd "${KIND_CLUSTER_NAME}.local" [[ "$AIR_GAPPED" = true ]] && air_gap_iptables } @@ -240,7 +236,7 @@ function provider_failed() { # ovn-kubernetes repo from master in order to access the required # kind scripts, and manifest generation templates. function download_ovnk() { - echo "Cloning ovn-kubernetes from source" + echo "Cloning ovn-kubernetes source" mkdir -p ovn-kubernetes # We only need the contrib directory, use a sparse checkout ( @@ -257,12 +253,47 @@ function download_ovnk() { ) } +function prepare_ovn_ic() { + echo "Building ovn-kubernetes with interconnect (OVN-IC) from source" + echo "This will become unnecessary if OVN CI image publishing is fixed" + echo "https://github.com/ovn-org/ovn-kubernetes/actions/workflows/docker.yml" + rm -rf ovn-kubernetes + git clone https://github.com/ovn-org/ovn-kubernetes + pushd ovn-kubernetes || exit + + make -C go-controller + + cp go-controller/_output/go/bin/* dist/images + + echo "ref: $(git rev-parse --symbolic-full-name HEAD) commit: $(git rev-parse HEAD)" > dist/images/git_info + docker build -t "${OVN_IMAGE}" -f dist/images/Dockerfile.fedora dist/images/ + docker push "${OVN_IMAGE}" + + popd || exit +} + +function prepare_ovn() { + export OVN_IMAGE="localhost:5000/ovn-daemonset-f:latest" + + if [[ "$OVN_IC" = true ]]; then + prepare_ovn_ic + return + fi + + download_ovnk + + local OVN_SRC_IMAGE="ghcr.io/ovn-org/ovn-kubernetes/ovn-kube-f:master" + docker pull "${OVN_SRC_IMAGE}" + docker tag "${OVN_SRC_IMAGE}" "${OVN_IMAGE}" + docker push "${OVN_IMAGE}" +} + function provider_prepare() { [[ -z "${K8S_VERSION}" ]] && K8S_VERSION="${DEFAULT_K8S_VERSION}" kind="${kind_binaries[$K8S_VERSION]:-kind}" [[ -n "${kind_k8s_versions[$K8S_VERSION]}" ]] && K8S_VERSION="${kind_k8s_versions[$K8S_VERSION]}" download_kind - [[ "${cluster_cni[*]}" != *"ovn"* ]] || download_ovnk run_local_registry + [[ "${cluster_cni[*]}" != *"ovn"* ]] || prepare_ovn } From a641f36b55a13f4e7c0c355fb7acca8c23fa0680 Mon Sep 17 00:00:00 2001 From: Aswin Suryanarayanan Date: Wed, 30 Aug 2023 16:00:28 +0000 Subject: [PATCH 2/3] Fix OVN Image Use local image for non-ic deployment as well as the old image is not working with latest code. Signed-off-by: Aswin Suryanarayanan --- scripts/shared/lib/clusters_kind | 39 ++------------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/scripts/shared/lib/clusters_kind b/scripts/shared/lib/clusters_kind index 03721ad5d..c03ca41c2 100755 --- a/scripts/shared/lib/clusters_kind +++ b/scripts/shared/lib/clusters_kind @@ -232,28 +232,9 @@ function provider_failed() { 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() { - echo "Cloning ovn-kubernetes source" - mkdir -p ovn-kubernetes - # We only need the contrib directory, use a sparse checkout - ( - cd ovn-kubernetes || exit - git init - git config core.sparseCheckout true - echo contrib/ > .git/info/sparse-checkout - echo dist/ >> .git/info/sparse-checkout - if git remote add -f origin https://github.com/ovn-org/ovn-kubernetes.git; then - git pull origin master - else - git fetch && git reset --hard origin/master - fi - ) -} +function prepare_ovn() { + export OVN_IMAGE="localhost:5000/ovn-daemonset-f:latest" -function prepare_ovn_ic() { echo "Building ovn-kubernetes with interconnect (OVN-IC) from source" echo "This will become unnecessary if OVN CI image publishing is fixed" echo "https://github.com/ovn-org/ovn-kubernetes/actions/workflows/docker.yml" @@ -272,22 +253,6 @@ function prepare_ovn_ic() { popd || exit } -function prepare_ovn() { - export OVN_IMAGE="localhost:5000/ovn-daemonset-f:latest" - - if [[ "$OVN_IC" = true ]]; then - prepare_ovn_ic - return - fi - - download_ovnk - - local OVN_SRC_IMAGE="ghcr.io/ovn-org/ovn-kubernetes/ovn-kube-f:master" - docker pull "${OVN_SRC_IMAGE}" - docker tag "${OVN_SRC_IMAGE}" "${OVN_IMAGE}" - docker push "${OVN_IMAGE}" -} - function provider_prepare() { [[ -z "${K8S_VERSION}" ]] && K8S_VERSION="${DEFAULT_K8S_VERSION}" kind="${kind_binaries[$K8S_VERSION]:-kind}" From a41f2c6223c379aa836156cdda1a9b2d5f64c28d Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Mon, 18 Sep 2023 16:57:49 +0200 Subject: [PATCH 3/3] Use a specific OVNK commit This ensures our builds don't suddenly break because of OVNK changes. Signed-off-by: Stephen Kitt --- scripts/shared/lib/clusters_kind | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/shared/lib/clusters_kind b/scripts/shared/lib/clusters_kind index c03ca41c2..1147cfe27 100755 --- a/scripts/shared/lib/clusters_kind +++ b/scripts/shared/lib/clusters_kind @@ -241,6 +241,7 @@ function prepare_ovn() { rm -rf ovn-kubernetes git clone https://github.com/ovn-org/ovn-kubernetes pushd ovn-kubernetes || exit + git checkout c6d8579689fe3b15c87abdf7e7647777bad26605 make -C go-controller