Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 0 additions & 8 deletions hack/make/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ KUBECTL_SUM_arm64 := cd859449f54ad2cb05b491c490c13bb836cdd0886ae013c0aed3dd67ff7
# renovate-local: kubectl-amd64=v1.35.2
KUBECTL_SUM_amd64 := 924eb50779153f20cb668117d141440b95df2f325a64452d78dff9469145e277

# renovate-local: kustomize-amd64
KUSTOMIZE_VERSION := v5.7.1
# renovate-local: kustomize-arm64=v5.7.1
KUSTOMIZE_SUM_arm64 := 4261a040217df3bd6896597c3986d1465925726e4f22a945304b5233a4dcdbda
# renovate-local: kustomize-amd64=v5.7.1
KUSTOMIZE_SUM_amd64 := ea375e7372f9aa029129d4b2d16c66b7750b7f1213c4f66f910d981c895818d8

# renovate: datasource=github-release-attachments depName=derailed/k9s
K9S_VERSION := v0.50.18
# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.50.18
Expand All @@ -26,5 +19,4 @@ K9S_SUM_amd64 := 0b697ed4aa80997f7de4deeed6f1fba73df191b28bf691b1f28d2f45fa2a9e9
# Reduces the code duplication on Makefile by keeping all args into a single variable.
IMAGE_ARGS := --build-arg HELM_VERSION=$(HELM_VERSION) --build-arg HELM_SUM_arm64=$(HELM_SUM_arm64) --build-arg HELM_SUM_amd64=$(HELM_SUM_amd64) \
--build-arg KUBECTL_VERSION=$(KUBECTL_VERSION) --build-arg KUBECTL_SUM_arm64=$(KUBECTL_SUM_arm64) --build-arg KUBECTL_SUM_amd64=$(KUBECTL_SUM_amd64) \
--build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) --build-arg KUSTOMIZE_SUM_arm64=$(KUSTOMIZE_SUM_arm64) --build-arg KUSTOMIZE_SUM_amd64=$(KUSTOMIZE_SUM_amd64) \
--build-arg K9S_VERSION=$(K9S_VERSION) --build-arg K9S_SUM_arm64=$(K9S_SUM_arm64) --build-arg K9S_SUM_amd64=$(K9S_SUM_amd64)
6 changes: 2 additions & 4 deletions hack/test
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ function expected_file(){
file="$1"
owner="$2"
perms="$3"

actualPerms=$(stat '%a' "${file}")
actualOwner=$(stat '%u:%g' "${file}")
if [[ "${actualPerms}" != "${perms}" ]] || \
[[ "${actualOwner}" != "${owner}" ]]; then
echo "${file}: expected (${owner} ${perms}) got (${actualOwner} ${actualPerms})"
exit 1
else
else
echo "${file}: OK"
fi
}
Expand All @@ -37,7 +37,6 @@ function check_files(){
expected_file "/usr/local/bin/kubectl" "0:0" "755"
expected_file "/usr/local/bin/kustomize" "0:0" "755"
expected_file "/usr/local/bin/welcome" "0:0" "755"
expected_file "/home/shell/kustomize.sh" "1000:1000" "755"
}


Expand All @@ -62,7 +61,6 @@ function expected_version(){
function check_versions(){
echo "checking command versions:"
expected_version "helm" "${HELM_VERSION}"
expected_version "kustomize" "${KUSTOMIZE_VERSION}"
expected_version "k9s" "${K9S_VERSION}"
# --client=true is used so that it does not fail trying to
# identify the server version.
Expand Down
15 changes: 3 additions & 12 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ RUN zypper -n install curl gzip tar
# Define build arguments
ARG KUBECTL_VERSION KUBECTL_SUM_arm64 KUBECTL_SUM_amd64 \
HELM_VERSION HELM_SUM_arm64 HELM_SUM_amd64 \
KUSTOMIZE_VERSION KUSTOMIZE_SUM_arm64 KUSTOMIZE_SUM_amd64 \
K9S_VERSION K9S_SUM_arm64 K9S_SUM_amd64

ARG TARGETARCH
Expand All @@ -26,13 +25,6 @@ ENV HELM_SUM="HELM_SUM_${TARGETARCH}"
RUN echo "${!HELM_SUM} /tmp/helm.tar.gz" | sha256sum -c - && \
tar -xvzf /tmp/helm.tar.gz --strip-components=1 -C / "linux-${TARGETARCH}/helm"

# Stage kustomize into build
ADD "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_${TARGETARCH}.tar.gz" \
/tmp/kustomize.tar.gz
ENV KUSTOMIZE_SUM="KUSTOMIZE_SUM_${TARGETARCH}"
RUN echo "${!KUSTOMIZE_SUM} /tmp/kustomize.tar.gz" | sha256sum -c - && \
tar -xvzf /tmp/kustomize.tar.gz -C / kustomize

# Stage k9s into build
ADD "https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" \
/tmp/k9s.tar.gz
Expand All @@ -55,7 +47,7 @@ RUN zypper --non-interactive refresh && \
zypper --installroot /chroot -n in bash-completion jq vim curl && \
zypper --installroot /chroot clean -a && \
rm -rf /chroot/var/cache/zypp/* /chroot/var/log/zypp/* /chroot/etc/zypp/ /chroot/run/zypp.pid


RUN echo 'shell:x:1000:1000:shell,,,:/home/shell:/bin/bash' > /chroot/etc/passwd && \
echo 'shell:x:1000:' > /chroot/etc/group && \
Expand All @@ -74,9 +66,8 @@ RUN echo 'shell:x:1000:1000:shell,,,:/home/shell:/bin/bash' > /chroot/etc/passwd
FROM scratch

COPY --from=zypper /chroot /
COPY --chown=root:root --chmod=0755 --from=build /kubectl /helm /k9s /kustomize* /usr/local/bin/
COPY --chown=root:root --chmod=0755 package/helm-cmd package/welcome /usr/local/bin/
COPY --chown=1000:1000 --chmod=0755 package/kustomize.sh /home/shell/
COPY --chown=root:root --chmod=0755 --from=build /kubectl /helm /k9s /usr/local/bin/
COPY --chown=root:root --chmod=0755 package/helm-cmd package/welcome package/kustomize /usr/local/bin/

USER 1000

Expand Down
8 changes: 0 additions & 8 deletions package/helm-cmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ for i in $(seq 1 20); do
done

for i in operation*; do
# If a kustomize yaml has been passed along with the operation
Comment thread
rmoioliveira marked this conversation as resolved.
# it will have the same numerical suffix.
kustomization=$(echo $i.yaml | sed "s/operation/kustomization/g")
if [[ -f $kustomization ]]; then
# Renaming file because kustomize only supports the following filenames:
# kustomization.yaml, kustomization.yml, and Kustomization.
cp $kustomization kustomization.yaml
fi
cat $i | xargs -0 -- echo helm
cat $i | xargs -0 -- helm
echo
Expand Down
38 changes: 38 additions & 0 deletions package/kustomize
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

declare TRACE
[[ "${TRACE}" == 1 ]] && set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
set -o noclobber

kustomize-proxy() {
exec kubectl kustomize "${@}"
}

args-parse() {
if [[ "$#" -eq 0 ]]; then
1>&2 printf "error: no subcommand given\n"
exit 1
fi

while [[ "$#" -gt 0 ]]; do
case "${1}" in
build)
shift
kustomize-proxy "${@}"
;;
*)
1>&2 printf "error: subcommand \`%s\` not supported, only \`build\` is available\n" "${1}"
exit 1
;;
esac
done
}

main() {
args-parse "$@"
}

main "$@"
5 changes: 0 additions & 5 deletions package/kustomize.sh

This file was deleted.

99 changes: 0 additions & 99 deletions scripts/update-kustomize.sh

This file was deleted.