kubernetes-sigs / controller-tools

Tools to use with the controller-runtime libraries
Apache License 2.0
736 stars 420 forks source link

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

Closed sbueringer closed 3 months ago

sbueringer commented 3 months ago

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:

Fixes #1027

sbueringer commented 3 months ago

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

sbueringer commented 3 months ago

/assign @chrischdi @alvaroaleman @vincepri

k8s-ci-robot commented 3 months ago

LGTM label has been added.

Git tree hash: 856212f4c4f196f5b341757498aa5e8b463153ce

k8s-ci-robot commented 3 months ago

[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](https://github.com/kubernetes-sigs/controller-tools/blob/master/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 commented 3 months ago

/hold cancel

Thx for the quick review!