The Tekton Pipelines that can be used to deploy:
-
Istio Tutorial applications to OpenShift/Kubernetes
-
Knative Tutorial applications to OpenShift/Kubernetes(WIP)
An OpenShift4 cluster with following components:
-
Istio - To play with servicemesh functionalities
-
Knative Serving - To play with severless functionalities
oc new-project tutorial && \
! oc create serviceaccount pipeline && \
oc adm policy add-scc-to-user privileged -z pipeline && \
oc adm policy add-role-to-user edit -z pipeline && \
oc adm policy add-scc-to-user privileged -z default && \
oc adm policy add-scc-to-user anyuid -z default && \
oc create -f https://raw.githubusercontent.com/redhat-developer-demos/tutorials-pipelines/pipelines-common/pipeline-role-sa.yaml
-n tutorial && \
oc policy add-role-to-user pipeline-roles -z pipeline --role-namespace=tutorial
To make maven builds faster, we will deploy Sonatype Nexus
oc new-app sonatype/nexus
Create the following Tekton tasks which will be used in the Pipelines
oc create -n tutorial \
-f https://raw.githubusercontent.com/tektoncd/catalog/master/kn/kn.yaml
oc create -n tutorial \
-f https://raw.githubusercontent.com/tektoncd/catalog/master/openshift-client/openshift-client-task.yaml
oc create -n tutorial \
-f https://raw.githubusercontent.com/redhat-developer-demos/knative-tutorial/master/06-pipelines/build-app-task.yaml
Check the tasks created
tkn task ls
NAME AGE
NAME AGE
build-app 3 seconds ago
kn 5 seconds ago
openshift-client 4 seconds ago
git clone https://github.com/redhat-developer-demos/tutorials-pipelines
cd tutorials-pipelines
oc create -f pipelines-common/resources.yaml \
-f pipelines-common/pipeline-deploy.yaml \ #(1)
-f pipelines-common/pipeline-kn-deploy.yaml #(2)
-
Pipeline used for vanilla Kubernetes/OpenShift deployment
-
Pipeline used for serverless (knative) deployment
# create customer deployment config
oc create -f customer/app.yaml
# start the customer deploy pipeline
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=customer" \
--param="deploymentConfig=customer" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=customer-openshift-image" \
--serviceaccount='pipeline'
Watch the logs of pipeline run using the command
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f <id-from-previous-command>
# create preference deployment config
oc create -f preference/app.yaml
# start preference deployment pipeline
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=preference" \
--param="deploymentConfig=preference" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=preference-openshift-image" \
--serviceaccount='pipeline'
Watch the logs of pipeline run using the command
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f <id-from-previous-command>
oc create -f recommendation/app-v1.yaml
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=recommendation" \
--param="deploymentConfig=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=recommendation-openshift-image-v1" \
--serviceaccount='pipeline'
tkn pipeline start rhd-tutorial-kn-deploy \
--param="applicationSrcDir=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=recommendation-openshift-image-v1" \
--serviceaccount='pipeline'
Watch the logs of pipeline run using the command
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f <id-from-previous-command>
oc create -f recommendation/app-v2.yaml
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=recommendation" \
--param="deploymentConfig=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source-v2" \
--resource="app-image=recommendation-openshift-image-v2" \
--serviceaccount='pipeline'
tkn pipeline start rhd-tutorial-kn-deploy \
--param="applicationSrcDir=recommendation" \
--param="mavenMirrorUrl=http://nexus.rhd-workshop-infra:8081/nexus/content/groups/public" \
--resource="app-git=git-source-v2" \
--resource="app-image=recommendation-openshift-image-v2" \
--serviceaccount='pipeline'
Watch the logs of pipeline run using the command
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f <id-from-previous-command>
-
Delete all pipeline runs
tkn pipelinerun ls | awk 'NR>1{print $1}' | xargs oc delete pipelinerun
-
Delete all pipelines
oc delete -f pipelines-commons/pipeline-deploy.yaml
-
Delete applications
oc delete -f recommendation/app-v1.yaml \ -f recommendation/app-v2.yaml \ -f preference/app.yaml \ -f customer/app.yaml