-
operator-sdk: https://github.com/operator-framework/operator-sdk
-
minikube: https://kubernetes.io/docs/tasks/tools/install-minikube/
create minikube instance
minikube start -p mk-tekton \
--cpus=4 --memory=8192 --kubernetes-version=v1.12.0 \
--extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook" \
--extra-config=apiserver.service-node-port-range=80-32767
set docker env
eval $(minikube docker-env -p mk-tekton)
clone OLM repository (into go path)
git clone git@github.com:operator-framework/operator-lifecycle-manager.git \
$GOPATH/github.com/operator-framework/
kubectl apply -f $GOPATH/github.com/operator-framework/operator-lifecycle-manager/deploy/upstream/quickstart
-
Apply operator crd
kubectl apply deploy/crds/*_crd.yaml
-
Deploy the operator
kubectl -n tekton-pipelines apply -f deploy/
-
Install pipeline by creating an
Install
CRkubectl apply deploy/crds/*_cr.yaml
-
install minikube see above
-
install olm see above
-
Add new catalog source localOperators
kubectl apply -f https://raw.githubusercontent.com/nikhil-thomas/operator-registry/pipeline-operator/deploy/operator-catalogsource.0.0.1.yaml
Once the CatalogSource has been applied, you should find it under
Catalog > Operator Management
of the web console -
Subscribe to
Tektoncd Operator
-
Open web console
-
Select
tekton-pipelines
namespace -
Scroll down to
Tektoncd Operator
underlocaloperators
NOTE: it will take few minutes to appear after applying the
catalogsource
-
Click
Create Subscription
button-
ensure
namespace
in yaml istekton-pipelines
e.g.sample subscription
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: generateName: tektoncd-subscription namespace: tekton-pipelines spec: source: localoperators sourceNamespace: tekton-pipelines name: tektoncd startingCSV: tektoncd-operator.v0.0.1 channel: alpha
-
Click
Create
button at the bottom
-
-
-
Verify operator is installed successfully
- Select
Catalog > Installed operators
- look for
Status
InstallSucceeded
- Select
-
Install Tektoncd-Pipeline by creating an
install
CR-
Select
Catalog > Developer Catalog
, you should findTektonCD-Pipeline Install
-
Click on it and it should show the Operator Details Panel
-
Click on
Create
which show an example as belowexample
```yamlapiVersion: tekton.dev/v1alpha1 kind: Install metadata: name: example namespace: tekton-pipelines ### must be this spec: {} ```
-
Verify that the pipeline is installed
- ensure pipeline pods are running
- ensure pipeline crds exist e.g.
kubectl get crds | grep tekton
should show
clustertasks.tekton.dev installs.tekton.dev pipelineresources.tekton.dev pipelineruns.tekton.dev pipelines.tekton.dev taskruns.tekton.dev tasks.tekton.dev
-
This section explains how to test changes to the operator by executing the entire end-to-end workflow of edit, test, build, package, etc...
It asssumes you have already followed install minikube and OLM.
- Make changes to the operator
- Test operator locally with
operator-sdk up local
- Build operator image
operator-sdk build <imagename:tag>
- Update image reference in
deploy/operator.yaml
- Build csv using
opertor-sdk olm-catalog gen-csv --csv-version 0.0.<x>
change<x>
- Apply the CSV
kubectl apply -f deploy/olm-catalog/tektoncd-operator/0.0.<x>/*.yaml
- Verify that the new image is running
-
clone the fork of operator-registry fork where we have added tektoncd-pipeline manifests
git clone https://github.com/nikhil-thomas/operator-registry git checkout -b pipeline-operator
-
Copy csv from step 5 to
manifests
directory inoperator-registry
NOTE: Be sure to preserve the directory structure
IMPORTANT: Ensure latest crd(s) are also beside csv
-
Build and push operator-registry image
docker build -t example-registry:latest -f upstream-example.Dockerfile docker push example-registry:latest
-
Update image reference in catalog-src -
deploy
kubectl apply -f deploy/operator-catalogsource.0.0.1.yaml