-
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
Introduce rfc-0009-supply-chain-switches-template-on-flag #75
base: main
Are you sure you want to change the base?
Introduce rfc-0009-supply-chain-switches-template-on-flag #75
Conversation
We're landing ytt support. Wondering if it invalidates this approach as we can switch in template on different sources, or does that make it "more than break glass" ? |
Bumping the milestone on this to 1.0+ as this is achievable with YTT. |
✔️ Deploy Preview for elated-stonebraker-105904 canceled. 🔨 Explore the source changes: 547f596 🔍 Inspect the deploy log: https://app.netlify.com/sites/elated-stonebraker-105904/deploys/61f2ce4ea26dd000074302d0 |
Remove fallback strategy option Add mutating webhook strategy Refer to label selector behavior currently available Add selection based on information available in template context
e41582c
to
843c49f
Compare
Not necessary to resolve this question to approve this RFC but just a thought: The way our informers work currently, if a template referenced in a blueprint changes, any owner that matched the blueprint will be re-reconciled. After this RFC is implemented, it is plausible that there will be a significant number of templates in a blueprint that are irrelevant to a given owner, and it doesn't seem worth re-reconciling all of those owners when those templates change. Again, definitely not necessary to address this as part of this RFC, but just wanted to document the thought for posterity if the RFC is approved. |
Co-authored-by: Marty Spiewak <[email protected]>
Sounds like another good quality of deterministic supply chains. As long as we can calculate which templates in a supply chain will be chosen for a workload, we can avoid unnecessary reconciles. (Though that does beg the question, how expensive will that calculation be, will we need to cache the calculation somehow?) |
dfdc44e
to
f72a3cb
Compare
Co-authored-by: Marty Spiewak <[email protected]>
selectors can be added later). A MatchFields contains: | ||
- `key`: a path on the workload object. The path must be prefixed by `workload`. | ||
- `operator`: One of `In`, `NotIn`, `Exists`, `DoesNotExist` | ||
- `values`: Required and allowed only when the operator is either `In` or `NotIn`. A list of json values. |
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.
In/NotIn is probably insufficent for a numeric json type
Boolean types could be better matched with boolean operators too. Propose:
Exists
DoesNotExist
are generic (as they do not expect avalues
)In
NotIn
are suitable for strings, with avalues
fieldLessThan
,GreaterThan
,Equal
,NotEqual
,LessThanOrEqual
,GreaterThanOrEqual
(and/or)<
,>
,==
,!=
,<=
,>=
for numeric types on a field calledvalue
Is
(and perhapsIsNot
against avalue
field that can only betrue
orfalse
for booleans.
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.
Also I don't think this has to be resolved/implemented immediately. We could support a jsonType in the spec, but throw a not implemented
error for anything non-string, and work through a healthy design for matchers to implement later.
@sclevine do you approve? Wanting to get as many maintainers approvals since we have no formal process (yet). |
|
||
## Alternatives | ||
|
||
### Label selectors for choosing templates |
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.
I might be missing something, so please correct me if I'm wrong, but it feels like this approach could actually be a separate rule for options
. e.g., one could make use of both proposals with something like
resources:
- name: source-provider
templateRef:
kind: ClusterSourceTemplate
options:
- name: git-template
selector:
matchFields:
- key: workload.spec.source.git # would match if the workload has this field filled in
operator: Exists
- name: imgpkg-bundle-template
selector:
matchLabels: # or the label set below
app.tanzu.vmware.com/source-type: imgpkg-bundle
although mixing like in the example I provided does seem like an odd approach to designing a supplychain imo
LGTM - I'm not on the maintainers list but wanted to express my +1. I like the approach and praise for finding a solution that keeps the current developer UX consistent, i.e. avoiding adding extra labels to the workload to help select the platform specific resources. |
particular template, authors can provide `options` which is a list of options. An option is | ||
a `name` and a `selector`. The only selector adopted by this RFC is `MatchFields` (though other | ||
selectors can be added later). A MatchFields contains: | ||
- `key`: a path on the workload object. The path must be prefixed by `workload`. |
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.
I didn't see anything describing how this path is defined, is it JSON Path?
specify a single template kind (e.g. ClusterImageTemplate). Rather than specifying the name of a | ||
particular template, authors can provide `options` which is a list of options. An option is |
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 the options
field mutually exclusive with name
, or is name removed and the the options list must be used even when there is a single choice?
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.
Mutually exclusive. This will not present a breaking change.
Workarounds, for example templates that use ytt templating to embed conditional behavior, | ||
would represent a code smell that this primitive is not adequate for Cartographer users. |
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.
I fully expect use of ytt to manage conditional output to still be in very wide spread use. What this RFC is enabling is the ability to avoid a root level if/else where there is otherwise little commonality. In some cases a template may be able to shift away from using ytt, but I don't expect that to be common.
ytt remains the only meaningful way to:
- conditionally add/remove a field
- iterate over values
- coerce types
- apply logic
- do anything dynamic other than plain substitution
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.
ytt is useful. But there would be advantages to eliminating its use. For example.
ytt remains the only meaningful way to:
Enumerating these uses is valuable! We can begin to observe which are the most common and prioritize developing Cartographer native alternatives!
@waciumawanjohi do you mind merging this? |
Readable