-
Notifications
You must be signed in to change notification settings - Fork 64
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
RFC: Add template field for runnable #787
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for elated-stonebraker-105904 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
||
[unresolved-questions]: #unresolved-questions | ||
|
||
Is the field name `template` even appropriate? Nothing is being templated, an object is completely defined in the |
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 about runnable.spec.selector
? even if there's no templating to be done for what used to be the inputs
field, I imagine there'd still be the need of templating properties of the selected object? or is part of the proposal to get rid of it?
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.
template
is a very common field/term in k8s when a significant portion of one resource is inlined into another resource. For example, Deployments have .spec.template
which is a PodTemplateSpec, which has its own nested .spec.template
which is a PodSpec.
from what I recall, there were two big reasons for having a
1. runnable useful on its ownthe idea there was that one could find Runnable useful outside a cartographer supply chain so that, as long as they have a way of updating looking at the questions we receive, I don't believe this has been the case - Runnable is not as promoted as the main CRDs and I don't think there are many ways of using it by itself out there outside cartographer anyway, so I don't think this is much relevant 2. preventing conflicting templating w/ carto's Cluster*Templatea big reason for having a kind: ClusterImageTemplate
spec:
template: # $()$ interpolation
kind: Runnable
spec:
template: # which interpolation? $$()$$? by breaking into a separate object, we were able to then keep that single level of templating kind: ClusterImageTemplate
spec:
template: # $()$ interpolation
kind: Runnable
spec:
runTemplateRef: <> with this RFC, if we keep 3. preventing conflicting templating w/ the interpolation syntax of the childrenanother point of "multiple templating" being involved is in regards to the definition of the object itself - while tekton provides us primitives where we can separate the execution of a pipeline (PipelineRun) from the Pipeline itself (via to illustrate that, consider a ClusterImageTemplate using a slightly modified version of the Runnable proposed here but making use of apiVersion: carto.run/v1alpha1
kind: ClusterImageTemplate
metadata:
name: testing-pipeline
spec:
imagePath: status.outputs.image
template:
apiVersion: carto.run/v1alpha1
kind: Runnable
metadata:
name: $(workload.metadata.name)$
spec:
outputs:
image: status.results[?(@.name=="image")].value
template:
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: $(workload.metadata.name)$-
spec:
params:
- name: tag
value: $(params.tag)$
pipelineSpec:
params:
- name: tag
tasks:
- name: build-image
taskRef: {name: kaniko}
params:
- name: tag
value: $(params.tag) #! tekton's $() syntax
results:
- name: image
value: $(tasks.build-image.results.image) #! tekton's $() syntax here we can see how the |
left some context in #787 (comment), but overall I do like the idea of trying to simplify Runnable with some form of inlining. For me the biggest issue I see at the moment is
|
Maybe I think the changes in #787 and #705 might be better candidates for inclusion in the larger work around #766, rather than iterative changes. |
|
||
[unresolved-questions]: #unresolved-questions | ||
|
||
Is the field name `template` even appropriate? Nothing is being templated, an object is completely defined in the |
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.
template
is a very common field/term in k8s when a significant portion of one resource is inlined into another resource. For example, Deployments have .spec.template
which is a PodTemplateSpec, which has its own nested .spec.template
which is a PodSpec.
The object defined in the Runnable is submitted to the cluster. The runnable exposes the output fields defined in | ||
the runnable's own status. Care should be taken to garbage collect objects submitted by a runnable if the GVK or | ||
name of the object is changed. |
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.
Is this different than today's behavior for Runnable?
Rather than removing ClusterRunTemplates altogether, the `template` field option could exist alongside the the | ||
`runTemplateRef` field. This has the advantage of preserving the owner-template relationship described in the | ||
[drawbacks] section above. This does lead to its own complications: |
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.
Preserving backwards compatibility is important. It's fine to deprecate the old behavior if the eventual goal is to remove it. Having a window where the old and new models both work gives users time to migrate.
This RFC would require a version bump for Runnable. There is no technical reason that Runnables with valid | ||
references to ClusterRunTemplate could not be translated into Runnables with template fields embedded. |
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.
Bumping the version isn't required for additive changes. If we did update the version, the old and new fields would need to have a home on both the v1alpha1 and v1alpha2 versions, in order for the CRD conversion support to function.
marking it as blocked as we'd like to tackle #815 first in order to be able to get rid of the templating at clusterruntemplate level w/ regards to selector |
Changes proposed by this PR
RFC to change Runnable
Readable
Release Note
PR Checklist
Note: Please do not remove items. Mark items as done
[x]
or usestrikethroughif you believe they are not relevant[ ] Linked to a relevant issue. Eg:Fixes #123
orUpdates #123
wip
commits[ ] Filled in the Release Note section above[ ] Modified the docs to match changes