-
Notifications
You must be signed in to change notification settings - Fork 1.2k
update the Service schema with v1 schema #9436
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
update the Service schema with v1 schema #9436
Conversation
Welcome @joshuawilson! It looks like this is your first PR to knative/serving 🎉 |
Hi @joshuawilson. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
required: | ||
- apiVersion | ||
- kind | ||
- metadata |
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 don't think definitions for these properties are necessary?
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 know that they are expected but if we don't list them then any validation tool would not know they are required.
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 removed these 3 objects completely.
deletionTimestamp is also set. | ||
\nMay only be shortened. | ||
\nRead-only." | ||
deletionTimestamp: |
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.
There's a bunch of properties like deletionTimestamp
that we don't want to accept in the template
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 think I found it here: https://github.com/knative/serving/blob/master/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go#L131
If it's not to be used should it be removed from the API? Or Is this file not a part of the API and I should not be using this file?
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 left this in waiting for further clarification.
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 there a way to push this into the tooling?
That would simplify things since across the Knative project there are probably close to ~50 CRDs
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.
seems like k8s rejects this over-specification
see the e2e integration checks where installation fails
@@ -59,6 +59,1129 @@ spec: | |||
- << : *version | |||
name: v1 | |||
storage: true | |||
schema: | |||
openAPIV3Schema: | |||
x-kubernetes-preserve-unknown-fields: 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.
does this apply to nested properties now?
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 think it applies to everything under it. I left it in place because I don't have a way to verify that I have a perfect match to the API.
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.
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.
Digging into the example you linked it seems like spec.something
was pruned.
This means that the something field in the specified spec object is pruned, but everything outside is not.
It seems like x-kubernetes-preserve-unknown-fields
doesn't apply to nested properties
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'll admit that I'm not entirely sure what it does. I thought it effected the whole tree based on
By default, all unspecified fields for a custom resource, across all versions, are pruned. It is possible though to opt-out of that for specifc sub-trees of fields by adding x-kubernetes-preserve-unknown-fields: 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 specifc sub-trees of fields
it seems like if you have a nested properties
attribute pruning is enabled again
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.
thus I wonder if we might need x-kubernetes-preserve-unknown-fields
in a few places if we aren't specifying the full schema
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 was wondering if we don't need it at all since I was trying to list out the full schema. Did I miss something?
I'm also fine with adding it multiple places.
WDTY?
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.
yeah if the full schema is present we shouldn't need it
weird my comment went missing - I did a quick pass some initial feedback |
45c6ae7
to
879d6db
Compare
Codecov Report
@@ Coverage Diff @@
## master #9436 +/- ##
=======================================
Coverage 87.81% 87.81%
=======================================
Files 183 183
Lines 8631 8631
=======================================
Hits 7579 7579
Misses 801 801
Partials 251 251
Continue to review full report at Codecov.
|
The following jobs failed:
Automatically retrying due to test flakiness... |
The following jobs failed:
Automatically retrying due to test flakiness... |
/retest |
@@ -662,7 +662,7 @@ spec: | |||
description: | | |||
As specified in Kubernetes core/v1.Probe. | |||
default: 300 | |||
minimum: 0 | |||
minimum: 1 |
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 think it's complaining about the default rather than the minimum. The default should be 0 for Knative too. We have some specialcased behavior for when periodSeconds is set to 0. The tests are failing in our webhook validation.
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.
thanks, I'll update that
yeah we deviate from some of k8s defaults you can see our validation code here: |
I wonder if we should work on this a bit more incrementally: We could add the top-level Service fields first and let the PodSpec be an object that allows arbitrary keys. We then work our way down step by step to avoid having to debug an enormous schema. WDYT @joshuawilson? |
I can try that. Thanks for the suggestion @markusthoemmes |
Any progress on this? I am waiting for this PR for some time 😩.. ( I am extracting the schema from thanks @joshuawilson and please pull harder to get this merged! |
75c6ed1
to
2e785c4
Compare
2e785c4
to
a4f758e
Compare
47b5e74
to
fac59c1
Compare
/retest |
1 similar comment
/retest |
fac59c1
to
76ec532
Compare
x-kubernetes-preserve-unknown-fields: true | ||
properties: | ||
template: | ||
x-kubernetes-preserve-unknown-fields: 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.
Does this (and traffic) lack type: object
maybe?
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.
According to the docs, you shouldn't need that if you have the flag I used. But I added it just to see if it would help.
For Traffic
it is an array of objects, so set it that way in the latest commit.
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, joshuawilson 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 |
/test pull-knative-serving-unit-tests flake. |
@joshuawilson: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/retest |
Releated to #912
Proposed Changes
This is the most basic level of the schema. The intention is create a foundation on which future updates to the schema will build.
This a bespoke schema. I used the docs and the API to make as complete a schema for only
v1
as I could. Please note this was manually written, I did not generate it.Currently the schema has nothing in it. Until the we can auto-generate it, this at least provides something.
Discussions on Incorporate schema into CRDs #912 suggest that we will soon drop support for alpha and beta so we would only need v1 anyway.
Release Note