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

Allow for non-root klipper-helm operation #29

Merged
merged 6 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 5 deletions entry
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ helm_repo_init() {
helm_content_decode() {
set -e
ENC_CHART_PATH="/chart/${NAME}.tgz.base64"
CHART_PATH="/${NAME}.tgz"
CHART_PATH="/tmp/${NAME}.tgz"
if [[ ! -f "${ENC_CHART_PATH}" ]]; then
return
fi
Expand All @@ -110,7 +110,8 @@ helm_content_decode() {
set +e
}

HELM="helm_v3"
export HELM_TLS_CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
HELM="helm_v3 --ca-file=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
mddamato marked this conversation as resolved.
Show resolved Hide resolved
NAME_ARG=""
TIMEOUT_ARG=""
JQ_CMD='"\(.[0].app_version),\(.[0].status)"'
Expand All @@ -119,9 +120,6 @@ set -e -v
CHART="${CHART//%\{KUBERNETES_API\}%/${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}}"
set +v -x

cp /var/run/secrets/kubernetes.io/serviceaccount/ca.crt /usr/local/share/ca-certificates/
update-ca-certificates

if [[ "${BOOTSTRAP}" != "true" ]]; then
tiller --listen=127.0.0.1:44134 --storage=secret &
export HELM_HOST=127.0.0.1:44134
Expand Down
7 changes: 6 additions & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ RUN mkdir -p /go/src/github.com/k3s-io/helm-set-status && \
make -C /go/src/github.com/k3s-io/helm-set-status install

FROM alpine:3.12
RUN apk add -U --no-cache ca-certificates jq bash git
WORKDIR /home/klipper-helm
ENV HOME=/home/klipper-helm
COPY --from=extract /usr/bin/helm_v2 /usr/bin/helm_v3 /usr/bin/tiller /usr/bin/
COPY --from=plugins /root/.local/share/helm/plugins/ /root/.local/share/helm/plugins/
mddamato marked this conversation as resolved.
Show resolved Hide resolved
COPY entry /usr/bin/
RUN apk add -U --no-cache ca-certificates jq bash git && \
mddamato marked this conversation as resolved.
Show resolved Hide resolved
chown 1000:1000 -R /home/klipper-helm && \
mddamato marked this conversation as resolved.
Show resolved Hide resolved
chmod +x /usr/bin/entry
mddamato marked this conversation as resolved.
Show resolved Hide resolved
ENTRYPOINT ["entry"]
ENV STABLE_REPO_URL=https://charts.helm.sh/stable/
ENV TIMEOUT=
USER 1000