Skip to content

Commit d307c78

Browse files
authored
Merge pull request #54522 from sounix000/4719
RHDEVDOCS-4719+4724 Improve Tekton Hub config UX + Support for Crunchy Postgres with Tekton Hub
2 parents bc24905 + 4333b65 commit d307c78

9 files changed

+596
-40
lines changed

cicd/pipelines/using-tekton-hub-with-openshift-pipelines.adoc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ toc::[]
1010
include::snippets/technology-preview.adoc[]
1111

1212
[role="_abstract"]
13-
{tekton-hub} helps you discover, search, and share reusable tasks and pipelines for your CI/CD workflows. A public instance of {tekton-hub} is available at link:https://hub.tekton.dev/[hub.tekton.dev]. Cluster administrators can also install and deploy a custom instance of {tekton-hub} for enterprise use.
13+
{tekton-hub} helps you discover, search, and share reusable tasks and pipelines for your CI/CD workflows. A public instance of {tekton-hub} is available at link:https://hub.tekton.dev/[hub.tekton.dev]. Cluster administrators can also install and deploy a custom instance of {tekton-hub} by modifying the configurations in the `TektonHub` custom resource (CR).
1414

1515
include::modules/op-installing-and-deploying-tekton-hub-on-an-openshift-cluster.adoc[leveloffset=+1]
1616

1717
include::modules/op-installing-tekton-hub-without-login-and-rating.adoc[leveloffset=+2]
1818

1919
include::modules/op-installing-tekton-hub-with-login-and-rating.adoc[leveloffset=+2]
2020

21-
include::modules/op-adding-new-users-in-tekton-hub-configuration.adoc[leveloffset=+1]
22-
2321
include::modules/op-using-a-custom-database-in-tekton-hub.adoc[leveloffset=+1]
2422

25-
include::modules/op-disabling-tekton-hub-authorization-after-upgrade.adoc[leveloffset=+1]
23+
include::modules/op-installing-crunchy-postgres-database-and-tekton-hub.adoc[leveloffset=+2]
24+
25+
include::modules/op-migrating-tekton-hub-data-to-an-existing-crunchy-postgres-database.adoc[leveloffset=+2]
26+
27+
include::modules/op-updating-tekton-hub-with-custom-categories-and-catalogs.adoc[leveloffset=+1]
2628

27-
include::modules/op-opting-out-of-tekton-hub-in-the-developer-perspective.adoc[leveloffset=+1]
29+
include::modules/op-modifying-catalog-refresh-interval-tekton-hub.adoc[leveloffset=+1]
30+
31+
include::modules/op-adding-new-users-in-tekton-hub-configuration.adoc[leveloffset=+1]
32+
33+
include::modules/op-disabling-tekton-hub-authorization-after-upgrade.adoc[leveloffset=+1]
2834

2935
[role="_additional-resources"]
3036
[id="additional-resources-tekton-hub"]

modules/op-adding-new-users-in-tekton-hub-configuration.adoc

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
:_content-type: PROCEDURE
66
[id="adding-new-users-in-tekton-hub-configuration_{context}"]
7-
= Optional: Adding new users in {tekton-hub} configuration
7+
= Adding new users in {tekton-hub} configuration
8+
9+
[role="_abstract"]
10+
Cluster administrators can add new users to {tekton-hub} with different scopes.
811

912
[discrete]
1013
.Procedure
11-
. Depending on the intended scope, cluster administrators can add new users in the `config.yaml` file.
14+
. Modify the `TektonHub` CR to add new users with different scopes.
1215
+
1316
[source,yaml]
1417
----
@@ -31,10 +34,29 @@ default:
3134
+
3235
[NOTE]
3336
====
34-
When any user logs in for the first time, they will have only the default scope even if they are added in the `config.yaml`. To activate additional scopes, ensure the user has logged in at least once.
37+
A new user signing in to {tekton-hub} for the first time will have only the default scope. To activate additional scopes, ensure the user's username is added in the `scopes` field of the `TektonHub` CR.
3538
====
3639

37-
. Ensure that in the `config.yaml` file, you have the `config-refresh` scope.
40+
. Apply the updated `TektonHub` CR.
41+
+
42+
[source,terminal]
43+
----
44+
$ oc apply -f <tekton-hub-cr>.yaml
45+
----
46+
47+
. Check the status of the {tekton-hub}. The updated `TektonHub` CR might take some time to attain a steady state.
48+
+
49+
[source,terminal]
50+
----
51+
$ oc get tektonhub.operator.tekton.dev
52+
----
53+
+
54+
.Sample output
55+
[source,terminal]
56+
----
57+
NAME VERSION READY REASON APIURL UIURL
58+
hub v1.9.0 True https://api.route.url/ https://ui.route.url/
59+
----
3860

3961
. Refresh the configuration.
4062
+
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// This module is included in the following assembly:
2+
//
3+
// *cicd/pipelines/using-tekton-hub-with-openshift-pipelines.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="installing-crunchy-postgres-database-and-tekton-hub_{context}"]
7+
= Optional: Installing Crunchy Postgres database and {tekton-hub}
8+
9+
[role="_abstract"]
10+
Cluster administrators can install the Crunchy Postgres database and configure {tekton-hub} to use it instead of the default database.
11+
12+
[discrete]
13+
.Prerequisites
14+
15+
* Install the Crunchy Postgres Operator from the Operator Hub.
16+
* Create a Postgres instance that initiates a Crunchy Postgres database.
17+
18+
[discrete]
19+
.Procedure
20+
21+
. Get into the Crunchy Postgres pod.
22+
+
23+
.Example: Getting into the `test-instance1-m7hh-0` pod
24+
[source,terminal]
25+
----
26+
$ oc exec -it -n openshift-operators test-instance1-m7hh-0 -- /bin/sh
27+
28+
Defaulting container name to database.
29+
Use 'oc describe pod/test-instance1-m7hh-0 -n openshift-operators' to see all of the containers in this pod.
30+
sh-4.4$ psql -U postgres
31+
psql (14.4)
32+
Type "help" for help.
33+
----
34+
35+
. Find the `pg_hba.conf` file.
36+
+
37+
[source,terminal]
38+
----
39+
postgres=# SHOW hba_file;
40+
hba_file
41+
--------------------------
42+
/pgdata/pg14/pg_hba.conf
43+
(1 row)
44+
45+
postgres=#
46+
----
47+
48+
. Exit from the database.
49+
50+
. Check if the `pg_hba.conf` file has the entry `host all all 0.0.0.0/0 md5`, required to access all incoming connections. In addition, add the entry at the end of the `pg_hba.conf` file.
51+
+
52+
.Example: `pg_hba.conf` file
53+
[source,terminal]
54+
----
55+
sh-4.4$ cat /pgdata/pg14/pg_hba.conf
56+
57+
# Do not edit this file manually!
58+
# It will be overwritten by Patroni!
59+
local all "postgres" peer
60+
hostssl replication "_crunchyrepl" all cert
61+
hostssl "postgres" "_crunchyrepl" all cert
62+
host all "_crunchyrepl" all reject
63+
hostssl all all all md5
64+
host all all 0.0.0.0/0 md5
65+
----
66+
67+
. Save the `pg_hba.conf` file and reload the database.
68+
+
69+
[source,terminal]
70+
----
71+
sh-4.4$ psql -U postgres
72+
psql (14.4)
73+
Type "help" for help.
74+
75+
postgres=# SHOW hba_file;
76+
hba_file
77+
--------------------------
78+
/pgdata/pg14/pg_hba.conf
79+
(1 row)
80+
81+
postgres=# SELECT pg_reload_conf();
82+
pg_reload_conf
83+
----------------
84+
t
85+
(1 row)
86+
----
87+
88+
. Exit the database.
89+
90+
. Decode the secret value of the Crunchy Postgres host.
91+
+
92+
.Example: Decode the secret value of a Crunchy Postgres host
93+
[source,terminal]
94+
----
95+
$ echo 'aGlwcG8tcHJpbWFyeS5vcGVuc2hpZnQtb3BlcmF0b3JzLnN2YyA=' | base64 --decode
96+
test-primary.openshift-operators.svc
97+
----
98+
99+
. Create a secret named `tekton-hub-db` in the target namespace with the following keys:
100+
* `POSTGRES_HOST`
101+
* `POSTGRES_DB`
102+
* `POSTGRES_USER`
103+
* `POSTGRES_PASSWORD`
104+
* `POSTGRES_PORT`
105+
106+
+
107+
.Example: Custom database secrets
108+
[source,yaml]
109+
----
110+
apiVersion: v1
111+
kind: Secret
112+
metadata:
113+
name: tekton-hub-db
114+
labels:
115+
app: tekton-hub-db
116+
type: Opaque
117+
stringData:
118+
POSTGRES_HOST: test-primary.openshift-operators.svc
119+
POSTGRES_DB: test
120+
POSTGRES_USER: test
121+
POSTGRES_PASSWORD: woXOisU5>ocJiTF7y{{;1[Q(
122+
POSTGRES_PORT: '5432'
123+
...
124+
----
125+
126+
+
127+
[NOTE]
128+
====
129+
The default target namespace is `openshift-pipelines`.
130+
====
131+
132+
. In the `TektonHub` CR, set the value of the database secret attribute to `tekton-hub-db`.
133+
+
134+
.Example: Adding custom database secret
135+
[source,yaml]
136+
----
137+
apiVersion: operator.tekton.dev/v1alpha1
138+
kind: TektonHub
139+
metadata:
140+
name: hub
141+
spec:
142+
targetNamespace: openshift-pipelines
143+
db:
144+
secret: tekton-hub-db
145+
...
146+
----
147+
148+
. Use the updated `TektonHub` CR to associate the custom database with {tekton-hub}.
149+
+
150+
[source,terminal]
151+
----
152+
$ oc apply -f <tekton-hub-cr>.yaml
153+
----
154+
155+
. Check the status of the installation. The `TektonHub` CR might take some time to attain a steady state.
156+
+
157+
[source,terminal]
158+
----
159+
$ oc get tektonhub.operator.tekton.dev
160+
----
161+
+
162+
.Sample output
163+
[source,terminal]
164+
----
165+
NAME VERSION READY REASON APIURL UIURL
166+
hub v1.9.0 True https://api.route.url/ https://ui.route.url/
167+
----

modules/op-installing-tekton-hub-with-login-and-rating.adoc

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// *cicd/pipelines/using-tekton-hub-with-openshift-pipelines.adoc
44

55
:_content-type: PROCEDURE
6-
[id="installing-tekton-hub-with-login-and-rating.adoc_{context}"]
6+
[id="installing-tekton-hub-with-login-and-rating_{context}"]
77
= Installing {tekton-hub} with login and rating
88

99
[role="_abstract"]
@@ -16,10 +16,6 @@ You can install {tekton-hub} on your cluster with custom configuration that supp
1616
[discrete]
1717
.Procedure
1818

19-
. Create a fork of the link:https://github.com/tektoncd/hub[Tekton Hub] repository.
20-
21-
. Clone the forked repository.
22-
2319
. Create an OAuth application with your Git repository hosting provider, and note the Client ID and Client Secret. The supported providers are GitHub, GitLab, and BitBucket.
2420

2521
** For a link:https://docs.github.com/en/developers/apps/creating-an-oauth-app[GitHub OAuth application], set the Homepage URL and the Authorization callback URL as `<auth-route>`.
@@ -28,7 +24,7 @@ You can install {tekton-hub} on your cluster with custom configuration that supp
2824

2925
** For a link:https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud[BitBucket OAuth application], set the `Callback URL` as `<auth-route>`.
3026

31-
. Edit the `<tekton_hub_repository>/config/02-api/20-api-secret.yaml` file of your cloned repository to include the {tekton-hub} API secrets:
27+
. Edit the `<tekton_hub_root>/config/02-api/20-api-secret.yaml` file to include the {tekton-hub} API secrets. For example:
3228
+
3329
[source,yaml]
3430
----
@@ -80,32 +76,72 @@ metadata:
8076
name: hub
8177
spec:
8278
targetNamespace: openshift-pipelines <1>
79+
db: <2>
80+
secret: tekton-hub-db <3>
81+
82+
categories: <4>
83+
- Automation
84+
- Build Tools
85+
- CLI
86+
- Cloud
87+
- Code Quality
88+
...
89+
90+
catalogs: <5>
91+
- name: tekton
92+
org: tektoncd
93+
type: community
94+
provider: github
95+
url: https://github.com/tektoncd/catalog
96+
revision: main
97+
98+
scopes: <6>
99+
- name: agent:create
100+
users: [<username>]
101+
- name: catalog:refresh
102+
users: [<username>]
103+
- name: config:refresh
104+
users: [<username>]
105+
106+
default: <7>
107+
scopes:
108+
- rating:read
109+
- rating:write
110+
83111
api:
84-
hubConfigUrl: https://raw.githubusercontent.com/tektoncd/hub/main/config.yaml <2>
85-
catalogRefreshInterval: 30m <3>
112+
catalogRefreshInterval: 30m <8>
86113
----
87114
<1> The namespace in which {tekton-hub} must be installed; default is `openshift-pipelines`.
88-
<2> Substitute with the URL of the `config.yaml` file.
89-
<3> The time interval after which the catalog refreshes automatically. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`). The default interval is 30 minutes.
115+
<2> Optional: Custom database, such as a Crunchy Postgres database.
116+
<3> The name of the database secret must be `tekton-hub-db`.
117+
<4> Optional: Customized categories for tasks and pipelines in {tekton-hub}.
118+
<5> Optional: Customized catalogs for {tekton-hub}.
119+
<6> Optional: Additional users. You can metion multiple users, such as `[<username_1>, <username_2>, <username_3>]`.
120+
<7> Optional: Customized default scopes.
121+
<8> The time interval after which the catalog refreshes automatically. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`). The default interval is 30 minutes.
122+
+
123+
[NOTE]
124+
====
125+
If you don't provide custom values for the optional fields in the `TektonHub` CR, the default values configured in the {tekton-hub} API config map is used.
126+
====
90127
91128
. Apply the `TektonHub` CR.
92129
+
93130
[source,terminal]
94131
----
95-
$ oc apply -f <TektonHub>.yaml <1>
132+
$ oc apply -f <tekton-hub-cr>.yaml
96133
----
97-
<1> The file name or path of the `TektonHub` CR.
98-
+
99-
[NOTE]
100-
====
101-
When you apply the `TektonHub` CR, {tekton-hub} is installed on the cluster in the `openshift-pipelines` namespace, with upstream Tekton Catalog content.
102-
====
103134
104135
. Check the status of the installation. The `TektonHub` CR might take some time to attain steady state.
105136
+
106137
[source,terminal]
107138
----
108139
$ oc get tektonhub.operator.tekton.dev
140+
----
141+
+
142+
.Sample output
143+
[source,terminal]
144+
----
109145
NAME VERSION READY REASON APIURL UIURL
110-
hub v1.8.0 True https://api.route.url/ https://ui.route.url/
146+
hub v1.9.0 True https://api.route.url/ https://ui.route.url/
111147
----

0 commit comments

Comments
 (0)