Skip to content

Commit

Permalink
Automatically print kube context in dapper shell
Browse files Browse the repository at this point in the history
Use `kube-ps1` to print out the current context inside the dapper shell
(when running `make shell`).

This makes it easy to keep track of the current context and namespace,
and avoid confusion.

Signed-off-by: Mike Kolesnik <[email protected]>
  • Loading branch information
mkolesnik committed Nov 21, 2023
1 parent ffa8df0 commit dd72d53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WORKDIR ${DAPPER_SOURCE}

RUN git config --global --add safe.directory ${DAPPER_SOURCE}
RUN git config --global --add safe.directory ${OVN_DIR}
RUN echo "source /root/.local/bin/kube-ps1.sh; PS1='[\u@\h \W \$(kube_ps1)]\$ '" >> /root/.bashrc

ENTRYPOINT ["/opt/shipyard/scripts/entry"]
CMD ["sh"]
2 changes: 2 additions & 0 deletions package/Dockerfile.shipyard-dapper-base
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/root/.l
# helm | e2e tests
# jq | JSON processing (GitHub API)
# kind | e2e tests
# kube-ps1 | print out kube context in dapper shell
# kubectl | e2e tests (in kubernetes-client)
# make | OLM installation
# moby-engine | Docker (for Dapper)
Expand Down Expand Up @@ -69,6 +70,7 @@ RUN LINT_VERSION=$(awk '/golangci-lint/ { print $2 }' /tools.mod) && \
BUILDX_VERSION=$(awk '/docker.buildx/ { print $2 }' /tools.mod) && \
curl -L "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-${ARCH}" -o /usr/local/libexec/docker/cli-plugins/docker-buildx && \
chmod 755 /usr/local/libexec/docker/cli-plugins/docker-buildx && \
curl -L https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh -o /root/.local/bin/kube-ps1.sh && \
find /go/bin /usr/local/libexec/docker/cli-plugins -type f -executable -newercc /proc -exec strip {} + && \
find /go/bin /usr/local/libexec/docker/cli-plugins -type f -executable -newercc /proc \( -execdir upx ${UPX_LEVEL} {} \; -o -true \) && \
go clean -cache -modcache && rm -f /tools.mod
Expand Down

0 comments on commit dd72d53

Please sign in to comment.