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

🐛 Fix duplicate default value when generating CRDs with corev1.Protocol #1035

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

sbueringer
Copy link
Member

The protocol schema was hard-coded, because of that now that the "default" marker works we are ending up with all of.

Simple example:

	// Protocol for port. Must be UDP, TCP, or SCTP.
	// Defaults to "TCP".
	// +optional
	// +default="TCP"
	Protocol corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"`

leads to

              protocol:
                allOf:
                - default: TCP
                - default: TCP
                description: |-
                  Protocol for port. Must be UDP, TCP, or SCTP.
                  Defaults to "TCP".
                type: string

This PR contains 3 commits:

  • bump testdata to 1.31.0 (necessary to have the current Protocol type)
    • this one is relatively hard to review. It's easier after dropping jobTemplate (which is just an embedded type) + a bit of re-ordering
  • add test coverage for protocol
  • drop the embeded schema for protocol

Fixes #1027

Signed-off-by: Stefan Büringer [email protected]
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 14, 2024
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 14, 2024
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 14, 2024
@sbueringer sbueringer changed the title Pr fix default issue Fix duplicate default value when generating CRDs with corev1.Protocol Aug 14, 2024
@sbueringer sbueringer changed the title Fix duplicate default value when generating CRDs with corev1.Protocol 🐛 Fix duplicate default value when generating CRDs with corev1.Protocol Aug 14, 2024
@sbueringer
Copy link
Member Author

/hold
(just want to make sure there are enough reviews)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 14, 2024
@sbueringer
Copy link
Member Author

/assign @chrischdi @alvaroaleman @vincepri

Signed-off-by: Stefan Büringer [email protected]
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 856212f4c4f196f5b341757498aa5e8b463153ce

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, sbueringer

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:
  • OWNERS [alvaroaleman,sbueringer]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sbueringer
Copy link
Member Author

/hold cancel

Thx for the quick review!

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 14, 2024
@k8s-ci-robot k8s-ci-robot merged commit 897f14b into kubernetes-sigs:master Aug 14, 2024
9 checks passed
@sbueringer sbueringer deleted the pr-fix-default-issue branch August 14, 2024 17:38
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

Error applying a CRD generated by controller-tools that contains the ContainerPort struct
5 participants