Skip to contentSkip to conversation

compat: make spaas url configurable

PATCH In review Andrei Kvapil 2 participants 4 messages Jun 15, 2022 – Jun 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: make spaas url configurable

Add opportunity to override SPAAS_URL with local address in case of building drbd in environments without external internet connectivity.

---
 Makefile                                    | 1 +
 drbd/Makefile                               | 2 ++
 drbd/drbd-kernel-compat/gen_compat_patch.sh | 7 ++++---
 3 files changed, 7 insertions(+), 3 deletions(-)
Makefile +1 -0
index 87c29518..37d7851d 100644
@@ -37,6 +37,7 @@ DOCKERIMAGESTARGETS = $(addprefix dockerimage.,$(DOCKERIMAGES))
 # Use the SPAAS (spatch as a service) online service
 # Have this as make variable for distributions.
 SPAAS ?= true
+SPAAS_URL ?= https://drbd.io:2020
 
 # default for KDIR/KVER
 ifndef KVER
drbd/Makefile +2 -0
index 597cf30f..089e5e3a 100644
@@ -40,7 +40,9 @@ MAKEFLAGS += -rR --no-print-directory
 # Use the SPAAS (spatch as a service) online service
 # Have this as make variable for distributions.
 SPAAS ?= true
+SPAAS_URL ?= https://drbd.io:2020
 export SPAAS
+export SPAAS_URL
 
 # since 2.6.16, KERNELRELEASE may be empty,
 # e.g. when building against some (broken?) linux-header package.
drbd/drbd-kernel-compat/gen_compat_patch.sh +4 -3
index c57b961c..b8595722 100644
@@ -125,10 +125,11 @@ else
     echo "  SPAAS    $chksum"
 
     # check if SPAAS is even reachable
-    if ! curl -fsS https://drbd.io:2020/api/v1/hello; then
+    SPAAS_URL=${SPAAS_URL:-https://drbd.io:2020}
+    if ! curl -fsS $SPAAS_URL/api/v1/hello; then
         echo "  ERROR: SPAAS is not reachable! Please check if your network"
         echo "  configuration or some firewall prohibits access to "
-        echo "  https://drbd.io:2020."
+        echo "  $SPAAS_URL."
         exit 1
     fi
 
@@ -136,7 +137,7 @@ else
     rm -f $compat_patch.tmp.header $compat_patch.tmp
     if ! base64 $incdir/compat.h |
 	curl -T - -X POST -o $compat_patch.tmp -D $compat_patch.tmp.header -f \
-	    https://drbd.io:2020/api/v1/spatch/$REL_VERSION
+	    $SPAAS_URL/api/v1/spatch/$REL_VERSION
     then
 	ex=${PIPESTATUS[*]}
 	(
Signature · 1 line
2.32.0 (Apple Git-132)
#1 lore raw

Thanks for the contribution. Seems like a reasonable idea to me.

Makefile DOCKERIMAGESTARGETS = $(addprefix dockerimage.,$(DOCKERIMAGES)) · line 40

Quoted 9 lines
Makefile +1 -0
index 87c29518..37d7851d 100644
@@ -37,6 +37,7 @@ DOCKERIMAGESTARGETS = $(addprefix dockerimage.,$(DOCKERIMAGES))
 # Use the SPAAS (spatch as a service) online service
 # Have this as make variable for distributions.
 SPAAS ?= true
+SPAAS_URL ?= https://drbd.io:2020

What is the purpose of this definition in the top-level Makefile? As far as I can see, it is only needed in the other one.

I guess it serves a documentation purpose, showing what command line variables can be set. That is presumably the point of the SPAAS variable in the top-level makefile. In that case, explicitly pass it down like the SPAAS variable for consistency.

Best regards,
Joel

author
#2 lore raw

Yeah. There are some discussions about the needs for this change:
- https://github.com/LINBIT/saas/pull/1#issuecomment-1152117095
- https://github.com/piraeusdatastore/piraeus-operator/issues/315

In short: we're running SPAAS locally to allow our clients with isolated environments be able to build DRBD module in their clusters without need of spatch dependency as it adds additional 523 megabytes to every container.

Quoted 1 line

What is the purpose of this definition in the top-level Makefile? As far

as I can see, it is only needed in the other one.

Quoted 2 lines

I guess it serves a documentation purpose, showing what command line

variables can be set. That is presumably the point of the SPAAS variable in the top-level makefile. In that case, explicitly pass it down like the SPAAS variable for consistency.

Yes, I just added it into the same files where the SPAAS variable is specified.
I think it is good to have it described somewhere, but it always has a default value and it can work without specifying it in Makefiles at all.

Best Regards,
Andrei Kvapil

Quoted 24 lines · Joel Colledge

Thanks for the contribution. Seems like a reasonable idea to me.

Makefile DOCKERIMAGESTARGETS = $(addprefix

Quoted 5 lines
Makefile +0 -0
index 87c29518..37d7851d 100644
@@ -37,6 +37,7 @@ DOCKERIMAGESTARGETS = $(addprefix

dockerimage.,$(DOCKERIMAGES))

Makefile DOCKERIMAGESTARGETS = $(addprefix dockerimage.,$(DOCKERIMAGES)) · line 40

Quoted 4 lines
Makefile +1 -0
 # Use the SPAAS (spatch as a service) online service
 # Have this as make variable for distributions.
 SPAAS ?= true
+SPAAS_URL ?= https://drbd.io:2020

What is the purpose of this definition in the top-level Makefile? As far as I can see, it is only needed in the other one.

I guess it serves a documentation purpose, showing what command line variables can be set. That is presumably the point of the SPAAS variable in the top-level makefile. In that case, explicitly pass it down like the SPAAS variable for consistency.

Best regards,
Joel