Skip to content

Commit 74f8405

Browse files
authored
Merge pull request #120 from mallardduck/4.x-new-build
[2.11] Implement new build system
2 parents fd344f4 + 39839f3 commit 74f8405

File tree

4 files changed

+15
-53
lines changed

4 files changed

+15
-53
lines changed

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# To avoid polluting the Makefile, versions and checksums for tooling and
2-
# dependencies are defined at hack/make/deps.mk.
3-
include hack/make/deps.mk
4-
51
# Include logic that can be reused across projects.
62
include hack/make/build.mk
73

hack/make/deps.mk

Lines changed: 0 additions & 20 deletions
This file was deleted.

kubectl-versions.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
v1.30.13
2+
v1.31.9
3+
v1.32.5

package/Dockerfile

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,21 @@ RUN zypper --non-interactive refresh && \
2424
COPY --from=kuberlr /bin/kuberlr /chroot/bin/
2525
RUN cd /chroot/bin && ln -s ./kuberlr ./kubectl
2626
COPY --from=kuberlr /home/kuberlr /chroot/home/kuberlr
27-
RUN sed -i 's/AllowDownload = true/AllowDownload = false/' /chroot/home/kuberlr/.kuberlr/kuberlr.conf
2827

2928
WORKDIR /tmp
29+
COPY kubectl-versions.txt /tmp/kubectl-versions.txt
30+
# kuberlr get verifies bin hash for us
31+
RUN while read -r version; do \
32+
/chroot/bin/kuberlr get $version; \
33+
done < ./kubectl-versions.txt; \
34+
/chroot/bin/kuberlr bins \
35+
&& cp -a /root/.kuberlr/linux-*/* /chroot/usr/bin/ \
36+
&& /chroot/bin/kuberlr bins
37+
38+
# Disable ability to download kubectl due to air-gap support
39+
RUN sed -i 's/AllowDownload = true/AllowDownload = false/' /chroot/home/kuberlr/.kuberlr/kuberlr.conf
3040

31-
ARG KUBECTL_VERSION_INFO
32-
33-
SHELL ["/bin/bash", "-c"]
34-
RUN set -fx; versions=($KUBECTL_VERSION_INFO); \
35-
for i in "${!versions[@]}"; do \
36-
echo "The index is $i and the value is ${versions[$i]}"; \
37-
version=$(echo ${versions[$i]} | cut -d: -f1); \
38-
kubectl_url="https://dl.k8s.io/release/${version}/bin/linux/${TARGETARCH}/kubectl"; \
39-
kubectl_target="/tmp/kubectl${version:1}"; \
40-
echo "Downloading kubectl version ${version} from ${kubectl_url}"; \
41-
echo "Targeting ${kubectl_target}"; \
42-
curl -fsSL "$kubectl_url" -o "$kubectl_target"; \
43-
chmod 0755 "$kubectl_target"; \
44-
done
45-
46-
RUN set -fx; versions=($KUBECTL_VERSION_INFO); \
47-
for i in "${!versions[@]}"; do \
48-
version=$(echo ${versions[$i]} | cut -d: -f1); \
49-
arm64_sum=$(echo ${versions[$i]} | cut -d: -f2); \
50-
amd64_sum=$(echo ${versions[$i]} | cut -d: -f3); \
51-
kubectl_target="/tmp/kubectl${version:1}"; \
52-
KUBE_SUM_NAME="${TARGETARCH}_sum"; \
53-
KUBE_SUM=${!KUBE_SUM_NAME}; \
54-
echo "${KUBE_SUM} ${kubectl_target}" | sha256sum -c -; \
55-
done
56-
57-
RUN cp /tmp/kubectl* /chroot/usr/bin/
58-
41+
# Setup kuberlr user and perms
5942
RUN useradd -u 1000 -U kuberlr \
6043
&& cp /etc/passwd /chroot/etc/passwd \
6144
&& cp /etc/group /chroot/etc/group \

0 commit comments

Comments
 (0)