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

[celeval] CEL Custom Tasks CRD #784

Closed
wants to merge 1 commit into from
Closed

[celeval] CEL Custom Tasks CRD #784

wants to merge 1 commit into from

Conversation

jerop
Copy link
Member

@jerop jerop commented Aug 26, 2021

Changes

We introduced CEL Custom Tasks to experiment with using an expression language with Tekton Pipelines.

Given feedback from the past several months of usage, we have identified three main current challenges:

To address the above challenges, this change introduces a CRD for CEL Custom Tasks, which takes CEL expressions and CEL environment variables. With this change:

  • CEL custom tasks now take variables for the CEL environment
  • CEL custom tasks are reusable across different Runs and PipelineRuns
  • CEL custom tasks take expressions through its own field

Closes tektoncd/community#403
Closes #716

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Commit messages includes a project tag in the subject - e.g. [OCI], [hub], [results], [task-loops]

See the contribution guide for more details.

/cc @vincent-pli @bobcatfish @imjasonh @pritidesai @bigkevmcd @vdemeester

@tekton-robot
Copy link

@jerop: GitHub didn't allow me to request PR reviews from the following users: vincent-pli.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Changes

We introduced CEL Custom Tasks to experiment with using an expression language with Tekton Pipelines.

Given feedback from the past several months of usage, we have identified three main current challenges:

To address the above challenges, this change introduces a CRD for CEL Custom Tasks, which takes CEL expressions and CEL environment variables. With this change:

  • CEL custom tasks now take variables for the CEL environment
  • CEL custom tasks are reusable across different Runs and PipelineRuns
  • CEL custom tasks take expressions through its own field

Closes tektoncd/community#403
Closes #716

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Commit messages includes a project tag in the subject - e.g. [OCI], [hub], [results], [task-loops]

See the contribution guide for more details.

/cc @vincent-pli @bobcatfish @imjasonh @pritidesai @bigkevmcd @vdemeester

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.

@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 26, 2021
@jerop jerop marked this pull request as draft August 26, 2021 14:56
@jerop jerop force-pushed the cel-crd branch 21 times, most recently from 6b79981 to eb7268c Compare August 31, 2021 20:58
cel/config/201-clusterrole.yaml Outdated Show resolved Hide resolved
cel/config/201-clusterrole.yaml Outdated Show resolved Hide resolved
cel/config/500-controller.yaml Outdated Show resolved Hide resolved
cel/pkg/reconciler/celrun/celrun.go Outdated Show resolved Hide resolved
cel/pkg/reconciler/celrun/celrun.go Outdated Show resolved Hide resolved
tekton-robot pushed a commit that referenced this pull request Sep 3, 2021
wlynch has reviewed #784
where we introduce cel custom tasks crd -- so adding him as an owner
so he has approval permissions
@jerop jerop force-pushed the cel-crd branch 2 times, most recently from 8f85ec9 to 693e075 Compare September 3, 2021 22:16
cel/README.md Outdated Show resolved Hide resolved
cel/README.md Outdated Show resolved Hide resolved
@jerop jerop force-pushed the cel-crd branch 3 times, most recently from ee11149 to 150ca7c Compare September 7, 2021 22:11
@jerop
Copy link
Member Author

jerop commented Sep 7, 2021

/retest

@bobcatfish
Copy link
Contributor

The last thing on my mind is renaming from CEL to something a bit more descriptive but other than that 👍 !

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2021
Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

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

Aside from the RBAC feedback, everything else is minor nits. Should be LGTM after this!

resourceNames: ["config-logging", "config-observability", "config-leader-election"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "watch"]
Copy link
Member

Choose a reason for hiding this comment

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

From https://kubernetes.io/docs/concepts/configuration/secret/#clients-that-use-the-secret-api -

For these reasons watch and list requests for secrets within a namespace are extremely powerful capabilities and should be avoided, since listing secrets allows the clients to inspect the values of all secrets that are in that namespace. The ability to watch and list all secrets in a cluster should be reserved for only the most privileged, system-level components.

Can we scope this down as well? (I assume this also applies to configmaps as well)

cel/pkg/reconciler/celrun/celrun.go Outdated Show resolved Hide resolved
run.ObjectMeta.Labels[key] = value
}
run.ObjectMeta.Labels[cel.GroupName+CELLabelKey] = CELMeta.Name
run.ObjectMeta.Labels[KindLabelKey] = cel.ControllerName
Copy link
Member

Choose a reason for hiding this comment

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

"kind" is a bit generic (and might have a confusing meaning w/ Object kind) - should we use app.kubernetes.io/managed-by instead?


const (
// CELLabelKey is the label identifier for a CEL, which is added to the Run
CELLabelKey = "/CEL"
Copy link
Member

Choose a reason for hiding this comment

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

Are labels case sensitive? Double checking since the README.md examples show custom.tekton.dev/cel.

Comment on lines 231 to 232
run.ObjectMeta.Labels[cel.GroupName+CELLabelKey] = CELMeta.Name
run.ObjectMeta.Labels[KindLabelKey] = cel.ControllerName
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a section to the docs to list labels we add to the created object and what they mean.

cel/pkg/reconciler/celrun/celrun.go Outdated Show resolved Hide resolved
cel/pkg/reconciler/celrun/celrun_test.go Outdated Show resolved Hide resolved
Comment on lines 425 to 428
// The fake recorder runs in a go routine, so the timeout is here to avoid waiting
// on the channel forever if fewer than expected events are received.
// We only hit the timeout in case of failure of the test, so the actual value
// of the timeout is not so relevant. It's only used when tests are going to fail.
Copy link
Member

Choose a reason for hiding this comment

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

You might be able to avoid the timeout altogether if you close the channel before comparing. Since the reconciler.Reconcile call is synchronous, this should be safe.

cel/test/init_test.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bobcatfish

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:

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

We introduced CEL Custom Tasks to experiment with using an expression
language with Tekton Pipelines.

Given feedback from the past several months of usage, we have identified
three main current challenges:
- CEL custom tasks do not take variables for the CEL environment.
As such, users cannot evaluate CEL expressions given specific variables
or in specific context. For example, as described in
tektoncd#716 and
tektoncd/community#403, a user needed to
declare runtime storage variables in the CEL environment.
- CEL custom tasks are not a CRD thus making them unreusable across
different Runs and PipelineRuns. Read more in
tektoncd/community#314 (review).
- CEL custom tasks take the CEL expressions through Parameters which is
misleading to some users. Read more in
tektoncd/community#314 (review).

To address the above challenges, this change introduces a CRD for CEL
Custom Tasks, which takes CEL expressions and CEL environment variables.
With this change:
- CEL custom tasks now take variables for the CEL environment
- CEL custom tasks are reusable across different Runs and PipelineRuns
- CEL custom tasks take expressions through its own field

Closes tektoncd/community#403
Closes tektoncd#716
@jerop jerop changed the title [cel] CEL Custom Tasks CRD [celeval] CEL Custom Tasks CRD Oct 19, 2021
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2022
@tekton-robot
Copy link

@jerop: PR needs rebase.

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.

@tekton-robot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 14, 2022
@jerop
Copy link
Member Author

jerop commented May 2, 2022

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 2, 2022
@jerop
Copy link
Member Author

jerop commented May 2, 2022

hoping to revisit this some time 🤞🏾

closing for now

@jerop jerop closed this May 2, 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. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

Add ability to parse variables in expression from context for CEL Proposal: Introduce new CRD for CEL
5 participants