diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 36adac6f..458f9801 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -23,10 +23,15 @@ ARG container_user_gid=1001 # Set working directory for the user ENV work_dir=/home/${container_user}/ +ARG KUBECTL_VERSION=1.22.9 + # install packages and create user RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} \ - && chown -R ${container_user}:${container_user} /home/${container_user}/ + && chown -R ${container_user}:${container_user} /home/${container_user}/ \ + && curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ + && chmod +x kubectl \ + && mv kubectl /usr/local/bin/ # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} diff --git a/admintest/entrypoint.sh b/admintest/entrypoint.sh index d9c22cdc..a3d4e33e 100644 --- a/admintest/entrypoint.sh +++ b/admintest/entrypoint.sh @@ -1,4 +1,12 @@ #!/bin/bash +sleep 5 +export DOCKER_HASH_ID=$( kubectl get pod "$HOSTNAME" -n "$NS" -o jsonpath='{.status.containerStatuses[*].imageID}' | sed 's/ /\n/g' | grep -v 'istio' | sed 's/docker\-pullable\:\/\///g' ) +if [[ -z $DOCKER_HASH_ID ]]; then + echo "DOCKER_HASH_ID IS EMPTY;EXITING"; + exit 1; +fi +echo "DOCKER_HASH_ID ; $DOCKER_HASH_ID" + java --version java -jar adminui-*-jar-with-dependencies.jar \ No newline at end of file