Skip to content

Commit

Permalink
refactor: openshift-model-installer generated from OpenAPI schemas
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Oct 3, 2024
1 parent 795fffb commit c6f4cf2
Show file tree
Hide file tree
Showing 87 changed files with 10,732 additions and 1,270 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ openapi-generate-java-classes:
cd kubernetes-model-generator/openshift-model-whereabouts && mvn -Pgenerate clean install
cd kubernetes-model-generator/openshift-model-storageversionmigrator && mvn -Pgenerate clean install
cd kubernetes-model-generator/openshift-model-hive && mvn -Pgenerate clean install
cd kubernetes-model-generator/openshift-model-installer && mvn -Pgenerate clean install

# Legacy generation of the model: TODO: remove
.PHONY: generate-model-legacy
Expand Down
1 change: 0 additions & 1 deletion kubernetes-model-generator/generateModel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ ABSOLUTE_BASEDIR=$(realpath "$BASEDIR")

# Array for all existing modules
declare -a modules=(
"openshift-model-installer"
"../extensions/knative/generator"
"../extensions/certmanager/generator-v1"
"../extensions/certmanager/generator-v1alpha2"
Expand Down
14 changes: 9 additions & 5 deletions kubernetes-model-generator/openapi/generator/cmd/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +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"
"strings"

//openshiftbaremetaloperatorv1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
openshiftconfigv1 "github.com/openshift/api/config/v1"
openshiftcloudcredentialoperatorv1 "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1"
openshiftclusternetworkoperatorv1 "github.com/openshift/cluster-network-operator/pkg/apis/network/v1"
openshiftclusternodetuningoperatorv1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1"
openshifthivev1 "github.com/openshift/hive/apis/hive/v1"
openshiftinstallerv1 "github.com/openshift/installer/pkg/types"
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"
Expand All @@ -50,19 +53,20 @@ func init() {

var openApiRun = func(cobraCmd *cobra.Command, args []string) {
startTime := time.Now()
fmt.Printf("OpenAPI JSON schema generation started...\n%s\n", []string{
fmt.Printf("OpenAPI JSON schema generation started...\n%s\n", strings.Join([]string{
// Force imports so that modules are present in go.mod
openshiftconfigv1.SchemeGroupVersion.String(),
//openshiftbaremetaloperatorv1alpha1.GroupVersion.String(),
operatorframeworkv1alpha1.SchemeGroupVersion.String(),
operatorframeworkv1.GroupVersion.String(),
olm.SchemeGroupVersion.String(),
openshiftcloudcredentialoperatorv1.GroupVersion.String(),
openshiftclusternetworkoperatorv1.GroupVersion.String(),
openshiftclusternodetuningoperatorv1.SchemeGroupVersion.String(),
openshifthivev1.SchemeGroupVersion.String(),
olm.SchemeGroupVersion.String(),
"install.openshift.io/" + openshiftinstallerv1.InstallConfigVersion + "(" + strings.Join(openshiftinstallerv1.PlatformNames, ",") + ")",
operatorframeworkv1alpha1.SchemeGroupVersion.String(),
operatorframeworkv1.GroupVersion.String(),
prometheusoperatorv1.SchemeGroupVersion.String(),
})
}, "\n"))
var targetDirectory string
if len(args) > 0 {
targetDirectory = args[0]
Expand Down
41 changes: 38 additions & 3 deletions kubernetes-model-generator/openapi/generator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ require (
github.com/openshift/cloud-credential-operator v0.0.0-20240910052617-d668c182b0e3
github.com/openshift/cluster-network-operator v0.0.0-20240912134426-a3188633549d
github.com/openshift/cluster-node-tuning-operator v0.0.0-20241001165112-1685a8fc1376
github.com/openshift/hive/apis v0.0.0-20240930213556-2d25383963db
github.com/openshift/installer v0.0.0-00010101000000-000000000000
github.com/operator-framework/api v0.27.0
github.com/operator-framework/operator-lifecycle-manager v0.0.0-00010101000000-000000000000
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.77.1
Expand All @@ -21,15 +23,19 @@ require (
k8s.io/client-go v12.0.0+incompatible
k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38
k8s.io/metrics v0.30.2
k8s.io/metrics v0.30.3
sigs.k8s.io/gateway-api v1.1.0
sigs.k8s.io/kustomize/api v0.17.2
)

// Required by some openshift operator dependencies
// Force usage of latest Kuberentes Version
replace (
github.com/openshift/assisted-service/api => github.com/openshift/assisted-service/api v0.0.0-20241003070528-341f9860c455
github.com/openshift/assisted-service/client => github.com/openshift/assisted-service/client v0.0.0-20241003070528-341f9860c455
github.com/openshift/assisted-service/models => github.com/openshift/assisted-service/models v0.0.0-20241003070528-341f9860c455
github.com/openshift/hive => github.com/openshift/hive v1.1.17-0.20240930213556-2d25383963db // Latest Master
github.com/openshift/installer => github.com/openshift/installer v0.91.0 // Most up-to-date tag https://issues.redhat.com/browse/OCPBUGS-42448
k8s.io/client-go => k8s.io/client-go v0.31.1
k8s.io/cloud-provider => k8s.io/cloud-provider v0.31.1
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.31.1
Expand All @@ -47,43 +53,71 @@ replace (
github.com/operator-framework/operator-lifecycle-manager => github.com/marcnuri-forks/operator-lifecycle-manager v0.0.0-20241002090802-7539192fbf96
)

require github.com/openshift/hive/apis v0.0.0-20240930213556-2d25383963db

require (
github.com/PaesslerAG/gval v1.0.0 // indirect
github.com/PaesslerAG/jsonpath v0.1.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/aws/aws-sdk-go v1.53.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/coreos/ignition/v2 v2.19.0 // indirect
github.com/coreos/vcontext v0.0.0-20231102161604-685dc7299dc5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-test/deep v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.20.1 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/h2non/filetype v1.1.3 // indirect
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kdomanski/iso9660 v0.2.1 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/metal3-io/baremetal-operator/apis v0.4.0 // indirect
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nutanix-cloud-native/prism-go-client v0.3.4 // indirect
github.com/onsi/gomega v1.34.2 // indirect
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect
github.com/operator-framework/operator-registry v1.47.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.20.4 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/vincent-petithory/dataurl v1.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
Expand All @@ -94,6 +128,7 @@ require (
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.25.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade // indirect
google.golang.org/grpc v1.66.0 // indirect
Expand Down
Loading

0 comments on commit c6f4cf2

Please sign in to comment.