Skip to content

Commit

Permalink
feat(openapi): add schemas for misc types
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Oct 2, 2024
1 parent badf257 commit 6452f8c
Show file tree
Hide file tree
Showing 6 changed files with 1,002 additions and 5 deletions.
19 changes: 17 additions & 2 deletions kubernetes-model-generator/openapi/generator/cmd/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ import (
"github.com/fabric8io/kubernetes-client/kubernetes-model-generator/openapi/generator/pkg/openapi"
"github.com/fabric8io/kubernetes-client/kubernetes-model-generator/openapi/generator/pkg/openshift"
"github.com/fabric8io/kubernetes-client/kubernetes-model-generator/openapi/generator/pkg/parser"
//openshiftbaremetaloperatorv1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
openshiftcloudcredentialoperatorv1 "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1"
openshiftclusternetworkoperatorv1 "github.com/openshift/cluster-network-operator/pkg/apis/network/v1"
operatorframeworkv1 "github.com/operator-framework/api/pkg/operators/v1"
operatorframeworkv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
olm "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators/v1"
"time"

//"github.com/openshift/api/openapi/generated_openapi"
openshiftconfigv1 "github.com/openshift/api/config/v1"
"github.com/spf13/cobra"
"k8s.io/kube-openapi/pkg/common"
"k8s.io/kube-openapi/pkg/validation/spec"
Expand All @@ -42,7 +48,16 @@ func init() {

var openApiRun = func(cobraCmd *cobra.Command, args []string) {
startTime := time.Now()
fmt.Printf("OpenAPI JSON schema generation started...\n")
fmt.Printf("OpenAPI JSON schema generation started...\n%s\n", []string{
// Force imports so that modules are present in go.mod
openshiftconfigv1.SchemeGroupVersion.String(),
//openshiftbaremetaloperatorv1alpha1.GroupVersion.String(),
operatorframeworkv1alpha1.SchemeGroupVersion.String(),
operatorframeworkv1.GroupVersion.String(),
openshiftclusternetworkoperatorv1.GroupVersion.String(),
openshiftcloudcredentialoperatorv1.GroupVersion.String(),
olm.SchemeGroupVersion.String(),
})
var targetDirectory string
if len(args) > 0 {
targetDirectory = args[0]
Expand Down
3 changes: 2 additions & 1 deletion kubernetes-model-generator/openapi/generator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ require (
github.com/getkin/kin-openapi v0.125.0
// Match latest commit in the version branch (e.g. release-4.17)
github.com/openshift/api v3.9.0+incompatible
github.com/openshift/cloud-credential-operator v0.0.0-20240910052617-d668c182b0e3
github.com/openshift/cluster-network-operator v0.0.0-20240912134426-a3188633549d
github.com/operator-framework/api v0.27.0
github.com/operator-framework/operator-lifecycle-manager v0.22.0
github.com/operator-framework/operator-lifecycle-manager v0.0.0-00010101000000-000000000000
github.com/spf13/cobra v1.8.1
k8s.io/api v0.31.1
k8s.io/apiextensions-apiserver v0.31.1
Expand Down
6 changes: 4 additions & 2 deletions kubernetes-model-generator/openapi/generator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/openshift/cloud-credential-operator v0.0.0-20240910052617-d668c182b0e3 h1:WQH/wm0E1I3zrmCnHtpaeaYduJalzL9qpDwAFLLVTNk=
github.com/openshift/cloud-credential-operator v0.0.0-20240910052617-d668c182b0e3/go.mod h1:4AWWBNPuWzPtT77xDONlObrazPlBCKXd+16lupnIrQc=
github.com/openshift/cluster-network-operator v0.0.0-20240912134426-a3188633549d h1:9Xf/80gDpRc33FwCEJ6L2/DF1yU/4L6QjoYxKexDzvo=
github.com/openshift/cluster-network-operator v0.0.0-20240912134426-a3188633549d/go.mod h1:qeN8u3CfzClFoykTdlvn0kKngBuVmb3VvWHA51UxiOI=
github.com/operator-framework/operator-registry v1.47.0 h1:Imr7X/W6FmXczwpIOXfnX8d6Snr1dzwWxkMG+lLAfhg=
Expand Down Expand Up @@ -341,8 +343,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY=
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 h1:ImUcDPHjTrAqNhlOkSocDLfG9rrNHH7w7uoKWPaWZ8s=
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7/go.mod h1:/3XmxOjePkvmKrHuBy4zNFw7IzxJXtAgdpXi8Ll990U=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ var PackagePatterns = []string{
// OpenShift APIs
"github.com/openshift/api/.../v...",
// CRDs don't provide info for reused types
//"github.com/metal3-io/baremetal-operator/apis/metal3.io/v...",
"github.com/operator-framework/api/pkg/operators/v...",
"github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators/v...",
"github.com/openshift/cluster-network-operator/pkg/apis/.../v...",
"github.com/openshift/cloud-credential-operator/pkg/apis/.../v...",
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"fmt"
"github.com/fabric8io/kubernetes-client/kubernetes-model-generator/openapi/generator/pkg/openapi"
"github.com/fabric8io/kubernetes-client/kubernetes-model-generator/openapi/generator/pkg/openshift"
//openshiftbaremetaloperatorv1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
openshiftcloudcredentialoperatorv1 "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1"
openshiftclusternetworkoperatorv1 "github.com/openshift/cluster-network-operator/pkg/apis/network/v1"
operatorframeworkv1 "github.com/operator-framework/api/pkg/operators/v1"
operatorframeworkv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
Expand All @@ -36,7 +38,9 @@ func main() {
// Force imports so that modules are present in go.mod
operatorframeworkv1alpha1.SchemeGroupVersion.String(),
operatorframeworkv1.GroupVersion.String(),
//openshiftbaremetaloperatorv1alpha1.GroupVersion.String(),
openshiftclusternetworkoperatorv1.GroupVersion.String(),
openshiftcloudcredentialoperatorv1.GroupVersion.String(),
olm.SchemeGroupVersion.String(),
})
err := (&openapi.GoGenerator{
Expand Down
Loading

0 comments on commit 6452f8c

Please sign in to comment.