Kubebuilder: Kubebuilder is not generating openapi files

Created on 25 Oct 2019  路  8Comments  路  Source: kubernetes-sigs/kubebuilder

Following the steps

  • Following the quickstart
  • Add // +k8s:openapi-gen=true for Guestbook as follows
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=guestbooks,scope=Guestbook
type Guestbook struct {
    metav1.TypeMeta   `json:",inline"`
    metav1.ObjectMeta `json:"metadata,omitempty"`

    Spec   GuestbookSpec   `json:"spec,omitempty"`
    Status GuestbookStatus `json:"status,omitempty"`
}
  • Run make

What I expected?
See api/v1/zz_generated.openapi.go file.

  • go version 1.13
  • kubebuilder version (kubebuilder version) : version: "2"
  • controller-runtime version (check your go.mod file) sigs.k8s.io/controller-runtime v0.3.0

/kind bug

kinbug

All 8 comments

right. That's not a bug. KubeBuilder is not intended to generate go openapi files, since they're not useful for CRDs (they're basically only useful for aggregated API servers, and even then you can just bundle in the JSON/YAML form and parse on init).

Thank you for the answers

Is there a way to generate openapi specs for kubebuilder CRDs? They are useful for generating client libraries in other languages (python, go, java, etc).

Hi @gclawes,

Could you please raise a new issue to request this support with a summary and clear description of the uses cases which justify the kubebuilder support to generate openapi specs?

Sure!

HI @gclawes could you raise the issue? If yes, could you please add the link here?

Yes, I'll raise an issue. Haven't had time to do a write-up yet.

@camilamacedo86 opened #1231

Was this page helpful?
0 / 5 - 0 ratings