forked from tektoncd/triggers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate core interceptors to use Interceptor CRD
This commit does the following: 1. Add YAML definitions for each core interceptor using the Interceptor CRD. 2. Modify the EventListener to use the Interceptor CRD to find the Interceptor's URL. 3. Update roles/RBAC/unit tests for the above 2 changes. Fixes tektoncd#868 Signed-off-by: Dibyo Mukherjee <[email protected]>
- Loading branch information
Showing
12 changed files
with
279 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2020 The Tekton Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: Interceptor | ||
metadata: | ||
name: cel | ||
spec: | ||
clientConfig: | ||
url: "http://tekton-triggers-core-interceptors.tekton-pipelines.svc/cel" | ||
# Until #869 is implemented, the params field is only informational | ||
params: | ||
- name: "filter" | ||
description: "A CEL expression that evaluates to true or false" | ||
- name: "overlays" | ||
description: "CEL expressions whose values get mapped to user defined keys" | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: Interceptor | ||
metadata: | ||
name: bitbucket | ||
spec: | ||
clientConfig: | ||
url: "http://tekton-triggers-core-interceptors.tekton-pipelines.svc/bitbucket" | ||
# Until #869 is implemented, the params field is only informational | ||
params: | ||
- name: "eventTypes" | ||
description: "A list of event types to accept" | ||
- name: "secretRef" | ||
description: "A reference to a secret containing a shared token for payload validation" | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: Interceptor | ||
metadata: | ||
name: github | ||
spec: | ||
clientConfig: | ||
url: "http://tekton-triggers-core-interceptors.tekton-pipelines.svc/github" | ||
# Until #869 is implemented, the params field is only informational | ||
params: | ||
- name: "eventTypes" | ||
description: "A list of event types to accept" | ||
- name: "secretRef" | ||
description: "A reference to a secret containing a shared token for payload validation" | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: Interceptor | ||
metadata: | ||
name: gitlab | ||
spec: | ||
clientConfig: | ||
url: "http://tekton-triggers-core-interceptors.tekton-pipelines.svc/gitlab" | ||
# Until #869 is implemented, the params field is only informational | ||
params: | ||
- name: "eventTypes" | ||
description: "A list of event types to accept" | ||
- name: "secretRef" | ||
description: "A reference to a secret containing a shared token for payload validation" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!-- | ||
--- | ||
linkTitle: "Interceptor" | ||
weight: 9 | ||
--- | ||
--> | ||
# Interceptor | ||
|
||
A `Interceptor` is cluster scoped resource that can be invoked during the | ||
processing of a trigger to modify the behavior or payload of Triggers. The | ||
custom resource describes how an EventListener can connect to a workload that | ||
is running the interceptor business logic (and in the future what extra | ||
paramters the interceptor accepts). | ||
|
||
**NOTE**: This doc is a WIP. Please also see the [Interceptors section](./eventlisteners.md#interceptors) in the EventListener doc. | ||
|
||
- [Interceptors](#interceptors) | ||
- [Syntax](#syntax) | ||
-- [clientConfig](#clientConfig) | ||
|
||
## Syntax | ||
|
||
To define a configuration file for an `Interceptor` resource, you can specify | ||
the following fields: | ||
|
||
- Required: | ||
- [`apiVersion`][kubernetes-overview] - Specifies the API version, for example | ||
`triggers.tekton.dev/v1alpha1`. | ||
- [`kind`][kubernetes-overview] - Specifies the `Trigger` resource | ||
object. | ||
- [`metadata`][kubernetes-overview] - Specifies data to uniquely identify the | ||
`Interceptor` resource object, for example a `name`. | ||
- [`spec`][kubernetes-overview] - Specifies the configuration information for | ||
your Interceptor resource object. The spec include: | ||
- [`clientConfig`] - Specifies how a client (e.g. an EventListener) can communicate with the Interceptor. | ||
|
||
### clientConfig | ||
|
||
The `clientConfig` field describes how a client can communicate with an | ||
interceptor. At the moment, it can contain only the `url` field whose value is | ||
a resolvable URL. EventListeners will send forward requests to this URL. | ||
|
||
```yaml | ||
spec: | ||
clientConfig: | ||
url: "http://interceptor-svc.default.svc/" | ||
``` | ||
## Examples | ||
Triggers ships with a few built-in interceptors. These configurations can be found [`config/interceptors`](../config/interceptors). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.