Skip to content

Commit 7d7666d

Browse files
authored
Merge pull request #48671 from sounix000/4169-admin-provided-database-tekton-hub
RHDEVDOCS-4169+4392: Tekton Hub and auth changes for Pipelines 1.8
2 parents 5341987 + 63844c6 commit 7d7666d

9 files changed

+375
-224
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@ include::snippets/technology-preview.adoc[]
1414

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

17-
include::modules/op-manually-refreshing-the-catalog-in-tekton-hub.adoc[leveloffset=+2]
17+
include::modules/op-installing-tekton-hub-without-login-and-rating.adoc[leveloffset=+2]
1818

19-
include::modules/op-setting-a-cron-job-for-refreshing-catalog-in-tekton-hub.adoc[leveloffset=+2]
19+
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=+2]
21+
include::modules/op-adding-new-users-in-tekton-hub-configuration.adoc[leveloffset=+1]
22+
23+
include::modules/op-using-a-custom-database-in-tekton-hub.adoc[leveloffset=+1]
24+
25+
include::modules/op-disabling-tekton-hub-authorization-after-upgrade.adoc[leveloffset=+1]
2226

2327
include::modules/op-opting-out-of-tekton-hub-in-the-developer-perspective.adoc[leveloffset=+1]
2428

2529
[role="_additional-resources"]
2630
[id="additional-resources-tekton-hub"]
2731
== Additional resources
2832

29-
* GitHub repository of link:https://github.com/tektoncd/hub[Tekton Hub].
33+
* GitHub repository of link:https://github.com/tektoncd/hub[Tekton Hub]
3034

3135
* xref:../../cicd/pipelines/installing-pipelines.adoc#installing-pipelines[Installing OpenShift Pipelines]
3236

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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="disabling-tekton-hub-authorization-after-upgrade.adoc_{context}"]
7+
= Disabling {tekton-hub} authorization after upgrading the {pipelines-title} Operator from 1.7 to 1.8
8+
9+
[role="_abstract"]
10+
When you install {tekton-hub} with {pipelines-title} Operator 1.8, the login authorization and ratings for the {tekton-hub} artifacts are disabled for the default installation. However, when you upgrade the Operator from 1.7 to 1.8, the instance of the {tekton-hub} on your cluster does not automatically disable the login authorization and ratings.
11+
12+
To disable login authorization and ratings for {tekton-hub} after upgrading the Operator from 1.7 to 1.8, perform the steps in the following procedure.
13+
14+
[discrete]
15+
.Prerequisites
16+
* Ensure that the {pipelines-title} Operator is installed in the default `openshift-pipelines` namespace on the cluster.
17+
18+
[discrete]
19+
.Procedure
20+
21+
. Delete the existing {tekton-hub} API secret that you created while manually installing {tekton-hub} for Operator 1.7.
22+
+
23+
[source,terminal]
24+
----
25+
$ oc delete secret tekton-hub-api -n <targetNamespace> <1>
26+
----
27+
<1> The common namespace for the {tekton-hub} API secret and the {tekton-hub} CR. By default, the target namespace is `openshift-pipelines`.
28+
29+
. Delete the `TektonInstallerSet` object for the {tekton-hub} API.
30+
+
31+
[source,terminal]
32+
----
33+
$ oc get tektoninstallerset -o name | grep tekton-hub-api | xargs oc delete
34+
----
35+
+
36+
[NOTE]
37+
====
38+
After deletion, the Operator automatically creates a new {tekton-hub} API installer set.
39+
====
40+
+
41+
Wait and check the status of the {tekton-hub}. Proceed to the next steps when the `READY` column displays `True`.
42+
+
43+
[source,terminal]
44+
----
45+
$ oc get tektonhub hub
46+
----
47+
+
48+
.Sample output
49+
[source,terminal]
50+
----
51+
NAME VERSION READY REASON APIURL UIURL
52+
hub 1.8.0 True https://tekton-hub-api-openshift-pipelines.apps.example.com https://tekton-hub-ui-openshift-pipelines.apps.example.com
53+
54+
----
55+
56+
. Delete the `ConfigMap` object for the {tekton-hub} UI.
57+
+
58+
[source,terminal]
59+
----
60+
$ oc delete configmap tekton-hub-ui -n <targetNamespace> <1>
61+
----
62+
<1> The common namespace for the {tekton-hub} UI and the {tekton-hub} CR. By default, the target namespace is `openshift-pipelines`.
63+
64+
. Delete the `TektonInstallerSet` object for the {tekton-hub} UI.
65+
+
66+
[source,terminal]
67+
----
68+
$ oc get tektoninstallerset -o name | grep tekton-hub-ui | xargs oc delete
69+
----
70+
+
71+
[NOTE]
72+
====
73+
After deletion, the Operator automatically creates a new {tekton-hub} UI installer set.
74+
====
75+
+
76+
Wait and check the status of the {tekton-hub}. Proceed to the next steps when the `READY` column displays `True`.
77+
+
78+
[source,terminal]
79+
----
80+
$ oc get tektonhub hub
81+
----
82+
+
83+
.Sample output
84+
[source,terminal]
85+
----
86+
NAME VERSION READY REASON APIURL UIURL
87+
hub 1.8.0 True https://tekton-hub-api-openshift-pipelines.apps.example.com https://tekton-hub-ui-openshift-pipelines.apps.example.com
88+
89+
----

modules/op-installing-and-deploying-tekton-hub-on-an-openshift-cluster.adoc

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

55
:_content-type: PROCEDURE
6-
[id="op-installing-and-deploying-tekton-hub-on-an-openshift-cluster_{context}"]
6+
[id="installing-and-deploying-tekton-hub-on-an-openshift-cluster_{context}"]
77
= Installing and deploying {tekton-hub} on a {product-title} cluster
88

99
[role="_abstract"]
1010
{tekton-hub} is an optional component; cluster administrators cannot install it using the `TektonConfig` custom resource (CR). To install and manage {tekton-hub}, use the `TektonHub` CR.
1111

12-
[NOTE]
13-
====
14-
If you are using Github Enterprise or Gitlab Enterprise, install and deploy {tekton-hub} in the same network as the enterprise server. For example, if the enterprise server is running behind a VPN, deploy {tekton-hub} on a cluster that is also behind the VPN.
15-
====
16-
17-
[discrete]
18-
.Prerequisites
19-
* Ensure that the {pipelines-title} Operator is installed in the default `openshift-pipelines` namespace on the cluster.
20-
21-
[discrete]
22-
.Procedure
23-
24-
. Create a fork of the link:https://github.com/tektoncd/hub[Tekton Hub] repository.
12+
You can install {tekton-hub} on your cluster using two modes:
2513

26-
. Clone the forked repository.
14+
* _Without_ login authorization and ratings for {tekton-hub} artifacts
15+
* _with_ login autorization and ratings for {tekton-hub} artifacts
2716
28-
. Update the `config.yaml` file to include at least one user with the following scopes:
29-
* A user with `agent:create` scope who can set up a cron job that refreshes the {tekton-hub} database after an interval, if there are any changes in the catalog.
30-
* A user with the `catalog:refresh` scope who can refresh the catalog and all resources in the database of the {tekton-hub}.
31-
* A user with the `config:refresh` scope who can get additional scopes.
32-
+
33-
[source,yaml]
34-
----
35-
...
36-
scopes:
37-
- name: agent:create
38-
users: <username_registered_with_the_Git_repository_hosting_service_provider>
39-
- name: catalog:refresh
40-
users: <username_registered_with_the_Git_repository_hosting_service_provider>
41-
- name: config:refresh
42-
users: <username_registered_with_the_Git_repository_hosting_service_provider>
43-
...
44-
----
45-
+
46-
The supported service providers are GitHub, GitLab, and BitBucket.
47-
48-
. Create an OAuth application with your Git repository hosting provider, and note the Client ID and Client Secret.
49-
* For a GitHub OAuth application, set the `Homepage URL` and the `Authorization callback URL` as `<auth-route>`.
50-
* For a GitLab OAuth application, set the `REDIRECT_URI` as `<auth-route>/auth/gitlab/callback`.
51-
* For a BitBucket OAuth application, set the `Callback URL` as `<auth-route>`.
52-
53-
. Edit the following fields in the `<tekton_hub_repository>/config/02-api/20-api-secret.yaml` file for the {tekton-hub} API secret:
54-
* `GH_CLIENT_ID`: The Client ID from the OAuth application created with the Git repository hosting service provider.
55-
* `GH_CLIENT_SECRET`: The Client Secret from the OAuth application created with the Git repository hosting service provider.
56-
* `GHE_URL`: GitHub Enterprise URL, if you are authenticating using GitHub Enterprise. Do not provide the URL to the catalog as a value for this field.
57-
* `GL_CLIENT_ID`: The Client ID from the GitLab OAuth application.
58-
* `GL_CLIENT_SECRET`: The Client Secret from the GitLab OAuth application.
59-
* `GLE_URL`: GitLab Enterprise URL, if you are authenticating using GitLab Enterprise. Do not provide the URL to the catalog as a value for this field.
60-
* `BB_CLIENT_ID`: The Client ID from the BitBucket OAuth application.
61-
* `BB_CLIENT_SECRET`: The Client Secret from the BitBucket OAuth application.
62-
* `JWT_SIGNING_KEY`: A long, random string used to sign the JSON Web Token (JWT) created for users.
63-
* `ACCESS_JWT_EXPIRES_IN`: Add the time limit after which the access token expires. For example, `1m`, where `m` denotes minutes. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`).
64-
* `REFRESH_JWT_EXPIRES_IN`: Add the time limit after which the refresh token expires. For example, `1m`, where `m` denotes minutes. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`). Ensure that the expiry time set for token refresh is greater than the expiry time set for token access.
65-
* `AUTH_BASE_URL`: Route URL for the OAuth application.
66-
+
6717
[NOTE]
6818
====
69-
* Use the fields related to Client ID and Client Secret for any one of the supported Git repository hosting service providers.
70-
* The account credentials registered with the Git repository hosting service provider enables the users with `catalog: refresh` scope to authenticate and load all catalog resources to the database.
71-
====
72-
73-
. Commit and push the changes to your forked repository.
74-
75-
. Ensure that the `TektonHub` CR is similar to the following example:
76-
+
77-
[source,yaml]
78-
----
79-
apiVersion: operator.tekton.dev/v1alpha1
80-
kind: TektonHub
81-
metadata:
82-
name: hub
83-
spec:
84-
targetNamespace: openshift-pipelines <1>
85-
api:
86-
hubConfigUrl: https://raw.githubusercontent.com/tektoncd/hub/main/config.yaml <2>
87-
----
88-
<1> The namespace in which Tekton Hub must be installed; default is `openshift-pipelines`.
89-
<2> Substitute with the URL of the `config.yaml` file of your forked repository.
90-
91-
. Install the {tekton-hub}.
92-
+
93-
[source,terminal]
94-
----
95-
$ oc apply -f TektonHub.yaml <1>
96-
----
97-
<1> The file name or path of the `TektonConfig` CR.
98-
99-
. Check the status of the installation.
100-
+
101-
[source,terminal]
102-
----
103-
$ oc get tektonhub.operator.tekton.dev
104-
NAME VERSION READY REASON APIURL UIURL
105-
hub v1.7.2 True https://api.route.url/ https://ui.route.url/
106-
----
19+
If you are using Github Enterprise or Gitlab Enterprise, install and deploy {tekton-hub} in the same network as the enterprise server. For example, if the enterprise server is running behind a VPN, deploy {tekton-hub} on a cluster that is also behind the VPN.
20+
====
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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-tekton-hub-with-login-and-rating.adoc_{context}"]
7+
= Installating {tekton-hub} with login and rating
8+
9+
[role="_abstract"]
10+
You can install {tekton-hub} on your cluster with custom configuration that supports login with authorization and ratings for {tekton-hub} artifacts.
11+
12+
[discrete]
13+
.Prerequisites
14+
* Ensure that the {pipelines-title} Operator is installed in the default `openshift-pipelines` namespace on the cluster.
15+
16+
[discrete]
17+
.Procedure
18+
19+
. Create a fork of the link:https://github.com/tektoncd/hub[Tekton Hub] repository.
20+
21+
. Clone the forked repository.
22+
23+
. 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.
24+
25+
** 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>`.
26+
27+
** For a link:https://docs.gitlab.com/ee/integration/oauth_provider.html#user-owned-applications[GitLab OAuth application], set the `REDIRECT_URI` as `<auth-route>/auth/gitlab/callback`.
28+
29+
** 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>`.
30+
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:
32+
+
33+
[source,yaml]
34+
----
35+
apiVersion: v1
36+
kind: Secret
37+
metadata:
38+
name: tekton-hub-api
39+
namespace: openshift-pipelines
40+
type: Opaque
41+
stringData:
42+
GH_CLIENT_ID: <1>
43+
GH_CLIENT_SECRET: <2>
44+
GL_CLIENT_ID: <3>
45+
GL_CLIENT_SECRET: <4>
46+
BB_CLIENT_ID: <5>
47+
BB_CLIENT_SECRET: <6>
48+
JWT_SIGNING_KEY: <7>
49+
ACCESS_JWT_EXPIRES_IN: <8>
50+
REFRESH_JWT_EXPIRES_IN: <9>
51+
AUTH_BASE_URL: <10>
52+
GHE_URL: <11>
53+
GLE_URL: <12>
54+
----
55+
<1> The Client ID from the GitHub OAuth application.
56+
<2> The Client Secret from the GitHub OAuth application.
57+
<3> The Client ID from the GitLab OAuth application.
58+
<4> The Client Secret from the GitLab OAuth application.
59+
<5> The Client ID from the BitBucket OAuth application.
60+
<6> The Client Secret from the BitBucket OAuth application.
61+
<7> A long, random string used to sign the JSON Web Token (JWT) created for users.
62+
<8> Add the time limit after which the access token expires. For example, `1m`, where m denotes minutes. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`).
63+
<9> Add the time limit after which the refresh token expires. For example, `1m`, where `m` denotes minutes. The supported units of time are seconds (`s`), minutes (`m`), hours (`h`), days (`d`), and weeks (`w`). Ensure that the expiry time set for token refresh is greater than the expiry time set for token access.
64+
<10> Route URL for the OAuth application.
65+
<11> GitHub Enterprise URL, if you are authenticating using GitHub Enterprise. Do not provide the URL to the catalog as a value for this field.
66+
<12> GitLab Enterprise URL, if you are authenticating using GitLab Enterprise. Do not provide the URL to the catalog as a value for this field.
67+
+
68+
[NOTE]
69+
====
70+
You can delete the unused fields for the Git repository hosting service providers that are irrelevant to your deployment.
71+
====
72+
73+
. Create a `TektonHub` CR similar to the following example.
74+
+
75+
[source,yaml]
76+
----
77+
apiVersion: operator.tekton.dev/v1alpha1
78+
kind: TektonHub
79+
metadata:
80+
name: hub
81+
spec:
82+
targetNamespace: openshift-pipelines <1>
83+
api:
84+
hubConfigUrl: https://raw.githubusercontent.com/tektoncd/hub/main/config.yaml <2>
85+
catalogRefreshInterval: 30m <3>
86+
----
87+
<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.
90+
91+
. Apply the `TektonHub` CR.
92+
+
93+
[source,terminal]
94+
----
95+
$ oc apply -f <TektonHub>.yaml <1>
96+
----
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+
====
103+
104+
. Check the status of the installation. The `TektonHub` CR might take some time to attain steady state.
105+
+
106+
[source,terminal]
107+
----
108+
$ oc get tektonhub.operator.tekton.dev
109+
NAME VERSION READY REASON APIURL UIURL
110+
hub v1.8.0 True https://api.route.url/ https://ui.route.url/
111+
----

0 commit comments

Comments
 (0)