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 ClusterTask new CRD #312

Merged
merged 2 commits into from
Dec 6, 2018

Conversation

nader-ziada
Copy link
Member

Fixes: #251

Proposed changes:

  • new type for ClusterTask
  • Add kind to TaskRef to differentiate between Task kinds
  • TaskInterface to be used by controllers, implemented by Task and ClusterTask
  • update taskRun and pipelineRun to use TaskInterface
  • update docs and tests

@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 5, 2018
@nader-ziada
Copy link
Member Author

/cc @imjasonh @shashwathi @bobcatfish

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.

Small comments, otherwise looks good ! 👼

docs/Concepts.md Outdated
@@ -126,6 +126,10 @@ pull in your environment, so we provide a way for you to configure that by edit
the `image`'s value in a configmap named
[`config-entrypoint`](./../config/config-entrypoint.yaml).

### ClusterTask

Similar to `Tasks` but but with a cluster scope.
Copy link
Member

Choose a reason for hiding this comment

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

one but to remove 😅

// TaskStatus does not contain anything because Tasks on their own
// do not have a status, they just hold data which is later used by a
// TaskRun.
type TaskStatus struct {
Copy link
Member

Choose a reason for hiding this comment

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

🎉

@@ -144,9 +150,10 @@ func ResolvePipelineRun(getTask resources.GetTask, getResource resources.GetReso

// Get all the resources that this task will be using, if any
inputs, outputs := getPipelineRunTaskResources(pt.Name, pr)
rtr, err := resources.ResolveTaskResources(&t.Spec, t.Name, inputs, outputs, getResource)
spec := t.TaskSpec()
rtr, err := resources.ResolveTaskResources(&spec, t.TaskMetadata().Name, inputs, outputs, getResource)
Copy link
Member

Choose a reason for hiding this comment

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

nit: Could we have a t.Name() function here ? (kind-of a shortcut so, not that important)

 - issue 251: tektoncd#251
 - new type for ClusterTask
 - Add kind to TaskRef to differentiate between Task kinds
 - TaskInterface to be used by controllers, implemeted by
 Task and ClusterTask
 - update taskRun and pipelineRun to use TaskInterface
 - update docs

Signed-off-by: Nader Ziada <[email protected]>
Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

Two small questions otherwise LGTM

metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just copied that from task.yaml but its left over from when these files were generated and should be removed. will take it out from both

metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []Task `json:"items"`
Copy link
Member

Choose a reason for hiding this comment

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

[]ClusterTask ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes it should be []ClusterTask, will fix that

- added copyright notice to yaml files in config/
- removed labels left over from kubebuilder generation from yaml files
- fixed ClusterTask type in list items
- add correct optional type in taskRun type

Signed-off-by: Nader Ziada <[email protected]>
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-build-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/controller/main.go 3.6% 3.5% -0.1
pkg/apis/pipeline/v1alpha1/cluster_task_types.go Do not exist 0.0%
pkg/apis/pipeline/v1alpha1/cluster_task_validation.go Do not exist 0.0%
pkg/apis/pipeline/v1alpha1/task_types.go 100.0% 25.0% -75.0
pkg/apis/pipeline/v1alpha1/taskrun_defaults.go Do not exist 0.0%

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.

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2018
@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pivotal-nader-ziada, 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 [pivotal-nader-ziada]

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

@knative-prow-robot knative-prow-robot merged commit 2c9cf4f into tektoncd:master Dec 6, 2018
@@ -126,6 +126,11 @@ pull in your environment, so we provide a way for you to configure that by edit
the `image`'s value in a configmap named
[`config-entrypoint`](./../config/config-entrypoint.yaml).

### Cluster Task

Similar to `Task` but with a cluster-wide scope. Cluster Tasks are available in
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we provide some examples of Cluster tasks to users? Like what kind of tasks could be cluster task Vs a normal Task.
Why shdn't all tasks be cluster tasks?

Copy link
Member Author

Choose a reason for hiding this comment

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

@tejal29 any task can be a ClusterTask, it depends on how operators set up their clusters, if they want their users to just use standard tasks available for everybody in all namespaces, or want users to setup their own. It is similar to ClusterBuildTemplates and BuildTemplates in Build

Copy link
Collaborator

Choose a reason for hiding this comment

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

one thing that i noticed in the most recent user study is that i think we've started mixing some of our using docs into the concepts docs - I'd like to move some of the stuff we've got in concepts.md out and keep this doc pretty short and sweet, just about the high level concepts

something we can iterate on tho! and i think it might make sense to write up some guidelines on which docs go where 🤔

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. lgtm Indicates that a PR is ready to be merged. 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.

7 participants