GitXplorerGitXplorer
s

tektoncd-operator

public
4 stars
3 forks
0 issues

Commits

List of commits on branch master.
Verified
11f4194864cac74268540761e09c89405c2fac34

Merge pull request #7 from nikhil-thomas/nikhil-thomas/improvement

ssthaha committed 5 years ago
Unverified
2feb0092020f27594e0cf6c50ada927241b95360

Improve olm catalog createion script

nnikhil-thomas committed 5 years ago
Unverified
6126db56eb787c7136cbcd0f09879991e55e614c

Add a script to create catalog source configmap

nnikhil-thomas committed 5 years ago
Verified
67b1ac3777ca865860588d248411fac1e2b86737

Minor Typo: 'Catalog` tag is misspelled

ssthaha committed 5 years ago
Verified
72cefb95aef3330da9366f4bc043f7187cd3ee07

Merge pull request #6 from sthaha/fix-ns-deletion

nnikhil-thomas committed 5 years ago
Unverified
73db1abe06ba419a2ec60e75eb948206673b1403

Use image that uses manifestival

ssthaha committed 5 years ago

README

The README file for this repository.

Tektoncd-operator

Dev env

Prerequisites

  1. operator-sdk: https://github.com/operator-framework/operator-sdk

  2. minikube: https://kubernetes.io/docs/tasks/tools/install-minikube/

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)

Install OLM

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

Deploy tekton-operator

On minikube for testing

  1. Apply operator crd

    kubectl apply deploy/crds/*_crd.yaml

  2. Deploy the operator

    kubectl -n tekton-pipelines apply -f deploy/

  3. Install pipeline by creating an Install CR

    kubectl apply deploy/crds/*_cr.yaml

Deploy pipeline using CatalogSource on OLM

  1. install minikube see above

  2. install olm see above

  3. 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

  4. Subscribe to Tektoncd Operator

    1. Open web console

    2. Select tekton-pipelines namespace

    3. Select Catalog > Operator Management

    4. Scroll down to Tektoncd Operator under localoperators

      NOTE: it will take few minutes to appear after applying the catalogsource

    5. Click Create Subscription button

      1. ensure namespace in yaml is tekton-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
      2. Click Create button at the bottom

  5. Verify operator is installed successfully

    1. Select Catalog > Installed operators
    2. look for Status InstallSucceeded
  6. Install Tektoncd-Pipeline by creating an install CR

    1. Select Catalog > Developer Catalog, you should find TektonCD-Pipeline Install

    2. Click on it and it should show the Operator Details Panel

    3. Click on Create which show an example as below

      example ```yaml
         apiVersion: tekton.dev/v1alpha1
         kind: Install
         metadata:
           name: example
           namespace: tekton-pipelines ### must be this
         spec: {}
      
         ```
      
    4. Verify that the pipeline is installed

      1. ensure pipeline pods are running
      2. 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

End to End workflow

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.

Generate new image, CSV

  1. Make changes to the operator
  2. Test operator locally with operator-sdk up local
  3. Build operator image operator-sdk build <imagename:tag>
  4. Update image reference in deploy/operator.yaml
  5. Build csv using opertor-sdk olm-catalog gen-csv --csv-version 0.0.<x> change <x>
  6. Apply the CSV
    kubectl apply -f deploy/olm-catalog/tektoncd-operator/0.0.<x>/*.yaml
  7. Verify that the new image is running

Update Local CatalogSource

  1. 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
  2. Copy csv from step 5 to manifests directory in operator-registry

    NOTE: Be sure to preserve the directory structure

    IMPORTANT: Ensure latest crd(s) are also beside csv

  3. Build and push operator-registry image

    docker build -t example-registry:latest -f upstream-example.Dockerfile
    docker push example-registry:latest
  4. Update image reference in catalog-src - deploy kubectl apply -f deploy/operator-catalogsource.0.0.1.yaml