Skip to content

Conversation

@damemi
Copy link
Contributor

@damemi damemi commented Jan 22, 2020

Adds information, links, and steps to set up and use the crd schema generator

Fixes #572
/cc @dhellmann

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 22, 2020
Copy link

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

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

This seems very clear. Thank you!

@damemi
Copy link
Contributor Author

damemi commented Jan 22, 2020

cc @smarterclayton @sttts could you please review?

README.md Outdated
## generating CRD schemas
Since Kubernetes 1.16, every CRD created in `apiextensions.k8s.io/v1` is required to have a [structural OpenAPIV3 schema](https://kubernetes.io/blog/2019/06/20/crd-structural-schema/). The schemas provide server-side validation for fields, as well as providing the descriptions for `oc explain`. Structural requirements build on that to provide enhanced security in objects' persistence in etcd. As we host many of our CRDs in this repo along with their corresponding Go types we also require them to have schemas. However, the following instructions apply for CRDs that are not hosted here as well.
Copy link
Contributor

Choose a reason for hiding this comment

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

Structural requirements build on that to provide enhanced security in objects' persistence in etcd

Not sure I can follow. You mean: "Moreover, schemas ensure structural consistency of data in etcd. Without anything can be stored in a resource which can have security implications."

README.md Outdated
These schemas are often very long and complex, and should not be written by hand. For OpenShift, we provide Makefile targets in [library-go's alpha-build-machinery](https://github.com/openshift/library-go/tree/master/alpha-build-machinery) which generate the schema.
If you make a change to a CRD type in this repo, simply calling `make update-codegen-crds` should regenerate all CRDs. If yours is not updated, ensure that the path to its API is included in our [calls to the Makefile targets](https://github.com/openshift/api/blob/release-4.5/Makefile#L17-L29).
Copy link
Contributor

Choose a reason for hiding this comment

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

regenerate all CRD schemas and update the manifests.

README.md Outdated
Since Kubernetes 1.16, every CRD created in `apiextensions.k8s.io/v1` is required to have a [structural OpenAPIV3 schema](https://kubernetes.io/blog/2019/06/20/crd-structural-schema/). The schemas provide server-side validation for fields, as well as providing the descriptions for `oc explain`. Structural requirements build on that to provide enhanced security in objects' persistence in etcd. As we host many of our CRDs in this repo along with their corresponding Go types we also require them to have schemas. However, the following instructions apply for CRDs that are not hosted here as well.
These schemas are often very long and complex, and should not be written by hand. For OpenShift, we provide Makefile targets in [library-go's alpha-build-machinery](https://github.com/openshift/library-go/tree/master/alpha-build-machinery) which generate the schema.
Copy link
Contributor

Choose a reason for hiding this comment

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

would reference controller-tools as well as the tool behind all of this.

@damemi
Copy link
Contributor Author

damemi commented Jan 29, 2020

@sttts thanks for your review, I've added the changes you suggested

@sttts
Copy link
Contributor

sttts commented Jan 30, 2020

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damemi, sttts

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2020
@damemi damemi changed the title Add CRD generator documentation to Readme Bug 1798482: Add CRD generator documentation to Readme Feb 5, 2020
@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Feb 5, 2020
@openshift-ci-robot
Copy link

@damemi: This pull request references Bugzilla bug 1798482, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Bug 1798482: Add CRD generator documentation to Readme

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.

@openshift-merge-robot openshift-merge-robot merged commit 34f0ec8 into openshift:master Feb 5, 2020
@openshift-ci-robot
Copy link

@damemi: All pull requests linked via external trackers have merged. Bugzilla bug 1798482 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1798482: Add CRD generator documentation to Readme

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.

danwinship added a commit to danwinship/cluster-kube-controller-manager-operator that referenced this pull request Mar 2, 2020
In particular, to get

openshift/api#585: config: disable IPv6DualStack feature flag

so we don't launch kube-controller-manager with that (still-broken) feature

Also includes:

openshift/api#557: create the IBMCLoudPlatform type for the ingress operator try2
openshift/api#570: Clarify image config doc
openshift/api#569: Enable overriding service account issuer for bound tokens
openshift/api#527: Add kubebuilder annotations to the network types
openshift/api#574: add deprecaction notice for build pipeline strategy
openshift/api#582: config/v1/types_proxy: Clarify trustedCA semantics
openshift/api#583: Clarify FROM behavior in builds
openshift/api#573: Add CRD generator documentation to Readme
openshift/api#576: Remove Description from CLI output to improve its display
openshift/api#589: Add missing enum validations
openshift/api#583: operator/ingress: add dnsrecord type
soltysh added a commit to soltysh/cluster-kube-controller-manager-operator that referenced this pull request Mar 4, 2020
In particular, to get

openshift/api#585: config: disable IPv6DualStack feature flag

so we don't launch kube-controller-manager with that (still-broken) feature

Also includes:

openshift/api#557: create the IBMCLoudPlatform type for the ingress operator try2
openshift/api#570: Clarify image config doc
openshift/api#569: Enable overriding service account issuer for bound tokens
openshift/api#527: Add kubebuilder annotations to the network types
openshift/api#574: add deprecaction notice for build pipeline strategy
openshift/api#582: config/v1/types_proxy: Clarify trustedCA semantics
openshift/api#583: Clarify FROM behavior in builds
openshift/api#573: Add CRD generator documentation to Readme
openshift/api#576: Remove Description from CLI output to improve its display
openshift/api#589: Add missing enum validations
openshift/api#583: operator/ingress: add dnsrecord type
soltysh added a commit to soltysh/cluster-kube-controller-manager-operator that referenced this pull request Mar 6, 2020
In particular, to get

openshift/api#585: config: disable IPv6DualStack feature flag

so we don't launch kube-controller-manager with that (still-broken) feature

Also includes:

openshift/api#557: create the IBMCLoudPlatform type for the ingress operator try2
openshift/api#570: Clarify image config doc
openshift/api#569: Enable overriding service account issuer for bound tokens
openshift/api#527: Add kubebuilder annotations to the network types
openshift/api#574: add deprecaction notice for build pipeline strategy
openshift/api#582: config/v1/types_proxy: Clarify trustedCA semantics
openshift/api#583: Clarify FROM behavior in builds
openshift/api#573: Add CRD generator documentation to Readme
openshift/api#576: Remove Description from CLI output to improve its display
openshift/api#589: Add missing enum validations
openshift/api#583: operator/ingress: add dnsrecord type
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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing documentation for API schema policy

5 participants