-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add cluster remote resolver #5405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,32 @@ | ||
| # Copyright 2022 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 | ||
| # | ||
| # https://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: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: cluster-resolver-config | ||
| namespace: tekton-pipelines | ||
| labels: | ||
| app.kubernetes.io/component: resolvers | ||
| app.kubernetes.io/instance: default | ||
| app.kubernetes.io/part-of: tekton-pipelines | ||
| data: | ||
| # The default kind to fetch. | ||
| default-kind: "task" | ||
| # The default namespace to look for resources in. | ||
| default-namespace: "" | ||
| # An optional comma-separated list of namespaces which the resolver is allowed to access. Defaults to empty, meaning all namespaces are allowed. | ||
| allowed-namespaces: "" | ||
| # An optional comma-separated list of namespaces which the resolver is blocked from accessing. Defaults to empty, meaning all namespaces are allowed. | ||
| blocked-namespaces: "" | ||
This file contains hidden or 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,81 @@ | ||
| # Cluster Resolver | ||
|
|
||
| ## Resolver Type | ||
|
|
||
| This Resolver responds to type `cluster`. | ||
|
|
||
| ## Parameters | ||
|
|
||
| | Param Name | Description | Example Value | | ||
| |-------------|-------------------------------------------------------|------------------------------| | ||
| | `kind` | The kind of resource to fetch. | `task`, `pipeline` | | ||
| | `name` | The name of the resource to fetch. | `some-pipeline`, `some-task` | | ||
| | `namespace` | The namespace in the cluster containing the resource. | `default`, `other-namespace` | | ||
|
|
||
| ## Requirements | ||
|
|
||
| - A cluster running Tekton Pipeline v0.40.0 or later, with the `alpha` feature gate enabled. | ||
| - The [built-in remote resolvers installed](./install.md#installing-and-configuring-remote-task-and-pipeline-resolution). | ||
| - The `enable-cluster-resolver` feature flag set to `true`. | ||
|
|
||
| ## Configuration | ||
|
|
||
| This resolver uses a `ConfigMap` for its settings. See | ||
| [`../config/resolvers/cluster-resolver-config.yaml`](../config/resolvers/cluster-resolver-config.yaml) | ||
| for the name, namespace and defaults that the resolver ships with. | ||
|
|
||
| ### Options | ||
|
|
||
| | Option Name | Description | Example Values | | ||
| |----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | ||
| | `default-kind` | The default resource kind to fetch if not specified in parameters. | `task`, `pipeline` | | ||
| | `default-namespace` | The default namespace to fetch resources from if not specified in parameters. | `default`, `some-namespace` | | ||
| | `allowed-namespaces` | An optional comma-separated list of namespaces which the resolver is allowed to access. Defaults to empty, meaning all namespaces are allowed. | `default,some-namespace`, (empty) | | ||
| | `blocked-namespaces` | An optional comma-separated list of namespaces which the resolver is blocked from accessing. Defaults to empty, meaning all namespaces are allowed. | `default,other-namespace`, (empty) | | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Task Resolution | ||
|
|
||
| ```yaml | ||
| apiVersion: tekton.dev/v1beta1 | ||
| kind: TaskRun | ||
| metadata: | ||
| name: remote-task-reference | ||
| spec: | ||
| taskRef: | ||
| resolver: cluster | ||
| params: | ||
| - name: kind | ||
| value: task | ||
lbernick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: name | ||
| value: some-task | ||
| - name: namespace | ||
| value: namespace-containing-task | ||
| ``` | ||
|
|
||
| ### Pipeline resolution | ||
|
|
||
| ```yaml | ||
| apiVersion: tekton.dev/v1beta1 | ||
| kind: PipelineRun | ||
| metadata: | ||
| name: remote-pipeline-reference | ||
| spec: | ||
| pipelineRef: | ||
| resolver: cluster | ||
| params: | ||
| - name: kind | ||
| value: pipeline | ||
| - name: name | ||
| value: some-pipeline | ||
| - name: namespace | ||
| value: namespace-containing-pipeline | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| Except as otherwise noted, the content of this page is licensed under the | ||
| [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), | ||
| and code samples are licensed under the | ||
| [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
| /* | ||
| Copyright 2022 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. | ||
|
|
||
| */ | ||
|
|
||
| package cluster | ||
|
|
||
| const ( | ||
| // ResourceNameAnnotation is the annotation key for the fetched resource name | ||
| ResourceNameAnnotation = "name" | ||
| // ResourceNamespaceAnnotation is the annotation key for the fetched resource's namespace | ||
| ResourceNamespaceAnnotation = "namespace" | ||
| ) |
This file contains hidden or 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,31 @@ | ||
| /* | ||
| Copyright 2022 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. | ||
| */ | ||
|
|
||
| package cluster | ||
|
|
||
| const ( | ||
| // DefaultKindKey is the key in the config map for the default kind setting | ||
| DefaultKindKey = "default-kind" | ||
| // DefaultNamespaceKey is the key in the config map for the default namespace setting | ||
| DefaultNamespaceKey = "default-namespace" | ||
|
|
||
| // AllowedNamespacesKey is the key in the config map for an optional comma-separated list of namespaces which the | ||
| // resolver is allowed to access. Defaults to empty, meaning all namespaces are allowed. | ||
| AllowedNamespacesKey = "allowed-namespaces" | ||
| // BlockedNamespacesKey is the key in the config map for an optional comma-separated list of namespaces which the | ||
| // resolver is blocked from accessing. Defaults to empty, meaning no namespaces are blocked. | ||
| BlockedNamespacesKey = "blocked-namespaces" | ||
| ) |
This file contains hidden or 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,26 @@ | ||
| /* | ||
| Copyright 2022 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. | ||
| */ | ||
|
|
||
| package cluster | ||
|
|
||
| const ( | ||
| // KindParam is the parameter for the object kind | ||
| KindParam = "kind" | ||
| // NameParam is the parameter for the object name | ||
| NameParam = "name" | ||
| // NamespaceParam is the parameter for the namespace containing the object | ||
| NamespaceParam = "namespace" | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for ? 🤔 if we do not pass
kindparam right ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#5408 would handle this for "from pipeline usage" I guess, but when creating the request aside from that, I think it make sense 👼🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm torn as to whether to include this default or not. We do need to know the
kindso we know whether to use theTaskorPipelinelookup, but thegitresolver doesn't actually need to know, nor will the coming go-scm-based one. Thebundleandhubones also do need to know, so they can look in the right bundle layer/directory respectively.