Sign inSign up

tomihararznde/ose-admin

By tomihararznde

•Updated over 7 years ago

Openshift administration container of multiples clusters

Image
0

304

tomihararznde/ose-admin repository overview

⁠This Container is to help Openshift administrators to manage more than one cluster at the same time.

The tag name is the oc client version.

How to use it:

docker run -d \
           --rm \
           --net=host \
           -e REGION=$OSE_HTTP_CONNECTION_URL \
           -e DOCKER_CONTAINER=$DOCKER_CONTAINER_NAME \
           -v /var/run/docker.sock:/var/run/docker.sock \
           --name $DOCKER_CONTAINER \
           ose-admin:<TAG> $REGION $USR $PWD

Follow a example of an automated execution of this container image

First create a file called 'run-oc.sh'

clear
USR=my_ose_username
PWD=my_ose_password
echo "|------------------------------------------|"
echo "|-------- Powered by tomIharaRznde --------|"
echo "|------------------------------------------|"
if [ "" = "$1" ]; then
    echo ""
    echo "Error: This command need parameters to run!"
    echo ""
    echo "Command sintax:"
    echo "./run-oc.sh REGION"
    echo ""
    echo ""
    echo "ex:"
    echo ""
    echo "OpenShift"
    echo "./run-oc.sh https://my-openshift-dnsname.org:8443"
else
    echo "Info: Creating and starting container"
    REGION=$1
    DOCKER_CONTAINER=ose-admin-$(echo $REGION| sed 's%https://%''%g' | sed 's%:8443%''%g')-$((1 + RANDOM % 1000))
    OUTPUT="$(docker run -d \
           --rm \
           --net=host \
           -e REGION=$REGION \
           -e DOCKER_CONTAINER=$DOCKER_CONTAINER \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v /etc/resolv.conf:/etc/resolv.conf \
           --name $DOCKER_CONTAINER \
           ose-admin:latest $REGION $USR $PWD)"
    echo -n "Info: Logging in the region $1"
    DOCKER_LOG=$(printf "%s" $(docker logs $DOCKER_CONTAINER | grep 'Welcome')  | wc -c)
    while [ $DOCKER_LOG -lt 1 ]
    do
       echo -n "."
       sleep 1
       DOCKER_LOG=$(printf "%s" $(docker logs $DOCKER_CONTAINER | grep 'Welcome')  | wc -c)
    done
    echo " done!"
    docker exec -it $DOCKER_CONTAINER bash
    echo "Info: The created container '$DOCKER_CONTAINER' will be stopped and deleted."
    {
       docker exec $DOCKER_CONTAINER rm -Rf /root/scripts/automation/temp-$DOCKER_CONTAINER.file &
       docker stop $DOCKER_CONTAINER &
    } &> /dev/null
    echo "|-----------------------------------------|"
    echo "|----- Have a nice day! Thank you!!! -----|"
    echo "|-----------------------------------------|"
fi

Now you can easly run it:

./run-oc.sh https://my-openshift-dnsname.org:8443

Enjoy and don't forget to gimme a Star if it works to you!

Tag summary

Content type

Image

Digest

Size

153.4 MB

Last updated

over 7 years ago

docker pull tomihararznde/ose-admin