Skip to content
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

Add cluster remote resolver #5405

Merged
merged 1 commit into from
Sep 6, 2022
Merged

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Aug 31, 2022

Changes

Relates to #4476 and https://github.com/tektoncd/community/blob/main/teps/0096-pipelines-v1-api.md

This resolver replaces ClusterTasks going forward.

/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Add a cluster resolver for referencing Pipeline and Task resources in other namespaces

@abayer abayer added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 31, 2022
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 31, 2022
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 31, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 79.0% 78.1% -0.9
pkg/resolution/resolver/cluster/resolver.go Do not exist 80.6%

@abayer
Copy link
Contributor Author

abayer commented Aug 31, 2022

/retest

1 similar comment
@abayer
Copy link
Contributor Author

abayer commented Aug 31, 2022

/retest

@abayer
Copy link
Contributor Author

abayer commented Aug 31, 2022

/assign @vdemeester @jerop @lbernick
cc @chuangw6


| Option Name | Description | Example Values |
|----------------|--------------------------------------------------------------------|--------------------|
| `default-kind` | The default resource kind to fetch if not specified in parameters. | `task`, `pipeline` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth having a default namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, seems reasonable. Adding that now.

docs/cluster-resolver.md Show resolved Hide resolved
pkg/resolution/resolver/cluster/resolver_test.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 31, 2022
@abayer abayer force-pushed the cluster-resolver branch 2 times, most recently from 4323579 to e7cc98f Compare August 31, 2022 20:18
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 79.0% 78.1% -0.9
pkg/resolution/resolver/cluster/resolver.go Do not exist 82.8%

@abayer
Copy link
Contributor Author

abayer commented Aug 31, 2022

/retest

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the resolver have access to all namespace (by default, in what we ship / will ship) ? It might not have (or shouldn't ?), and thus allowing the user to specify the namespace "might" be prohibited. I don't think that's a problem, but we might want to document that.

app.kubernetes.io/part-of: tekton-pipelines
data:
# The default kind to fetch.
default-kind: "task"
Copy link
Member

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 kind param right ?

Copy link
Member

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 👼🏼

Copy link
Contributor Author

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 kind so we know whether to use the Task or Pipeline lookup, but the git resolver doesn't actually need to know, nor will the coming go-scm-based one. The bundle and hub ones also do need to know, so they can look in the right bundle layer/directory respectively.

@abayer
Copy link
Contributor Author

abayer commented Sep 1, 2022

Does the resolver have access to all namespace (by default, in what we ship / will ship) ? It might not have (or shouldn't ?), and thus allowing the user to specify the namespace "might" be prohibited. I don't think that's a problem, but we might want to document that.

Good question? With https://github.com/tektoncd/pipeline/pull/5405/files#diff-ce83974e71e344e3684dc4c1d40b14800038482fa264e3111f08c83827d60fc6R28-R30, the resolver should, I think?

@vdemeester
Copy link
Member

@abayer
Copy link
Contributor Author

abayer commented Sep 1, 2022

Ok, so that's a really good question: should we allow access to all namespaces? Or perhaps more accurately, should we have a way of only allowing and/or blocking access to a specified list of namespaces? I'm leaning towards yes...

@abayer
Copy link
Contributor Author

abayer commented Sep 1, 2022

Alright, I'm adding new allowed-namespaces and blocked-namespaces config fields. They're both optional comma-separated lists of namespaces. If they're empty, all namespaces can be used. If allowed-namespaces contains namespaces, then the requested namespace must be in that list, and if blocked-namespaces contains namespaces, then the requested namespace must not be in that list.

Relates to tektoncd#4476 and https://github.com/tektoncd/community/blob/main/teps/0096-pipelines-v1-api.md

This resolver replaces `ClusterTask`s going forward.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 1, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 79.0% 78.1% -0.9
pkg/resolution/resolver/cluster/resolver.go Do not exist 84.7%

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM 🐯

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [lbernick,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@abayer
Copy link
Contributor Author

abayer commented Sep 5, 2022

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@abayer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abayer
Copy link
Contributor Author

abayer commented Sep 6, 2022

ping @lbernick @jerop - looking for an lgtm. =)

@lbernick
Copy link
Member

lbernick commented Sep 6, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 6, 2022
@tekton-robot tekton-robot merged commit 6074fa4 into tektoncd:main Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants