Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use image overrides when deploying #924

Merged
merged 5 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
, := ,
USING = $(subst $(,), ,$(using))
_using = ${USING}
PRELOAD_IMAGES ?= submariner-gateway submariner-operator submariner-route-agent

### Tunable variables for affecting make commands ###
# Affecting multiple commands
DEBUG_PRINT ?= true
PARALLEL ?= true
PROVIDER ?= kind
TIMEOUT ?= 5m
export DEBUG_PRINT GLOBALNET PARALLEL PLUGIN PROVIDER SETTINGS TIMEOUT
export DEBUG_PRINT GLOBALNET PARALLEL PLUGIN PRELOAD_IMAGES PROVIDER SETTINGS TIMEOUT

# Specific to `clusters`
K8S_VERSION ?= 1.24
Expand Down Expand Up @@ -74,11 +73,12 @@ endif

ifneq (,$(filter lighthouse,$(_using)))
LIGHTHOUSE = true
override PRELOAD_IMAGES += lighthouse-agent lighthouse-coredns
endif

ifneq (,$(filter globalnet,$(_using)))
GLOBALNET = true
PRELOAD_IMAGES += submariner-globalnet
override PRELOAD_IMAGES += submariner-globalnet
endif

ifneq (,$(filter helm,$(_using)))
Expand All @@ -88,22 +88,22 @@ endif
ifneq (,$(filter bundle,$(_using)))
OLM = true
DEPLOYTOOL = bundle
PRELOAD_IMAGES += submariner-operator-index
override PRELOAD_IMAGES += submariner-operator-index
endif

ifneq (,$(filter ocm,$(_using)))
OLM = true
DEPLOYTOOL = ocm
LIGHTHOUSE = true
PRELOAD_IMAGES += lighthouse-agent lighthouse-coredns submariner-operator-index
override PRELOAD_IMAGES += lighthouse-agent lighthouse-coredns submariner-operator-index
endif

ifneq (,$(filter prometheus,$(_using)))
PROMETHEUS = true
endif

ifneq (,$(filter ovn,$(_using)))
PRELOAD_IMAGES += submariner-networkplugin-syncer
override PRELOAD_IMAGES += submariner-networkplugin-syncer
endif

# Force running E2E with `subctl verify`
Expand Down
2 changes: 1 addition & 1 deletion scripts/shared/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -em

source "${SCRIPTS_DIR}/lib/utils"
print_env CABLE_DRIVER DEPLOYTOOL GLOBALNET IMAGE_TAG LIGHTHOUSE PARALLEL PLUGIN SETTINGS TIMEOUT
print_env CABLE_DRIVER DEPLOYTOOL GLOBALNET IMAGE_TAG LIGHTHOUSE PARALLEL PLUGIN PRELOAD_IMAGES SETTINGS TIMEOUT
source "${SCRIPTS_DIR}/lib/debug_functions"
source "${SCRIPTS_DIR}/lib/deploy_funcs"

Expand Down
18 changes: 13 additions & 5 deletions scripts/shared/lib/deploy_helm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ function helm_install_subm() {
return
fi

declare -a images_flags
for image in ${PRELOAD_IMAGES}; do
if [[ "${image}" = submariner-operator ]]; then
images_flags+=(--set operator.image.repository="${SUBM_IMAGE_REPO}/submariner-operator" \
--set operator.image.tag="${SUBM_IMAGE_TAG}" \
--set operator.image.pullPolicy="IfNotPresent")
continue
fi

images_flags+=(--set "images.${image}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
done

echo "Installing Submariner..."
# shellcheck disable=SC2086 # Split on purpose
helm --kube-context "${cluster}" install --debug --devel submariner-operator \
Expand All @@ -61,11 +73,7 @@ function helm_install_subm() {
--set serviceAccounts.lighthouseAgent.create="${LIGHTHOUSE}" \
--set serviceAccounts.lighthouseCoreDns.create="${LIGHTHOUSE}" \
--set submariner.natEnabled="false" \
--set operator.image.repository="${SUBM_IMAGE_REPO}/submariner-operator" \
--set operator.image.tag="${SUBM_IMAGE_TAG}" \
--set operator.image.pullPolicy="IfNotPresent" \
--set submariner.images.repository="${SUBM_IMAGE_REPO}" \
--set submariner.images.tag="${SUBM_IMAGE_TAG}" \
"${images_flags[@]}" \
--set brokercrds.create="${crd_create}"
}

Expand Down
10 changes: 6 additions & 4 deletions scripts/shared/lib/deploy_operator
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function setup_broker() {
# We use the "subctl" image_tag to indicate that we want to let
# subctl use its default repository and version
subctlrepver=
if [ "${SUBM_IMAGE_TAG}" != "subctl" ]; then
if [[ "${SUBM_IMAGE_TAG}" != "subctl" && "${PRELOAD_IMAGES}" =~ submariner-operator ]]; then
subctlrepver="--repository ${SUBM_IMAGE_REPO} --version ${SUBM_IMAGE_TAG}"
fi

Expand All @@ -52,9 +52,11 @@ function subctl_install_subm() {

# We use the "subctl" image_tag to indicate that we want to let
# subctl use its default repository and version
subctlrepver=
declare -a image_overrides
if [ "${SUBM_IMAGE_TAG}" != "subctl" ]; then
subctlrepver="--repository ${SUBM_IMAGE_REPO} --version ${SUBM_IMAGE_TAG}"
for image in ${PRELOAD_IMAGES}; do
image_overrides+=(--image-override "${image}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
done
fi

PASS_CIDR_ARGS=${PASS_CIDR_ARGS:-false}
Expand All @@ -65,7 +67,7 @@ function subctl_install_subm() {
# shellcheck disable=SC2086 # Split on purpose
"${SUBCTL}" join --kubecontext "${cluster}" \
--clusterid "${cluster}" \
${subctlrepver} \
"${image_overrides[@]}" \
--nattport "${CE_IPSEC_NATTPORT}" \
--globalnet-cidr "${global_CIDRs[$cluster]}" \
--natt=false \
Expand Down