diff --git a/kubernetes-model-generator/openapi/generator/go.mod b/kubernetes-model-generator/openapi/generator/go.mod index ad7dfcba1c7..34216d94249 100644 --- a/kubernetes-model-generator/openapi/generator/go.mod +++ b/kubernetes-model-generator/openapi/generator/go.mod @@ -8,6 +8,7 @@ require ( k8s.io/apiextensions-apiserver v0.30.2 k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.30.2 + k8s.io/metrics v0.30.2 sigs.k8s.io/gateway-api v1.1.0 sigs.k8s.io/kustomize/api v0.17.2 ) diff --git a/kubernetes-model-generator/openapi/generator/go.sum b/kubernetes-model-generator/openapi/generator/go.sum index 32710d81bf8..511c3d28ce4 100644 --- a/kubernetes-model-generator/openapi/generator/go.sum +++ b/kubernetes-model-generator/openapi/generator/go.sum @@ -128,6 +128,8 @@ k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 h1:Q8Z7VlGhcJgBHJHYugJ/K/7iB8a2eSxCyxdVjJp+lLY= k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/metrics v0.30.2 h1:zj4kIPTCfEbY0RHEogpA7QtlItU7xaO11+Gz1zVDxlc= +k8s.io/metrics v0.30.2/go.mod h1:GpoO5XTy/g8CclVLtgA5WTrr2Cy5vCsqr5Xa/0ETWIk= k8s.io/utils v0.0.0-20240423183400-0849a56e8f22 h1:ao5hUqGhsqdm+bYbjH/pRkCs0unBGe9UyDahzs9zQzQ= k8s.io/utils v0.0.0-20240423183400-0849a56e8f22/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= diff --git a/kubernetes-model-generator/openapi/generator/main.go b/kubernetes-model-generator/openapi/generator/main.go index 954f87c8d96..be1447024d1 100644 --- a/kubernetes-model-generator/openapi/generator/main.go +++ b/kubernetes-model-generator/openapi/generator/main.go @@ -25,6 +25,7 @@ import ( apiextensionsV1Beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" configapiV1 "k8s.io/client-go/tools/clientcmd/api/v1" + metricsV1Beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" "os" "path/filepath" "reflect" @@ -97,9 +98,6 @@ func main() { reflect.TypeOf(apiextensionsV1Beta1.SelectableField{}), reflect.TypeOf(apiextensionsV1Beta1.ValidationRule{}), }, "apiextensions"), - NewTypeSchema([]reflect.Type{ - reflect.TypeOf(kustomize.Kustomization{}), - }, "kustomize"), NewPathSchema(map[reflect.Type]string{ reflect.TypeOf(gatewayApiV1.GatewayList{}): "/apis/" + gatewayApiV1.GroupName + "/v1/namespaces/{namespace}/gateways", reflect.TypeOf(gatewayApiV1.Gateway{}): "/apis/" + gatewayApiV1.GroupName + "/v1/namespaces/{namespace}/gateways/{name}", @@ -116,6 +114,15 @@ func main() { reflect.TypeOf(gatewayApiV1Beta1.ReferenceGrantList{}): "/apis/" + gatewayApiV1.GroupName + "/v1beta1/namespaces/{namespace}/referencegrants", reflect.TypeOf(gatewayApiV1Beta1.ReferenceGrant{}): "/apis/" + gatewayApiV1.GroupName + "/v1beta1/namespaces/{namespace}/referencegrants/{name}", }, "gateway-api"), + NewTypeSchema([]reflect.Type{ + reflect.TypeOf(kustomize.Kustomization{}), + }, "kustomize"), + NewPathSchema(map[reflect.Type]string{ + reflect.TypeOf(metricsV1Beta1.NodeMetricsList{}): "/apis/" + metricsV1Beta1.SchemeGroupVersion.String() + "/nodes", + reflect.TypeOf(metricsV1Beta1.NodeMetrics{}): "/apis/" + metricsV1Beta1.SchemeGroupVersion.String() + "/nodes/{name}", + reflect.TypeOf(metricsV1Beta1.PodMetricsList{}): "/apis/" + metricsV1Beta1.SchemeGroupVersion.String() + "/namespaces/{namespace}/pods", + reflect.TypeOf(metricsV1Beta1.PodMetrics{}): "/apis/" + metricsV1Beta1.SchemeGroupVersion.String() + "/namespaces/{namespace}/pods/{name}", + }, "metrics"), } generate(schemas, targetDirectory) }