Skip to content

Commit 53ed9fb

Browse files
committed
Make flannel package optional to build
`WITH_FLANNEL` env now we can build the flannel package with condition and default value is `0` which means not building it.
1 parent 954833d commit 53ed9fb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PATCH := $(shell echo $(SOURCE_GIT_TAG) | awk -F'[._~-]' '{print $$3}')
2929

3030
SRC_ROOT :=$(shell pwd)
3131

32+
WITH_FLANNEL ?= 0
3233
OUTPUT_DIR :=_output
3334
RPM_BUILD_DIR :=$(OUTPUT_DIR)/rpmbuild
3435
ISO_DIR :=$(OUTPUT_DIR)/image-builder
@@ -286,6 +287,7 @@ rpm:
286287
SOURCE_GIT_TAG=${SOURCE_GIT_TAG} \
287288
SOURCE_GIT_COMMIT=${SOURCE_GIT_COMMIT} \
288289
SOURCE_GIT_TREE_STATE=${SOURCE_GIT_TREE_STATE} \
290+
WITH_FLANNEL=${WITH_FLANNEL} \
289291
./packaging/rpm/make-rpm.sh rpm local
290292
.PHONY: rpm
291293

@@ -295,6 +297,7 @@ srpm:
295297
SOURCE_GIT_TAG=${SOURCE_GIT_TAG} \
296298
SOURCE_GIT_COMMIT=${SOURCE_GIT_COMMIT} \
297299
SOURCE_GIT_TREE_STATE=${SOURCE_GIT_TREE_STATE} \
300+
WITH_FLANNEL=${WITH_FLANNEL} \
298301
./packaging/rpm/make-rpm.sh srpm local
299302
.PHONY: srpm
300303

packaging/rpm/make-rpm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e -o pipefail
33

44
# must be passed down to this script from Makefile
5-
ENV_VARS="MICROSHIFT_VERSION RPM_RELEASE SOURCE_GIT_TAG SOURCE_GIT_TREE_STATE"
5+
ENV_VARS="MICROSHIFT_VERSION RPM_RELEASE SOURCE_GIT_TAG SOURCE_GIT_TREE_STATE WITH_FLANNEL"
66
for env in ${ENV_VARS} ; do
77
if [[ -z "${!env}" ]] ; then
88
echo "Error: Mandatory environment variable '${env}' is missing"
@@ -68,7 +68,7 @@ EOF
6868
# algorithm.
6969
# shellcheck disable=SC2086
7070
# We want word splitting to happen with RPMBUILD_OPT for flags to be interpreted correctly
71-
rpmbuild --quiet ${RPMBUILD_OPT} --define "_topdir ${RPMBUILD_DIR}" --define "_binary_payload w19T8.zstdio" "${RPMBUILD_DIR}"SPECS/microshift.spec
71+
rpmbuild --quiet ${RPMBUILD_OPT} --define "_topdir ${RPMBUILD_DIR}" --define "_binary_payload w19T8.zstdio" --define "with_flannel ${WITH_FLANNEL}" "${RPMBUILD_DIR}"SPECS/microshift.spec
7272
}
7373

7474
print_info() {

packaging/rpm/microshift.spec

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
# Git related details
3636
%global shortcommit %(c=%{commit}; echo ${c:0:7})
3737

38+
# Don't build flannel subpackage by default
39+
%{!?with_flannel: %global with_flannel 0}
40+
3841
Name: microshift
3942
Version: %{version}
4043
Release: %{release}%{dist}
@@ -165,6 +168,7 @@ The microshift-multus-release-info package provides release information files fo
165168
release. These files contain the list of container image references used by
166169
the Multus CNI for MicroShift and can be used to embed those images into osbuilder blueprints.
167170

171+
%if %{with_flannel}
168172
%package flannel
169173
Summary: flannel CNI for MicroShift
170174
ExclusiveArch: x86_64 aarch64
@@ -184,6 +188,7 @@ The microshift-flannel-release-info package provides release information files f
184188
release. These files contain the list of container image references used by the flannel CNI
185189
with the dependent kube-proxy for MicroShift and can be used to embed those images
186190
into osbuilder blueprints.
191+
%endif
187192

188193
%package low-latency
189194
Summary: Baseline configuration for running low latency workload on MicroShift
@@ -379,6 +384,7 @@ cat assets/optional/multus/kustomization.x86_64.yaml >> %{buildroot}/%{_prefix}/
379384
mkdir -p -m755 %{buildroot}%{_datadir}/microshift/release
380385
install -p -m644 assets/optional/multus/release-multus-{x86_64,aarch64}.json %{buildroot}%{_datadir}/microshift/release/
381386

387+
%if %{with_flannel}
382388
# kube-proxy
383389
install -d -m755 %{buildroot}/%{_prefix}/lib/microshift/manifests.d/000-microshift-kube-proxy
384390
# Copy all the manifests except the arch specific ones
@@ -417,6 +423,7 @@ cat assets/optional/flannel/kustomization.x86_64.yaml >> %{buildroot}/%{_prefix}
417423
# flannel-release-info
418424
mkdir -p -m755 %{buildroot}%{_datadir}/microshift/release
419425
install -p -m644 assets/optional/flannel/release-flannel-{x86_64,aarch64}.json %{buildroot}%{_datadir}/microshift/release/
426+
%endif
420427

421428
# cleanup kubelet
422429
install -p -m644 packaging/tuned/microshift-cleanup-kubelet.service %{buildroot}%{_unitdir}/microshift-cleanup-kubelet.service
@@ -569,6 +576,7 @@ fi
569576
%files multus-release-info
570577
%{_datadir}/microshift/release/release-multus-{x86_64,aarch64}.json
571578

579+
%if %{with_flannel}
572580
%files flannel
573581
%dir %{_prefix}/lib/microshift/manifests.d/000-microshift-flannel
574582
%dir %{_prefix}/lib/microshift/manifests.d/000-microshift-kube-proxy
@@ -580,6 +588,7 @@ fi
580588
%files flannel-release-info
581589
%{_datadir}/microshift/release/release-flannel-{x86_64,aarch64}.json
582590
%{_datadir}/microshift/release/release-kube-proxy-{x86_64,aarch64}.json
591+
%endif
583592

584593
%files low-latency
585594
%{_prefix}/lib/tuned/microshift-baseline

0 commit comments

Comments
 (0)