Merge branch 'main' of https://github.com/jpetazzo/shpod into jpetazzo-main

This commit is contained in:
Bret Fisher
2023-03-01 01:00:15 -05:00
5 changed files with 46 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ COPY helper-* /bin/
# https://github.com/docker/compose/releases # https://github.com/docker/compose/releases
FROM builder AS compose FROM builder AS compose
ARG COMPOSE_VERSION=2.1.1 ARG COMPOSE_VERSION=2.16.0
RUN helper-curl bin docker-compose \ RUN helper-curl bin docker-compose \
https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-linux-@UARCH https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-linux-@UARCH
@@ -20,7 +20,7 @@ RUN cp $(find bin -name crane) /usr/local/bin
# https://github.com/helm/helm/releases # https://github.com/helm/helm/releases
FROM builder AS helm FROM builder AS helm
ARG HELM_VERSION=3.7.1 ARG HELM_VERSION=3.11.1
RUN helper-curl tar "--strip-components=1 linux-@GOARCH/helm" \ RUN helper-curl tar "--strip-components=1 linux-@GOARCH/helm" \
https://get.helm.sh/helm-v${HELM_VERSION}-linux-@GOARCH.tar.gz https://get.helm.sh/helm-v${HELM_VERSION}-linux-@GOARCH.tar.gz
@@ -43,7 +43,7 @@ RUN cp $(find bin -name jid) /usr/local/bin
# https://github.com/derailed/k9s/releases # https://github.com/derailed/k9s/releases
FROM builder AS k9s FROM builder AS k9s
RUN helper-curl tar k9s \ RUN helper-curl tar k9s \
https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_@WTFARCH.tar.gz https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_@GOARCH.tar.gz
# https://github.com/kubernetes/kompose/releases # https://github.com/kubernetes/kompose/releases
FROM builder AS kompose FROM builder AS kompose
@@ -52,25 +52,25 @@ RUN helper-curl bin kompose \
# https://github.com/kubernetes/kubernetes/releases # https://github.com/kubernetes/kubernetes/releases
FROM builder AS kubectl FROM builder AS kubectl
ARG KUBECTL_VERSION=1.22.3 ARG KUBECTL_VERSION=1.26.1
RUN helper-curl bin kubectl \ RUN helper-curl bin kubectl \
https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/@GOARCH/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/@GOARCH/kubectl
# https://github.com/stackrox/kube-linter/releases # https://github.com/stackrox/kube-linter/releases
FROM builder AS kube-linter FROM builder AS kube-linter
ARG KUBELINTER_VERSION=0.2.5 ARG KUBELINTER_VERSION=0.6.0
RUN go install golang.stackrox.io/kube-linter/cmd/kube-linter@$KUBELINTER_VERSION RUN go install golang.stackrox.io/kube-linter/cmd/kube-linter@$KUBELINTER_VERSION
RUN cp $(find bin -name kube-linter) /usr/local/bin RUN cp $(find bin -name kube-linter) /usr/local/bin
# https://github.com/bitnami-labs/sealed-secrets/releases # https://github.com/bitnami-labs/sealed-secrets/releases
FROM builder AS kubeseal FROM builder AS kubeseal
ARG KUBESEAL_VERSION=0.16.0 ARG KUBESEAL_VERSION=0.19.5
RUN helper-curl bin kubeseal \ RUN helper-curl tar kubeseal \
https://github.com/bitnami-labs/sealed-secrets/releases/download/v$KUBESEAL_VERSION/kubeseal-@KSARCH https://github.com/bitnami-labs/sealed-secrets/releases/download/v$KUBESEAL_VERSION/kubeseal-$KUBESEAL_VERSION-linux-@GOARCH.tar.gz
# https://github.com/kubernetes-sigs/kustomize/releases # https://github.com/kubernetes-sigs/kustomize/releases
FROM builder AS kustomize FROM builder AS kustomize
ARG KUSTOMIZE_VERSION=4.4.1 ARG KUSTOMIZE_VERSION=4.5.7
RUN helper-curl tar kustomize \ RUN helper-curl tar kustomize \
https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v$KUSTOMIZE_VERSION/kustomize_v${KUSTOMIZE_VERSION}_linux_@GOARCH.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v$KUSTOMIZE_VERSION/kustomize_v${KUSTOMIZE_VERSION}_linux_@GOARCH.tar.gz
@@ -86,7 +86,7 @@ RUN helper-curl tar popeye \
# https://github.com/regclient/regclient/releases # https://github.com/regclient/regclient/releases
FROM builder AS regctl FROM builder AS regctl
ARG REGCLIENT_VERSION=0.3.9 ARG REGCLIENT_VERSION=0.4.5
RUN helper-curl bin regctl \ RUN helper-curl bin regctl \
https://github.com/regclient/regclient/releases/download/v$REGCLIENT_VERSION/regctl-linux-@GOARCH https://github.com/regclient/regclient/releases/download/v$REGCLIENT_VERSION/regctl-linux-@GOARCH
@@ -99,26 +99,38 @@ ARG SHIP_VERSION=0.51.3
RUN helper-curl tar ship \ RUN helper-curl tar ship \
https://github.com/replicatedhq/ship/releases/download/v${SHIP_VERSION}/ship_${SHIP_VERSION}_linux_@GOARCH.tar.gz https://github.com/replicatedhq/ship/releases/download/v${SHIP_VERSION}/ship_${SHIP_VERSION}_linux_@GOARCH.tar.gz
# https://github.com/GoogleContainerTools/skaffold/releases/tag/v1.34.0 # https://github.com/GoogleContainerTools/skaffold/releases
FROM builder AS skaffold FROM builder AS skaffold
RUN helper-curl bin skaffold \ RUN helper-curl bin skaffold \
https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-@GOARCH https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-@GOARCH
# https://github.com/stern/stern/releases # https://github.com/stern/stern/releases
FROM builder AS stern FROM builder AS stern
ARG STERN_VERSION=1.20.1 ARG STERN_VERSION=1.23.0
RUN helper-curl tar "--strip-components=1 stern_${STERN_VERSION}_linux_@GOARCH/stern" \ RUN helper-curl tar stern \
https://github.com/stern/stern/releases/download/v${STERN_VERSION}/stern_${STERN_VERSION}_linux_@GOARCH.tar.gz https://github.com/stern/stern/releases/download/v${STERN_VERSION}/stern_${STERN_VERSION}_linux_@GOARCH.tar.gz
# https://github.com/tilt-dev/tilt/releases/ # https://github.com/tilt-dev/tilt/releases
FROM builder AS tilt FROM builder AS tilt
ARG TILT_VERSION=0.23.0 ARG TILT_VERSION=0.31.2
RUN helper-curl tar tilt \ RUN helper-curl tar tilt \
https://github.com/tilt-dev/tilt/releases/download/v${TILT_VERSION}/tilt.${TILT_VERSION}.linux.@WTFARCH.tar.gz https://github.com/tilt-dev/tilt/releases/download/v${TILT_VERSION}/tilt.${TILT_VERSION}.linux-alpine.@WTFARCH.tar.gz
# https://github.com/carvel-dev/ytt/releases
FROM builder AS ytt
ARG YTT_VERSION=0.44.3
RUN helper-curl bin ytt \
https://github.com/carvel-dev/ytt/releases/download/v${YTT_VERSION}/ytt-linux-@GOARCH
# https://github.com/carvel-dev/kapp/releases
FROM builder AS kapp
ARG YTT_VERSION=0.54.3
RUN helper-curl bin kapp \
https://github.com/carvel-dev/kapp/releases/download/v${YTT_VERSION}/kapp-linux-@GOARCH
FROM alpine AS shpod FROM alpine AS shpod
ENV COMPLETIONS=/usr/share/bash-completion/completions ENV COMPLETIONS=/usr/share/bash-completion/completions
RUN apk add --no-cache apache2-utils bash bash-completion curl docker-cli file git iputils jq libintl ncurses openssh openssl sudo tmux tree vim yq RUN apk add --no-cache apache2-utils bash bash-completion curl docker-cli file gettext git iputils jq libintl ncurses openssh openssl screen sudo tmux tree vim yq
COPY --from=compose /usr/local/bin/docker-compose /usr/local/bin COPY --from=compose /usr/local/bin/docker-compose /usr/local/bin
COPY --from=crane /usr/local/bin/crane /usr/local/bin COPY --from=crane /usr/local/bin/crane /usr/local/bin
@@ -126,6 +138,7 @@ COPY --from=helm /usr/local/bin/helm /usr/local/bin
COPY --from=httping /usr/local/bin/httping /usr/local/bin COPY --from=httping /usr/local/bin/httping /usr/local/bin
COPY --from=jid /usr/local/bin/jid /usr/local/bin COPY --from=jid /usr/local/bin/jid /usr/local/bin
COPY --from=k9s /usr/local/bin/k9s /usr/local/bin COPY --from=k9s /usr/local/bin/k9s /usr/local/bin
COPY --from=kapp /usr/local/bin/kapp /usr/local/bin
COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin
COPY --from=kube-linter /usr/local/bin/kube-linter /usr/local/bin COPY --from=kube-linter /usr/local/bin/kube-linter /usr/local/bin
COPY --from=kubeseal /usr/local/bin/kubeseal /usr/local/bin COPY --from=kubeseal /usr/local/bin/kubeseal /usr/local/bin
@@ -137,16 +150,19 @@ COPY --from=ship /usr/local/bin/ship /usr/local/bin
COPY --from=skaffold /usr/local/bin/skaffold /usr/local/bin COPY --from=skaffold /usr/local/bin/skaffold /usr/local/bin
COPY --from=stern /usr/local/bin/stern /usr/local/bin COPY --from=stern /usr/local/bin/stern /usr/local/bin
COPY --from=tilt /usr/local/bin/tilt /usr/local/bin COPY --from=tilt /usr/local/bin/tilt /usr/local/bin
COPY --from=ytt /usr/local/bin/ytt /usr/local/bin
RUN set -e ; for BIN in \ RUN set -e ; for BIN in \
crane \ crane \
helm \ helm \
kapp \
kubectl \ kubectl \
kube-linter \ kube-linter \
kustomize \ kustomize \
regctl \ regctl \
skaffold \ skaffold \
tilt \ tilt \
ytt \
; do echo $BIN ; $BIN completion bash > $COMPLETIONS/$BIN.bash ; done ;\ ; do echo $BIN ; $BIN completion bash > $COMPLETIONS/$BIN.bash ; done ;\
yq shell-completion bash > $COMPLETIONS/yq.bash yq shell-completion bash > $COMPLETIONS/yq.bash
@@ -173,14 +189,18 @@ RUN echo k8s:x:1000: >> /etc/group \
&& chown -R k8s:k8s /home/k8s/ \ && chown -R k8s:k8s /home/k8s/ \
&& sed -i 's/#MaxAuthTries 6/MaxAuthTries 42/' /etc/ssh/sshd_config && sed -i 's/#MaxAuthTries 6/MaxAuthTries 42/' /etc/ssh/sshd_config
ARG TARGETARCH ARG TARGETARCH
RUN mkdir /tmp/krew \ RUN \
if [ "$TARGETARCH" != "386" ]; then \
mkdir /tmp/krew \
&& cd /tmp/krew \ && cd /tmp/krew \
&& curl -fsSL https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_$TARGETARCH.tar.gz | tar -zxf- \ && curl -fsSL https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_$TARGETARCH.tar.gz | tar -zxf- \
&& sudo -u k8s -H ./krew-linux_$TARGETARCH install krew \ && sudo -u k8s -H ./krew-linux_$TARGETARCH install krew \
&& cd \ && cd \
&& rm -rf /tmp/krew && rm -rf /tmp/krew \
; fi
COPY --chown=1000:1000 bash_profile /home/k8s/.bash_profile COPY --chown=1000:1000 bash_profile /home/k8s/.bash_profile
COPY --chown=1000:1000 vimrc /home/k8s/.vimrc COPY --chown=1000:1000 vimrc /home/k8s/.vimrc
COPY --chown=1000:1000 tmux.conf /home/k8s/.tmux.conf
COPY motd /etc/motd COPY motd /etc/motd
COPY setup-tailhist.sh /usr/local/bin COPY setup-tailhist.sh /usr/local/bin
@@ -190,6 +210,7 @@ RUN ( \
bash --version | head -n1 ;\ bash --version | head -n1 ;\
curl --version | head -n1 ;\ curl --version | head -n1 ;\
docker version --format="Docker {{.Client.Version}}" ;\ docker version --format="Docker {{.Client.Version}}" ;\
envsubst --version | head -n1 ;\
git --version ;\ git --version ;\
jq --version ;\ jq --version ;\
ssh -V ;\ ssh -V ;\
@@ -201,6 +222,7 @@ RUN ( \
httping --version ;\ httping --version ;\
jid --version ;\ jid --version ;\
echo "k9s $(k9s version | grep Version)" ;\ echo "k9s $(k9s version | grep Version)" ;\
kapp --version | head -n1 ;\
echo "kubectl $(kubectl version --short --client)" ;\ echo "kubectl $(kubectl version --short --client)" ;\
echo "kube-linter $(kube-linter version)" ;\ echo "kube-linter $(kube-linter version)" ;\
kubeseal --version ;\ kubeseal --version ;\

View File

@@ -20,6 +20,7 @@ It includes:
- curl - curl
- Docker CLI - Docker CLI
- Docker Compose - Docker Compose
- envsubst
- git - git
- Helm - Helm
- jid - jid

View File

@@ -6,6 +6,9 @@ if ! [ -f ~/.kube/config ]; then
# We need to access the Kubernetes API, so we'll do it # We need to access the Kubernetes API, so we'll do it
# using the well-known endpoint. # using the well-known endpoint.
( (
# Make sure that the file will have locked-down permissions.
# (Some tools like Helm will complain about it otherwise.)
umask 077
export KUBERNETES_SERVICE_HOST=kubernetes.default.svc export KUBERNETES_SERVICE_HOST=kubernetes.default.svc
export KUBERNETES_SERVICE_PORT=443 export KUBERNETES_SERVICE_PORT=443
if kubectl get configmap kubeconfig >&/dev/null; then if kubectl get configmap kubeconfig >&/dev/null; then

View File

@@ -9,26 +9,22 @@ URL=$3
case $TARGETARCH in case $TARGETARCH in
amd64) amd64)
GOARCH=amd64 GOARCH=amd64
KSARCH=linux-amd64
UARCH=x86_64 UARCH=x86_64
WTFARCH=x86_64 WTFARCH=x86_64
;; ;;
arm64) arm64)
GOARCH=arm64 GOARCH=arm64
KSARCH=arm64
UARCH=aarch64 UARCH=aarch64
WTFARCH=arm64 WTFARCH=arm64
;; ;;
arm) arm)
GOARCH=arm GOARCH=arm
KSARCH=arm
UARCH=armv7 UARCH=armv7
WTFARCH=arm WTFARCH=arm
;; ;;
*) *)
echo "Unsupported architecture: $TARGETARCH." echo "Unsupported architecture: $TARGETARCH."
GOARCH=$TARGETARCH GOARCH=$TARGETARCH
KSARCH=$TARGETARCH
UARCH=$TARGETARCH UARCH=$TARGETARCH
WTFARCH=$TARGETARCH WTFARCH=$TARGETARCH
;; ;;
@@ -37,7 +33,6 @@ esac
mangle() { mangle() {
echo $1 | sed \ echo $1 | sed \
-e s/@GOARCH/$GOARCH/g \ -e s/@GOARCH/$GOARCH/g \
-e s/@KSARCH/$KSARCH/g \
-e s/@UARCH/$UARCH/g \ -e s/@UARCH/$UARCH/g \
-e s/@WTFARCH/$WTFARCH/g \ -e s/@WTFARCH/$WTFARCH/g \
# #

1
tmux.conf Normal file
View File

@@ -0,0 +1 @@
set -g status-style bg=blue,fg=white,bold