|
| 1 | +--- |
| 2 | +status: implementable |
| 3 | +title: Hub in OpenShift Pipelines |
| 4 | +creation-date: "2021-09-07" |
| 5 | +last-updated: "2021-02-27" |
| 6 | +authors: ["vinamra28"] |
| 7 | +--- |
| 8 | + |
| 9 | +# Hub in OpenShift Pipelines Operator |
| 10 | + |
| 11 | +<!-- toc --> |
| 12 | + |
| 13 | +- [Summary](#summary) |
| 14 | +- [Motivation](#motivation) |
| 15 | + - [Goals](#goals) |
| 16 | + - [Non-Goals](#non-goals) |
| 17 | +- [Requirements](#requirements) |
| 18 | +- [Proposal](#proposal) |
| 19 | +- [Design](#design) |
| 20 | + - [Handling Upgrades](#handling-upgrades) |
| 21 | +- [Drawbacks](#drawbacks) |
| 22 | +- [Alternatives](#alternatives) |
| 23 | +- [References (optional)](#references-optional) |
| 24 | +<!-- /toc --> |
| 25 | + |
| 26 | +## Summary |
| 27 | + |
| 28 | +Tekton Hub provides a central hub for searching and sharing Tekton resources |
| 29 | +across many distributed Tekton catalogs hosted by various organizations and |
| 30 | +teams. Hub currently displays a curated set of community contributed tasks |
| 31 | +from the Community Catalog. It allows resources to be searched by name or |
| 32 | +its “display name”, filtered by categories (cloud, cli, github etc…), and |
| 33 | +rated by users. This document should cover the way how we can ship Tekton Hub |
| 34 | +in a better way so that users can install their own personalized hub within their |
| 35 | +cluster. |
| 36 | + |
| 37 | +## Motivation |
| 38 | + |
| 39 | +With time Hub is gaining more attention by many users and organizations |
| 40 | +and want to deploy the Hub within their own environment. Keeping this |
| 41 | +in mind we should simply the process of deployment so that with less |
| 42 | +effort hub can be installed on anyone's cluster. |
| 43 | + |
| 44 | +### Goals |
| 45 | + |
| 46 | +Provide a way for users to... |
| 47 | + |
| 48 | +1. Run their own instance of Tekton Hub on their own cluster. |
| 49 | +2. Expose the OpenShift routes so that ODC can use the exposed APIs |
| 50 | + in `PipelineBuilder`. |
| 51 | + |
| 52 | +### Non-Goals |
| 53 | + |
| 54 | +This TEP will not cover how the user is going to expose the service |
| 55 | +to external world via `Ingress`. |
| 56 | + |
| 57 | +## Requirements |
| 58 | + |
| 59 | +1. Images should be made available to the cluster in case of disconnected install. |
| 60 | +2. Required secrets should be present in the `targetNamespace`. |
| 61 | + |
| 62 | +## Proposal |
| 63 | + |
| 64 | +Have a CRD in Tekton Operator and a controller/reconciler which can handle CRUD operations |
| 65 | +for `Tekton Hub` resources such as API, UI and DB. Whenever a user installs a TektonHub CR |
| 66 | +with required spec it's going to perform following operations: |
| 67 | + |
| 68 | +- Create DB deployment |
| 69 | +- Run DB migration |
| 70 | +- API deployment, service and Route in case of OpenShift |
| 71 | +- UI deployment, service and Route in case of OpenShift |
| 72 | + |
| 73 | +## Design |
| 74 | + |
| 75 | +```yaml |
| 76 | +apiVersion: operator.tekton.dev/v1alpha1 |
| 77 | +kind: TektonHub |
| 78 | +metadata: |
| 79 | + name: hub |
| 80 | +spec: |
| 81 | + targetNamespace: |
| 82 | + # <namespace> in which you want to install Tekton Hub. Leave it blank if in case you want to install |
| 83 | + # in default installation namespace ie `openshift-pipelines` in case of OpenShift and `tekton-pipelines` in case of Kubernetes |
| 84 | + api: |
| 85 | + hubConfigUrl: https://raw.githubusercontent.com/tektoncd/hub/main/config.yaml |
| 86 | +``` |
| 87 | +
|
| 88 | +There would be separate manifests for deploying via Tekton Operator instead of |
| 89 | +having a common `release.yaml`. |
| 90 | + |
| 91 | +### Flow |
| 92 | + |
| 93 | +The installation flow of `Tekton Hub` is as follows: |
| 94 | + |
| 95 | +1. Create the `TektonHub` CR which will create the `targetNamespace` if it's not present. |
| 96 | +1. Create the required secrets for API in the target namespace. |
| 97 | +1. the `Tekton Hub` components in the following order: |
| 98 | + 1. Create `db` secrets |
| 99 | + 1. Create DB deployment, pvc and service |
| 100 | + 1. Run the DB-Migration, if it fails then do not proceed |
| 101 | + 1. After the successful completion of DB-Migration, search for the API secrets |
| 102 | + 1. If API secrets are present then create the remaining components required for API |
| 103 | + 1. Post successful running of API, do the same process for UI |
| 104 | + |
| 105 | +## Handling Upgrades |
| 106 | + |
| 107 | +Whenever there is a new version of OpenShift Pipelines available, all the components |
| 108 | +of Tekton Hub are going to upgrade in the following order: |
| 109 | + |
| 110 | +1. Run the new db-migration |
| 111 | +1. After successful completion of db-migration run the new API and UI server. |
| 112 | + |
| 113 | +## Handling Uninstall |
| 114 | + |
| 115 | +Whenever the CR TektonHub is deleted from the cluster, all the components |
| 116 | +related to Tekton Hub along with `tekton-hub` namespace should be deleted. |
| 117 | + |
| 118 | +## Drawbacks |
| 119 | + |
| 120 | +With current release cycle users may have to wait for the next release of |
| 121 | +OpenShift Pipelines to make it available for OpenShift users. |
| 122 | + |
| 123 | +## Alternatives |
| 124 | + |
| 125 | +### Hub as it's own Operator |
| 126 | + |
| 127 | +We can also create a separate operator for Hub and manage it's lifecycle |
| 128 | +by own instead of relying on OpenShift Pipelines operator. |
| 129 | + |
| 130 | +#### Drawbacks |
| 131 | + |
| 132 | +There will be an overhead to manage one extra operator. |
0 commit comments