Skip to content

Conversation

@JoelSpeed
Copy link
Contributor

While setting up the API in #1112 I had been testing using kubectl to make sure the API behaved as expected. When then trying to use it from a go client, omitting the subnet from the struct (an optional field with required fields within it), and then using client-go to create the object results in the following error:

ControlPlaneMachineSet.machine.openshift.io \"cluster\" is invalid: spec.template.machines_v1beta1_machine_openshift_io.failureDomains.aws.subnet.type: Unsupported value: \"\": supported values: \"id\", \"arn\", \"filters\"

The go client is marshalling the empty struct which then causes the validation to fail as the required fields within it are not being set.

To avoid this, we need to make this field a pointer so that the struct is omitted when marshalled into json. I have tested this with the test cases I was writing in Go and it resolves the error being returned from the OpenAPI validation.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 7, 2022

@JoelSpeed: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

makes sense to me, thanks for the detailed commit message
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 7, 2022
@deads2k
Copy link
Contributor

deads2k commented Mar 7, 2022

oh the mysteries of openapi

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, elmiko, JoelSpeed

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 7, 2022
@JoelSpeed
Copy link
Contributor Author

This project is not part of the no-FF process, will manually apply the labels

/label px-approved
/label docs-approved
/label qe-approved

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR qe-approved Signifies that QE has signed off on this PR labels Mar 8, 2022
@openshift-merge-robot openshift-merge-robot merged commit c21df43 into openshift:master Mar 8, 2022
@JoelSpeed JoelSpeed deleted the fix-optional-subnet branch March 8, 2022 09:32
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. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants