-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Disallow unknown fields from resources struct #1081
Disallow unknown fields from resources struct #1081
Conversation
Before this change, it is possible to passe any additionnal field (in the yaml/json form) with Tekton resources. This is now disallowed. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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:
Approvers can indicate their approval by writing |
/hold |
clusters: | ||
- name: targetCluster | ||
description: Not yet used, kubectl command below should use this cluster | ||
#clusters: |
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.
Wasn't sure where this comes from. I am guessing we should remove this altogether most likely 👼
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.
oh wow! yeah feel free to remove it, this is leftover from a really old version of the spec XD
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.
forgot to update before removing the hold 😅
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.
Could you perhaps have a test, which actually validates this behavior. Would feel better when not only the happy-paths are tested.
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.
@abergmeier yes, working on it (once I land somewhere 🤭)
66e640b
to
d229fb2
Compare
This is great. I have definitely been confused by this behaviour before. /lgtm |
ermagherd so cool! I'm glad we can fix this!! |
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.
This is great!!!
I wonder if we need to cherry-pick it into 0.5.2 however. If you feel strongly I'm fine with doing it, but considering that we have to keep fixing 0.5 I feel like it'd be good to minimize the risk in stuff we cherry pick into the release and this kinda feels like a new feature?
/lgtm
/meow space
Logger: logger, | ||
|
||
Logger: logger, | ||
DisallowUnknownFields: true, |
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.
For my own curiosity: is this a feature that got added somewhere recently, or something we could have been using all along?
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.
and p.s. if it's not new, do you happen to know why ppl looking at this issue before thought we couldn't easily fix it? (#297 (comment))
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.
It was added with knative/pkg#338, so ~4month ago 😉
@@ -27,6 +27,4 @@ metadata: | |||
spec: | |||
pipelineRef: | |||
name: sample-pipeline-cluster-task-4 | |||
trigger: | |||
type: manual |
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.
🤦♀
clusters: | ||
- name: targetCluster | ||
description: Not yet used, kubectl command below should use this cluster | ||
#clusters: |
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.
oh wow! yeah feel free to remove it, this is leftover from a really old version of the spec XD
In response to this:
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. |
Looking at this once more, minor suggestion for the release note: At the moment it reads |
Interesting failure 😓
@sbwsg thx 😻 I'll update 😉 |
Interesting that it failed there but not when applying 🤔 🤦♂️ |
Now that the webhook disallow unknown fields, some examples fails where they didn't before — which is a good thing. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
d229fb2
to
8068575
Compare
/lgtm |
/hold cancel |
Changes
Before this change, it is possible to passe any additionnal field (in
the yaml/json form) with Tekton resources. This is now disallowed.
Closes #297
cc @bobcatfish
Signed-off-by: Vincent Demeester vdemeest@redhat.com
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task and TaskRun to build and release this image
Release Notes