From c07d1387ee85b4d1629c438f25382d61dd5a2e3b Mon Sep 17 00:00:00 2001 From: Alec Merdler Date: Thu, 22 Feb 2018 21:21:58 -0500 Subject: [PATCH] updated instructions for running against OpenShift --- README.md | 16 +++++++++++++++- contrib/oc-environment.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 contrib/oc-environment.sh diff --git a/README.md b/README.md index b6f102563f4..ca94319a21c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,9 @@ Backend binaries are output to `/bin`. ### Configure the application -If you've got a working `kubectl` on your path, you can run the application with +#### Tectonic + +If you've got a working `kubectl` on your path, you can run the application with: ``` source ./contrib/environment.sh @@ -73,6 +75,18 @@ kubectl describe secrets/ Use this token value to set the `BRIDGE_K8S_BEARER_TOKEN` environment variable when running Bridge. +#### OpenShift + +If you've got a working `kubectl` and `oc` on your path, you can run the application with: + +``` +oc login -u system:admin +oc adm policy --as system:admin add-cluster-role-to-user cluster-admin developer +oc login -u developer +source ./contrib/oc-environment.sh +./bin/bridge +``` + ## Docker The `builder-run` script will run any command from a docker container to ensure a consistent build environment. diff --git a/contrib/oc-environment.sh b/contrib/oc-environment.sh new file mode 100644 index 00000000000..c780e81cc7d --- /dev/null +++ b/contrib/oc-environment.sh @@ -0,0 +1,26 @@ +# This file is an example of how you might set up your environment to +# run the tectonic console against OpenShift during development. To use it for running +# bridge, do +# +# . contrib/oc-environment.sh +# ./bin/bridge +# + +# You'll need a working kubectl, working oc logged in as cluster-admin role, and you'll need jq installed and in +# your path for this script to work correctly. + +# The environment variables beginning with "BRIDGE_" act just like +# bridge command line arguments - in fact. to get more information +# about any of them, you can run ./bin/bridge --help + +export BRIDGE_USER_AUTH="disabled" +export BRIDGE_K8S_MODE="off-cluster" +BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT=$(kubectl config view -o json | jq '{myctx: .["current-context"], ctxs: .contexts[], clusters: .clusters[]}' | jq 'select(.myctx == .ctxs.name)' | jq 'select(.ctxs.context.cluster == .clusters.name)' | jq '.clusters.cluster.server' -r) +export BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT +export BRIDGE_K8S_MODE_OFF_CLUSTER_SKIP_VERIFY_TLS=true +export BRIDGE_K8S_AUTH="bearer-token" + +BRIDGE_K8S_AUTH_BEARER_TOKEN=$(oc whoami --show-token) +export BRIDGE_K8S_AUTH_BEARER_TOKEN + +echo "Using $BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT"