Skip to content

Commit

Permalink
Merge pull request #1 from jankleinert/v1.0
Browse files Browse the repository at this point in the history
Updating environment to support the summit lab
  • Loading branch information
Jan Kleinert authored May 5, 2019
2 parents 5880173 + cb2b922 commit f2538cb
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 490 deletions.
1 change: 0 additions & 1 deletion .s2i/environment

This file was deleted.

47 changes: 27 additions & 20 deletions .workshop/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,43 @@ set -eo pipefail

# Download and unpack the operator binaries and config files.

mkdir -p $HOME/odev/bin
mkdir -p $HOME/odev/pkg
mkdir -p $HOME/go/bin
mkdir -p $HOME/go/pkg

#mkdir -p $HOME/odev/src/github.com/crunchydata/postgres-operator
#curl -sL -o /tmp/postgres-operator.tar.gz https://github.com/CrunchyData/postgres-operator/releases/download/3.5.2/postgres-operator.3.5.2.tar.gz
#cd $HOME/odev/src/github.com/crunchydata/postgres-operator
#tar xzf /tmp/postgres-operator.tar.gz
#cp -a pgo $HOME/odev/bin/pgo
#cp -a expenv $HOME/odev/bin/expenv
#rm /tmp/postgres-operator.tar.gz
echo "export GOPATH=$HOME/go" >> ~/.bash_profile
echo "export GOBIN=$GOPATH/bin" >> ~/.bash_profile
echo "export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin" >> ~/.bash_profile
. ~/.bash_profile

# install "dep"
curl -L https://github.com/golang/dep/releases/download/v0.5.1/dep-linux-amd64 -o $GOPATH/bin/dep
chmod 755 $GOPATH/bin/dep

# install operator-sdk
curl -L https://github.com/operator-framework/operator-sdk/releases/download/v0.7.0/operator-sdk-v0.7.0-x86_64-linux-gnu -o $HOME/go/bin/operator-sdk
chmod 755 $HOME/go/bin/operator-sdk

# setup git profile
git config --global user.email "[email protected]"
git config --global user.name "OperatorSDK Lab"

# Setup user environment with environment variables and bash completion.
#cat $HOME/.workshop/envvars >> /opt/app-root/etc/profile.d/postgres.sh
cat $HOME/.workshop/envvars >> $HOME/.bash_profile

#echo 'export CO_APISERVER_URL=https://`kubectl get service postgres-operator -o=jsonpath="{.spec.clusterIP}"`:8443' >> $HOME/.bash_profile
# cat $HOME/.workshop/envvars >> /opt/app-root/etc/profile.d/operatorsdklab.sh
# cat $HOME/.workshop/envvars >> $HOME/.bash_profile

#cat examples/pgo-bash-completion >> $HOME/.bash_profile
# echo 'export CO_APISERVER_URL=https://`kubectl get service postgres-operator -o=jsonpath="{.spec.clusterIP}"`:8443' >> $HOME/.bash_profile

# Fix up our own environment for executing remainder of commands.

. $HOME/.workshop/envvars
# . $HOME/.workshop/envvars

# TODO is the below relevant?
# Generate SSHD and API keys. These will be shared for all sessions.

. deploy/gen-sshd-keys.sh

. deploy/gen-api-keys.sh
# . deploy/gen-sshd-keys.sh
# . deploy/gen-api-keys.sh

mv $HOME/workshop /opt/app-root/workshop

# Delete all non required files from the image
rm -rf Dockerfile README.md LICENSE
# Delete all non required files from the image
rm -rf Dockerfile README.md LICENSE
3 changes: 0 additions & 3 deletions .workshop/envvars

This file was deleted.

48 changes: 0 additions & 48 deletions .workshop/resources/clusterroles-operator.yaml

This file was deleted.

83 changes: 0 additions & 83 deletions .workshop/resources/customresourcedefinitions-operator.yaml

This file was deleted.

101 changes: 53 additions & 48 deletions .workshop/scripts/deploy-spawner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ JUPYTERHUB_APPLICATION=${JUPYTERHUB_APPLICATION:-build-your-own-operator-lab}

JUPYTERHUB_NAMESPACE=`oc project --short 2>/dev/null`

IDLE_TIMEOUT=900
MAX_SESSION_AGE=9000

if [ "$?" != "0" ]; then
fail "Error: Cannot determine name of project."
exit 1
Expand All @@ -28,7 +31,9 @@ echo

oc process -f $TEMPLATE_PATH \
--param APPLICATION_NAME="$JUPYTERHUB_APPLICATION" \
--param PROJECT_NAME="$JUPYTERHUB_NAMESPACE" | oc apply -f -
--param PROJECT_NAME="$JUPYTERHUB_NAMESPACE" \
--param IDLE_TIMEOUT="$IDLE_TIMEOUT" \
--param MAX_SESSION_AGE="$MAX_SESSION_AGE" | oc apply -f -

if [ "$?" != "0" ]; then
fail "Error: Failed to create deployment for spawner."
Expand All @@ -46,53 +51,53 @@ fail "Error: Deployment of spawner failed to complete."
exit 1
fi

echo
echo "### Install global operator definitions."
echo

oc apply -f .workshop/resources/ --recursive

if [ "$?" != "0" ]; then
fail "Error: Failed to create global operator definitions."
exit 1
fi

echo
echo "### Update spawner configuration for workshop."
echo

oc process -f .workshop/templates/clusterroles-session-rules.yaml \
--param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
--param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f - && \
oc process -f .workshop/templates/clusterroles-spawner-rules.yaml \
--param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
--param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f - && \
oc process -f .workshop/templates/configmap-extra-resources.yaml \
--param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
--param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f -

if [ "$?" != "0" ]; then
fail "Error: Failed to udpate spawner configuration for workshop."
exit 1
fi

echo
echo "### Restart the spawner with new configuration."
echo

oc rollout latest dc/"$JUPYTERHUB_APPLICATION"

if [ "$?" != "0" ]; then
fail "Error: Failed to restart the spawner."
exit 1
fi

oc rollout status dc/"$JUPYTERHUB_APPLICATION"

if [ "$?" != "0" ]; then
fail "Error: Deployment of spawner failed to complete."
exit 1
fi
# echo
# echo "### Install global operator definitions."
# echo

# oc apply -f .workshop/resources/ --recursive

# if [ "$?" != "0" ]; then
# fail "Error: Failed to create global operator definitions."
# exit 1
# fi

# echo
# echo "### Update spawner configuration for workshop."
# echo

# oc process -f .workshop/templates/clusterroles-session-rules.yaml \
# --param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
# --param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f - && \
# oc process -f .workshop/templates/clusterroles-spawner-rules.yaml \
# --param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
# --param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f - && \
# oc process -f .workshop/templates/configmap-extra-resources.yaml \
# --param JUPYTERHUB_APPLICATION="$JUPYTERHUB_APPLICATION" \
# --param JUPYTERHUB_NAMESPACE="$JUPYTERHUB_NAMESPACE" | oc apply -f -

# if [ "$?" != "0" ]; then
# fail "Error: Failed to udpate spawner configuration for workshop."
# exit 1
# fi

# echo
# echo "### Restart the spawner with new configuration."
# echo

# oc rollout latest dc/"$JUPYTERHUB_APPLICATION"

# if [ "$?" != "0" ]; then
# fail "Error: Failed to restart the spawner."
# exit 1
# fi

# oc rollout status dc/"$JUPYTERHUB_APPLICATION"

# if [ "$?" != "0" ]; then
# fail "Error: Deployment of spawner failed to complete."
# exit 1
# fi

echo
echo "### Updating spawner to use image for workshop."
Expand Down
34 changes: 0 additions & 34 deletions .workshop/templates/clusterroles-session-rules.yaml

This file was deleted.

Loading

0 comments on commit f2538cb

Please sign in to comment.