This document will move to LEAR Documentation.
All openshift objects should first be placed into the openshift template and set the correct label.
oc get all,templates,configmap,secret,pvc -l app=auth-api
oc get all,templates,configmap,secret,pvc -l app-group=sbc-auth
oc get all,templates,configmap,secret,pvc -l template=auth-api-deploy
oc delete all,templates,configmap,secret,(pvc Danger!!) -l app=auth-api
Create or update Secret(Configmap) (Openshift Document)
Warning: Don't put the real secret inside the template file.
Create or update openshift template first and run the following command:
oc create secret generic my-secret \
--from-literal=username=pwei123 \
--from-literal=password=1234 \
--type=kubernetes.io/basic-auth \
--dry-run -o json \
| oc apply -f -
Add a new item to existing secret
oc get secret my-secret --export=true -o json \
| jq ". * $(oc create secret generic my-secret --from-literal=POD_TESTING=true --type=kubernetes.io/basic-auth --dry-run -o json)" \
| oc apply -f -
-
Login to openshift
oc login xxxxxxx
-
Switch to dev name space
oc project 1rdehl-dev
-
Deploy database
3.1 Deploy
cd */sbc-auth/auth-db/openshift/templates oc process -f postgresql-deploy.json -p TAG_NAME=dev | oc apply -f -
3.2 Create unit test user
psql postgres CREATE ROLE tester superuser; ALTER ROLE tester WITH LOGIN;
-
Create configmap and secrets
cd */sbc-auth/auth-api/openshift/templates oc process -f auth-api-pre-deploy.json \ -p NAME=auth-api \ -p TAG_NAME=dev \ | oc apply -f -
Manually replace secret values in openshift Web Console or command line.
-
Create Deploy Config, Service and Route
cd */sbc-auth/auth-api/openshift/templates oc process -f auth-api-deploy.json \ -p NAME=auth-api \ -p TAG_NAME=dev \ -p REPLICAS=1 \ -p JAEGER_COLLECTOR=--collector.host-port=jaeger-collector.d7eovc-dev.svc:14267 \ | oc apply -f -
-
switch to tools name space
oc project 1rdehl-tools
-
Create build config and image
oc process -f auth-api-build.json \ -p NAME=auth-api \ -p GIT_REPO_URL=https://github.com/bcgov/sbc-auth.git \ -p GIT_REF=development \ | oc apply -f -
-
Create pipeline
oc process -f auth-api-pipeline.json \ -p NAME=auth-api \ -p TAG_NAME=dev \ -p GIT_REPO_URL=https://github.com/bcgov/sbc-auth.git \ -p GIT_REF=development \ -p WEBHOOK=github-auth-api-dev \ -p JENKINS_FILE=./jenkins/dev.groovy \ | oc apply -f -
-
Login to openshift
oc login xxxxxxx
-
Switch to dev name space
oc project 1rdehl-dev
-
Create configmap and secrets
cd */sbc-auth/auth-web/openshift/templates oc process -f auth-web-pre-deploy.json \ -p NAME=auth-web \ -p TAG_NAME=dev \ | oc apply -f -
Manually replace secret values in openshift Web Console or command line.
-
Create Deploy Config, Service and Route
cd */sbc-auth/auth-web/openshift/templates oc process -f auth-web-deploy.json \ -p NAME=auth-web \ -p NAME_RUNTIME=auth-web-runtime \ -p TAG_NAME=dev \ -p REPLICAS=1 \ | oc apply -f -
-
switch to tools name space
oc project 1rdehl-tools
-
Create Web build config and image
oc process -f auth-web-build.json \ -p NAME=auth-web \ -p GIT_REPO_URL=https://github.com/bcgov/sbc-auth.git \ -p GIT_REF=development \ | oc apply -f -
-
Create Web Runtime build config and image
oc new-build --name auth-web-runtime --binary --strategy docker oc process -f auth-web-runtime-build.json \ -p NAME=auth-web-runtime \ | oc apply -f -
-
Create pipeline
oc process -f auth-web-pipeline.json \ -p NAME=auth-web \ -p TAG_NAME=dev \ -p GIT_REPO_URL=https://github.com/bcgov/sbc-auth.git \ -p GIT_REF=development -p WEBHOOK=github-auth-web-dev \ -p JENKINS_FILE=./jenkins/dev.groovy \ | oc apply -f -