Skip to content
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

Generate CRD schema #955

Closed
wants to merge 4 commits into from
Closed

Conversation

damemi
Copy link

@damemi damemi commented Jul 11, 2019

This adds the markers to the machineconfiguration.openshift.io doc.go to label the group appropriately eg, for use with CRD generators

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 11, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: damemi
To complete the pull request process, please assign ashcrow
You can assign the PR to them by writing /assign @ashcrow in a comment when ready.

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

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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 11, 2019
@damemi
Copy link
Author

damemi commented Jul 11, 2019

/cc @vrutkovs

@damemi damemi changed the title Add necessary kubebuilder markers Generate CRD schema Jul 11, 2019
@damemi
Copy link
Author

damemi commented Jul 11, 2019

In 6591658, these vendored types were causing failures in the generator due to lack of JSON tags. I don't know what they are, but adding these tags in allowed the generator to run.

Copy link
Member

@vrutkovs vrutkovs left a comment

Choose a reason for hiding this comment

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

bindata need to be updated, please run hack/update-generated-bindata.sh

@openshift-ci-robot
Copy link
Contributor

@damemi: PR needs rebase.

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-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2019
Node
DirectoryEmbedded1
Node `json:"node,omitempty"`
DirectoryEmbedded1 `json:"directoryEmbedded1,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

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

we might want to add these json tags to the upstream types as well.
/cc @runcom @ajeddeloh

Choose a reason for hiding this comment

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

No, this should be dropped here. It's using struct embedding, the Node/DirectoryEmbedded1 should be invisible to anyone looking at the serialized json.

Copy link
Member

Choose a reason for hiding this comment

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

@damemi @vrutkovs this concerns the machinconfig crd, why was this not necessary for the precursory PR? (#928)

Copy link
Member

@LorbusChris LorbusChris Jul 12, 2019

Choose a reason for hiding this comment

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

Note: if we're going to expose ign.Config as RawExtension externally, we won't need this. Will be discussed in Tuesday's RHCOS cabal.

Copy link
Author

Choose a reason for hiding this comment

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

@LorbusChris that PR had the CRD validation manually written because the CRD generator was not working against this repo. This PR is just showing the steps to get that generator working. One of the errors was due to these types, which I'm assuming are some kind of dependency, not having JSON tags.

The fact that I've added these tags here is really more of a proof of concept (showing the CRD generator properly running). Due to my lack of knowledge on these or the upstream types I was hoping people more familiar with them could give more review, and determine if it's a change worth having.

Choose a reason for hiding this comment

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

The Igntition types vendored here are generated from a json schema. We use struct embedding (which is what our json schema->go types generator outputs) to cut down a bit on code duplication.

It's also worth noting that Ignition types have their own validation code which can be used.

@openshift-ci-robot
Copy link
Contributor

@damemi: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/unit 57362ee link /test unit
ci/prow/verify 57362ee link /test verify
ci/prow/e2e-aws-op 57362ee link /test e2e-aws-op
ci/prow/e2e-aws 57362ee link /test e2e-aws
ci/prow/e2e-aws-disruptive 57362ee link /test e2e-aws-disruptive
ci/prow/e2e-gcp-op 57362ee link /test e2e-gcp-op
ci/prow/e2e-aws-upgrade 57362ee link /test e2e-aws-upgrade
ci/prow/e2e-gcp-upgrade 57362ee link /test e2e-gcp-upgrade

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@damemi damemi closed this Nov 25, 2019
yuqi-zhang added a commit to yuqi-zhang/machine-config-operator that referenced this pull request Feb 18, 2020
Generate validation for:

containerruntimeconfig
controllerconfig
kubeletconfig
machineconfig
machineconfigpool

Using update-codegen-crds target from
https://github.com/openshift/build-machinery-go, which will be
included in a separate commit as it is not directly usable with the
MCO repo until coreos/ignition#917 is
resolved. The current generation is done via hacking ignition's
config/v2_2/types/schema.go to have dummy `json:",inline"` for fields
that are causing errors.

Some background on this, there were 2 attempts to add generated
schemas in: openshift#1403
and openshift#955.
This supercedes those with updated generation methods.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/machine-config-operator that referenced this pull request Feb 27, 2020
Generate validation for:

containerruntimeconfig
controllerconfig
kubeletconfig
machineconfig
machineconfigpool

Using update-codegen-crds target from
https://github.com/openshift/build-machinery-go, which will be
included in a separate commit as it is not directly usable with the
MCO repo until coreos/ignition#917 is
resolved. The current generation is done via hacking ignition's
config/v2_2/types/schema.go to have dummy `json:",inline"` for fields
that are causing errors.

Some background on this, there were 2 attempts to add generated
schemas in: openshift#1403
and openshift#955.
This supercedes those with updated generation methods.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
vrutkovs pushed a commit to vrutkovs/machine-config-operator that referenced this pull request Mar 1, 2020
Generate validation for:

containerruntimeconfig
controllerconfig
kubeletconfig
machineconfig
machineconfigpool

Using update-codegen-crds target from
https://github.com/openshift/build-machinery-go, which will be
included in a separate commit as it is not directly usable with the
MCO repo until coreos/ignition#917 is
resolved. The current generation is done via hacking ignition's
config/v2_2/types/schema.go to have dummy `json:",inline"` for fields
that are causing errors.

Some background on this, there were 2 attempts to add generated
schemas in: openshift#1403
and openshift#955.
This supercedes those with updated generation methods.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

5 participants