Custom Tekton Hub instance
Custom Tekton Hub instance Red Hat OpenShift Pipelines 1.15 Installing a custom instance of Tekton Hub Red Hat OpenShift Documentation Team
apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines 1 db: # Optional: If you want to use custom database secret: tekton-hub-db # Name of db secret should be `tekton-hub-db` categories: # Optional: If you want to use custom categories - Automation - Build Tools - CLI - Cloud - Code Quality - catalogs: # Optional: If you want to use custom catalogs - name: tekton org: tektoncd type: community provider: github url: https://github.com/tektoncd/catalog revision: main scopes: # Optional: If you want to add new users - name: agent:create users: [abc, qwe, pqr] - name: catalog:refresh users: [abc, qwe, pqr] - name: config:refresh users: [abc, qwe, pqr] default: # Optional: If you want to add custom default scopes scopes: - rating:read - rating:write api: catalogRefreshInterval: 30m 2 oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ apiVersion: v1 kind: Secret metadata: name: tekton-hub-api namespace: openshift-pipelines type: Opaque stringData: GH_CLIENT_ID: 1 GH_CLIENT_SECRET: 2 GL_CLIENT_ID: 3 GL_CLIENT_SECRET: 4 BB_CLIENT_ID: 5 BB_CLIENT_SECRET: 6 JWT_SIGNING_KEY: 7 ACCESS_JWT_EXPIRES_IN: 8 REFRESH_JWT_EXPIRES_IN: 9 AUTH_BASE_URL: 10 GHE_URL: 11 GLE_URL: 12 apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines 1 db: 2 secret: tekton-hub-db 3 categories: 4 - Automation - Build Tools - CLI - Cloud - Code Quality catalogs: 5 - name: tekton org: tektoncd type: community provider: github url: https://github.com/tektoncd/catalog revision: main scopes: 6 - name: agent:create users: [<username>] - name: catalog:refresh users: [<username>] - name: config:refresh users: [<username>] default: 7 scopes: - rating:read - rating:write api: catalogRefreshInterval: 30m 8 oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ apiVersion: v1 kind: Secret metadata: name: tekton-hub-db labels: app: tekton-hub-db type: Opaque stringData: POSTGRES_HOST: <The name of the host of the database> POSTGRES_DB: <Name of the database> POSTGRES_USER: <username> POSTGRES_PASSWORD: <password> POSTGRES_PORT: <The port that the database is listening on> apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines db: secret: tekton-hub-db api: hubConfigUrl: https://raw.githubusercontent.com/tektoncd/hub/main/config.yaml catalogRefreshInterval: 30m oc apply -f <tekton-hub-cr>.yaml oc replace -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ oc exec -it -n openshift-operators test-instance1-m7hh-0 -- /bin/sh Defaulting container name to database. Use 'oc describe pod/test-instance1-m7hh-0 -n openshift-operators' to see all of the containers in this pod. sh-4.4USD psql -U postgres psql (14.4) Type "help" for help. postgres=# SHOW hba_file; hba_file -------------------------- /pgdata/pg14/pg_hba.conf (1 row) postgres=# sh-4.4USD cat /pgdata/pg14/pg_hba.conf Do not edit this file manually! It will be overwritten by Patroni! local all "postgres" peer hostssl replication "_crunchyrepl" all cert hostssl "postgres" "_crunchyrepl" all cert host all "_crunchyrepl" all reject hostssl all all all md5 host all all 0.0.0.0/0 md5 sh-4.4USD psql -U postgres psql (14.4) Type "help" for help. postgres=# SHOW hba_file; hba_file -------------------------- /pgdata/pg14/pg_hba.conf (1 row) postgres=# SELECT pg_reload_conf(); pg_reload_conf ---------------- t (1 row) echo 'aGlwcG8tcHJpbWFyeS5vcGVuc2hpZnQtb3BlcmF0b3JzLnN2YyA=' | base64 --decode test-primary.openshift-operators.svc apiVersion: v1 kind: Secret metadata: name: tekton-hub-db labels: app: tekton-hub-db type: Opaque stringData: POSTGRES_HOST: test-primary.openshift-operators.svc POSTGRES_DB: test POSTGRES_USER: <username> POSTGRES_PASSWORD: <password> POSTGRES_PORT: '5432' apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines db: secret: tekton-hub-db oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ pg_dump -Ft -h localhost -U postgres hub -f /tmp/hub.dump oc cp -n <namespace> <podName>:<path-to-hub.dump> <path-to-local-system> oc cp -n openshift-pipelines tekton-hub-db-7d6d888c67-p7mdr:/tmp/hub.dump /home/test_user/Downloads/hub.dump oc cp -n <namespace> <path-to-local-system> <podName>:<path-to-hub.dump> oc cp -n openshift-operators /home/test_user/Downloads/hub.dump test-instance1-spnz-0:/tmp/hub.dump pg_restore -d <database-name> -h localhost -U postgres <path-where-file-is-copied> pg_restore -d test -h localhost -U postgres /tmp/hub.dump oc exec -it -n openshift-operators test-instance1-m7hh-0 -- /bin/sh Defaulting container name to database. Use 'oc describe pod/test-instance1-m7hh-0 -n openshift-operators' to see all of the containers in this pod. sh-4.4USD psql -U postgres psql (14.4) Type "help" for help. postgres=# SHOW hba_file; hba_file -------------------------- /pgdata/pg14/pg_hba.conf (1 row) postgres=# sh-4.4USD cat /pgdata/pg14/pg_hba.conf Do not edit this file manually! It will be overwritten by Patroni! local all "postgres" peer hostssl replication "_crunchyrepl" all cert hostssl "postgres" "_crunchyrepl" all cert host all "_crunchyrepl" all reject hostssl all all all md5 host all all 0.0.0.0/0 md5 sh-4.4USD psql -U postgres psql (14.4) Type "help" for help. postgres=# SHOW hba_file; hba_file -------------------------- /pgdata/pg14/pg_hba.conf (1 row) postgres=# SELECT pg_reload_conf(); pg_reload_conf ---------------- t (1 row) apiVersion: v1 kind: Secret metadata: name: tekton-hub-db labels: app: tekton-hub-db type: Opaque stringData: POSTGRES_HOST: test-primary.openshift-operators.svc POSTGRES_DB: test POSTGRES_USER: test POSTGRES_PASSWORD: woXOisU5>ocJiTF7y{{;1[Q( POSTGRES_PORT: '5432' echo 'aGlwcG8tcHJpbWFyeS5vcGVuc2hpZnQtb3BlcmF0b3JzLnN2YyA=' | base64 --decode test-primary.openshift-operators.svc apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines db: secret: tekton-hub-db oc replace -f <updated-tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url https://ui.route.url apiVersion: operator.tekton.dev/v1alpha1 kind: TektonHub metadata: name: hub spec: targetNamespace: openshift-pipelines 1 api: catalogRefreshInterval: 30m 2 oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ scopes: - name: agent:create users: [<username_1>, <username_2>] 1 - name: catalog:refresh users: [<username_3>, <username_4>] - name: config:refresh users: [<username_5>, <username_6>] default: scopes: - rating:read - rating:write oc apply -f <tekton-hub-cr>.yaml oc get tektonhub.operator.tekton.dev NAME VERSION READY REASON APIURL UIURL hub v1.9.0 True https://api.route.url/ https://ui.route.url/ curl -X POST -H "Authorization: <access-token>" \ 1 --header "Content-Type: application/json" --data '{"force": true} <api-route>/system/config/refresh oc delete secret tekton-hub-api -n <targetNamespace> 1 oc get tektoninstallerset -o name | grep tekton-hub-api | xargs oc delete oc get tektonhub hub NAME VERSION READY REASON APIURL UIURL hub 1.8.0 True https://tekton-hub-api-openshift-pipelines.apps.example.com https://tekton-hub-ui-openshift-pipelines.apps.example.com oc delete configmap tekton-hub-ui -n <targetNamespace> 1 oc get tektoninstallerset -o name | grep tekton-hub-ui | xargs oc delete oc get tektonhub hub NAME VERSION READY REASON APIURL UIURL hub 1.8.0 True https://tekton-hub-api-openshift-pipelines.apps.example.com https://tekton-hub-ui-openshift-pipelines.apps.example.com