Skip to content

Add complete schemas to all CRDs#11244

Merged
knative-prow-robot merged 16 commits intoknative:mainfrom
markusthoemmes:add-schema-min
Apr 30, 2021
Merged

Add complete schemas to all CRDs#11244
knative-prow-robot merged 16 commits intoknative:mainfrom
markusthoemmes:add-schema-min

Conversation

@markusthoemmes
Copy link
Copy Markdown
Contributor

@markusthoemmes markusthoemmes commented Apr 21, 2021

Proposed Changes

Fixes #912

This is a stepping stone towards generating schemas for all of our CRDs. Generating the CRDs is not yet part of update-codegen.sh since we need to put the actual machinery in place through the hack repository, potentially forking the respective tooling to our repositories first.

I thought this might still be useful. Granted, this is not based on any accepted concept right now, so I'm happy to bin it all.

Release Note

Added schemas to all CRDs.

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 21, 2021
@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features labels Apr 21, 2021
@markusthoemmes
Copy link
Copy Markdown
Contributor Author

/hold

There's a vendor change in here that needs to be done in pkg first.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2021

Codecov Report

Merging #11244 (d5eb000) into main (28ba542) will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11244      +/-   ##
==========================================
+ Coverage   87.65%   87.72%   +0.06%     
==========================================
  Files         191      191              
  Lines        9187     9186       -1     
==========================================
+ Hits         8053     8058       +5     
+ Misses        880      875       -5     
+ Partials      254      253       -1     
Impacted Files Coverage Δ
pkg/apis/serving/v1/revision_types.go 100.00% <ø> (ø)
pkg/reconciler/revision/background.go 95.06% <0.00%> (-0.12%) ⬇️
pkg/reconciler/revision/controller.go 85.41% <0.00%> (+0.31%) ⬆️
pkg/reconciler/configuration/configuration.go 88.28% <0.00%> (+1.56%) ⬆️
pkg/activator/net/revision_backends.go 93.30% <0.00%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28ba542...d5eb000. Read the comment docs.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2021
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2021
@chaodaiG
Copy link
Copy Markdown
Contributor

/retest

@markusthoemmes
Copy link
Copy Markdown
Contributor Author

/hold

This got bigger now 😂

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

I'm assuming that the entirety of the CRD definition is being created by the controller-gen binary, and we're not needing to do part-and-part copying?

Comment thread config/core/300-resources/metric.yaml
Comment thread hack/update-codegen.sh Outdated
@julz
Copy link
Copy Markdown
Contributor

julz commented Apr 26, 2021

/lgtm

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Apr 26, 2021
@markusthoemmes markusthoemmes changed the title Setup CRD generation machinery and generate initial schemas Setup CRD generation machinery and generate schemas Apr 26, 2021
Comment thread config/core/300-resources/route.yaml
Comment thread hack/update-schemas.sh Outdated
Comment thread config/core/300-resources/revision.yaml Outdated
@markusthoemmes
Copy link
Copy Markdown
Contributor Author

This is ready from my perspective

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2021
@markusthoemmes
Copy link
Copy Markdown
Contributor Author

/assign @dprotaso @n3wscott

@markusthoemmes markusthoemmes changed the title Setup CRD generation machinery and generate schemas Add complete schemas to all CRDs Apr 27, 2021
@joshuawilson
Copy link
Copy Markdown
Contributor

Nice to see this @markusthoemmes, thanks for all the hard work.

Comment thread config/core/300-resources/configuration.yaml
Comment thread config/core/300-resources/configuration.yaml Outdated
// RevisionTemplateSpec describes the data a revision should have when created from a template.
// Based on: https://github.com/kubernetes/api/blob/e771f807/core/v1/types.go#L3179-L3190
type RevisionTemplateSpec struct {
// +kubebuilder:pruning:PreserveUnknownFields
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To clarify this notation applies to the fields in metav1.ObjectMeta ? Is there a reason why we're allowing unknown fields here?

Does your patch mean this annotation is no longer necessary kubernetes-sigs/controller-tools#563 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tbh, this was kind of a stopgap solution because stuff has been failing without it. We currently print out deletionTimestamp: null to every nested ObjectMeta and just the schema would cause this to drop, so I thought the problem might be around that. Hence I added this for compatiblity.

Comment thread hack/update-schemas.sh
# 2. There's a missing feature to properly generate nested ObjectMeta
# see https://github.com/kubernetes-sigs/controller-tools/pull/563
# 3. We need specialized logic to filter down the surface of PodSpec we allow in Knative.
controller-gen schemapatch:manifests=config/core/300-resources \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you do the wrangling of cloning/installing your repo in a tmp-dir and updating the path so folks can update the schema without going through those manual hoops

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can take a whack at that, though I'd like to priotize the schema itself for now so we can get that baking. There'll be incremental improvements to the devx anyway as the goal ultimately is to have it run via update-codegen.sh.

@dprotaso
Copy link
Copy Markdown
Member

note to other reviewers: x-kubernetes-preserve-unknown-fields: true only applies to sibling properties of a node and not the entire subtree

https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#controlling-pruning

@dprotaso
Copy link
Copy Markdown
Member

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 30, 2021
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 30, 2021
@knative-prow-robot knative-prow-robot merged commit 101c6f1 into knative:main Apr 30, 2021
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. area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. 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.

Incorporate schema into CRDs

8 participants