From 6104e15fa96eee58511d63996e89e410fb0b3e1b Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Thu, 8 Aug 2024 16:00:57 +0200 Subject: [PATCH] refactor: kubernetes-model-node generated from OpenAPI schemas Signed-off-by: Marc Nuri --- Makefile | 1 + kubernetes-model-generator/generateModel.sh | 1 - .../kubernetes-model-node/Makefile | 27 --- .../cmd/generate/generate.go | 98 --------- .../kubernetes-model-node/pom.xml | 39 ++-- .../kubernetes/api/model/KubeSchema.java | 200 ------------------ .../api/model/ValidationSchema.java | 200 ------------------ .../api/model/node/v1/RuntimeClass.java | 11 +- .../api/model/node/v1alpha1/RuntimeClass.java | 11 +- .../api/model/node/v1beta1/RuntimeClass.java | 11 +- .../generator/model/KubernetesTest.java | 12 -- 11 files changed, 35 insertions(+), 576 deletions(-) delete mode 100644 kubernetes-model-generator/kubernetes-model-node/Makefile delete mode 100644 kubernetes-model-generator/kubernetes-model-node/cmd/generate/generate.go delete mode 100644 kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java delete mode 100644 kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java diff --git a/Makefile b/Makefile index 213570ef07e..4001f48a620 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,7 @@ generate-openapi-classes: cd kubernetes-model-generator/kubernetes-model-gatewayapi && mvn -Pgenerate clean install cd kubernetes-model-generator/kubernetes-model-networking && mvn -Pgenerate clean install cd kubernetes-model-generator/kubernetes-model-metrics && mvn -Pgenerate clean install + cd kubernetes-model-generator/kubernetes-model-node && mvn -Pgenerate clean install # Legacy generation of the model: TODO: remove .PHONY: generate-model-legacy diff --git a/kubernetes-model-generator/generateModel.sh b/kubernetes-model-generator/generateModel.sh index af3a9b382e6..a5803320a9b 100755 --- a/kubernetes-model-generator/generateModel.sh +++ b/kubernetes-model-generator/generateModel.sh @@ -22,7 +22,6 @@ ABSOLUTE_BASEDIR=$(realpath "$BASEDIR") # Array for all existing modules declare -a modules=( - "kubernetes-model-node" "kubernetes-model-policy" "kubernetes-model-scheduling" "kubernetes-model-storageclass" diff --git a/kubernetes-model-generator/kubernetes-model-node/Makefile b/kubernetes-model-generator/kubernetes-model-node/Makefile deleted file mode 100644 index c09a7003874..00000000000 --- a/kubernetes-model-generator/kubernetes-model-node/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (C) 2015 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -SHELL := /bin/bash - -all: build - -build: gobuild - mvn -Pgenerate clean install -DskipTests - -gobuild: - CGO_ENABLED=0 GO15VENDOREXPERIMENT=1 go build -a ./cmd/generate/generate.go - ./generate > src/main/resources/schema/kube-schema.json - ./generate validation > src/main/resources/schema/validation-schema.json diff --git a/kubernetes-model-generator/kubernetes-model-node/cmd/generate/generate.go b/kubernetes-model-generator/kubernetes-model-node/cmd/generate/generate.go deleted file mode 100644 index b2f56ed800a..00000000000 --- a/kubernetes-model-generator/kubernetes-model-node/cmd/generate/generate.go +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package main - -import ( - "bytes" - "encoding/json" - "fmt" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/api/resource" - apimachineryversion "k8s.io/apimachinery/pkg/version" - kapi "k8s.io/api/core/v1" - - v1node "k8s.io/api/node/v1" - v1beta1node "k8s.io/api/node/v1beta1" - v1alpha1node "k8s.io/api/node/v1alpha1" - - "log" - "reflect" - "strings" - "time" - - "os" - - "github.com/fabric8io/kubernetes-client/kubernetes-model-generator/pkg/schemagen" -) - -type Schema struct { - Info apimachineryversion.Info - BaseKubernetesList metav1.List - ObjectMeta metav1.ObjectMeta - TypeMeta metav1.TypeMeta - Status metav1.Status - Quantity resource.Quantity - ObjectReference kapi.ObjectReference - - V1RuntimeClass v1node.RuntimeClass - V1RuntimeClassList v1node.RuntimeClassList - V1beta1RuntimeClass v1beta1node.RuntimeClass - V1beta1RuntimeClassList v1beta1node.RuntimeClassList - V1alpha1RuntimeClass v1alpha1node.RuntimeClass - V1alpha1RuntimeClassList v1alpha1node.RuntimeClassList -} - -func main() { - packages := []schemagen.PackageDescriptor{ - {"k8s.io/apimachinery/pkg/api/resource", "", "io.fabric8.kubernetes.api.model", "kubernetes_resource_", false}, - {"k8s.io/apimachinery/pkg/version", "", "io.fabric8.kubernetes.api.model.version", "kubernetes_apimachinery_pkg_version_", false}, - {"k8s.io/apimachinery/pkg/apis/meta/v1", "", "io.fabric8.kubernetes.api.model", "kubernetes_apimachinery_", false}, - {"k8s.io/api/core/v1", "", "io.fabric8.kubernetes.api.model", "kubernetes_core_", false}, - {"k8s.io/api/node/v1", "node.k8s.io", "io.fabric8.kubernetes.api.model.node.v1", "kubernetes_node_v1_", true}, - {"k8s.io/api/node/v1beta1", "node.k8s.io", "io.fabric8.kubernetes.api.model.node.v1beta1", "kubernetes_node_v1beta1_", true}, - {"k8s.io/api/node/v1alpha1", "node.k8s.io", "io.fabric8.kubernetes.api.model.node.v1alpha1", "kubernetes_node_v1alpha_", true}, - } - - typeMap := map[reflect.Type]reflect.Type{ - reflect.TypeOf(time.Time{}): reflect.TypeOf(""), - reflect.TypeOf(struct{}{}): reflect.TypeOf(""), - } - schema, err := schemagen.GenerateSchema(reflect.TypeOf(Schema{}), packages, typeMap, map[reflect.Type]string{},"node") - if err != nil { - fmt.Fprintf(os.Stderr, "An error occurred: %v", err) - return - } - - args := os.Args[1:] - if len(args) < 1 || args[0] != "validation" { - schema.Resources = nil - } - - b, err := json.Marshal(&schema) - if err != nil { - log.Fatal(err) - } - result := string(b) - result = strings.Replace(result, "\"additionalProperty\":", "\"additionalProperties\":", -1) - - var out bytes.Buffer - err = json.Indent(&out, []byte(result), "", " ") - if err != nil { - log.Fatal(err) - } - - fmt.Println(out.String()) -} diff --git a/kubernetes-model-generator/kubernetes-model-node/pom.xml b/kubernetes-model-generator/kubernetes-model-node/pom.xml index 96de6b3f5bb..c8fbe8d16d4 100644 --- a/kubernetes-model-generator/kubernetes-model-node/pom.xml +++ b/kubernetes-model-generator/kubernetes-model-node/pom.xml @@ -43,37 +43,30 @@ io.fabric8 kubernetes-model-core - - io.fabric8 - kubernetes-model-common - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - false - - - - - - - generate - org.jsonschema2pojo - jsonschema2pojo-maven-plugin + io.fabric8 + openapi-model-generator-maven-plugin + + + + ${project.basedir}/../openapi/schemas/kubernetes-1.21.14.json + ${openapi.schema.kubernetes-latest} + + + io.fabric8.kubernetes.api.model.node + + + ^io\.k8s\.api\.node\..*$ + + + diff --git a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java deleted file mode 100644 index 60fa217a527..00000000000 --- a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java +++ /dev/null @@ -1,200 +0,0 @@ - -package io.fabric8.kubernetes.api.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.fabric8.kubernetes.api.model.version.Info; - -@Generated("jsonschema2pojo") -public class KubeSchema { - - private KubernetesList baseKubernetesList; - private Info info; - private ObjectMeta objectMeta; - private ObjectReference objectReference; - private Quantity quantity; - private Status status; - private TypeMeta typeMeta; - private io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList; - private io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList; - private io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList; - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - /** - * No args constructor for use in serialization - * - */ - public KubeSchema() { - } - - public KubeSchema(KubernetesList baseKubernetesList, Info info, ObjectMeta objectMeta, ObjectReference objectReference, Quantity quantity, Status status, TypeMeta typeMeta, io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList, io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList, io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList) { - super(); - this.baseKubernetesList = baseKubernetesList; - this.info = info; - this.objectMeta = objectMeta; - this.objectReference = objectReference; - this.quantity = quantity; - this.status = status; - this.typeMeta = typeMeta; - this.v1RuntimeClass = v1RuntimeClass; - this.v1RuntimeClassList = v1RuntimeClassList; - this.v1alpha1RuntimeClass = v1alpha1RuntimeClass; - this.v1alpha1RuntimeClassList = v1alpha1RuntimeClassList; - this.v1beta1RuntimeClass = v1beta1RuntimeClass; - this.v1beta1RuntimeClassList = v1beta1RuntimeClassList; - } - - @JsonProperty("BaseKubernetesList") - public KubernetesList getBaseKubernetesList() { - return baseKubernetesList; - } - - @JsonProperty("BaseKubernetesList") - public void setBaseKubernetesList(KubernetesList baseKubernetesList) { - this.baseKubernetesList = baseKubernetesList; - } - - @JsonProperty("Info") - public Info getInfo() { - return info; - } - - @JsonProperty("Info") - public void setInfo(Info info) { - this.info = info; - } - - @JsonProperty("ObjectMeta") - public ObjectMeta getObjectMeta() { - return objectMeta; - } - - @JsonProperty("ObjectMeta") - public void setObjectMeta(ObjectMeta objectMeta) { - this.objectMeta = objectMeta; - } - - @JsonProperty("ObjectReference") - public ObjectReference getObjectReference() { - return objectReference; - } - - @JsonProperty("ObjectReference") - public void setObjectReference(ObjectReference objectReference) { - this.objectReference = objectReference; - } - - @JsonProperty("Quantity") - public Quantity getQuantity() { - return quantity; - } - - @JsonProperty("Quantity") - public void setQuantity(Quantity quantity) { - this.quantity = quantity; - } - - @JsonProperty("Status") - public Status getStatus() { - return status; - } - - @JsonProperty("Status") - public void setStatus(Status status) { - this.status = status; - } - - @JsonProperty("TypeMeta") - public TypeMeta getTypeMeta() { - return typeMeta; - } - - @JsonProperty("TypeMeta") - public void setTypeMeta(TypeMeta typeMeta) { - this.typeMeta = typeMeta; - } - - @JsonProperty("V1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1.RuntimeClass getV1RuntimeClass() { - return v1RuntimeClass; - } - - @JsonProperty("V1RuntimeClass") - public void setV1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass) { - this.v1RuntimeClass = v1RuntimeClass; - } - - @JsonProperty("V1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList getV1RuntimeClassList() { - return v1RuntimeClassList; - } - - @JsonProperty("V1RuntimeClassList") - public void setV1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList) { - this.v1RuntimeClassList = v1RuntimeClassList; - } - - @JsonProperty("V1alpha1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass getV1alpha1RuntimeClass() { - return v1alpha1RuntimeClass; - } - - @JsonProperty("V1alpha1RuntimeClass") - public void setV1alpha1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass) { - this.v1alpha1RuntimeClass = v1alpha1RuntimeClass; - } - - @JsonProperty("V1alpha1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList getV1alpha1RuntimeClassList() { - return v1alpha1RuntimeClassList; - } - - @JsonProperty("V1alpha1RuntimeClassList") - public void setV1alpha1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList) { - this.v1alpha1RuntimeClassList = v1alpha1RuntimeClassList; - } - - @JsonProperty("V1beta1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass getV1beta1RuntimeClass() { - return v1beta1RuntimeClass; - } - - @JsonProperty("V1beta1RuntimeClass") - public void setV1beta1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass) { - this.v1beta1RuntimeClass = v1beta1RuntimeClass; - } - - @JsonProperty("V1beta1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList getV1beta1RuntimeClassList() { - return v1beta1RuntimeClassList; - } - - @JsonProperty("V1beta1RuntimeClassList") - public void setV1beta1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList) { - this.v1beta1RuntimeClassList = v1beta1RuntimeClassList; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - -} diff --git a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java deleted file mode 100644 index a2a23f34db4..00000000000 --- a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java +++ /dev/null @@ -1,200 +0,0 @@ - -package io.fabric8.kubernetes.api.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.fabric8.kubernetes.api.model.version.Info; - -@Generated("jsonschema2pojo") -public class ValidationSchema { - - private KubernetesList baseKubernetesList; - private Info info; - private ObjectMeta objectMeta; - private ObjectReference objectReference; - private Quantity quantity; - private Status status; - private TypeMeta typeMeta; - private io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList; - private io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList; - private io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass; - private io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList; - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - /** - * No args constructor for use in serialization - * - */ - public ValidationSchema() { - } - - public ValidationSchema(KubernetesList baseKubernetesList, Info info, ObjectMeta objectMeta, ObjectReference objectReference, Quantity quantity, Status status, TypeMeta typeMeta, io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList, io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList, io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass, io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList) { - super(); - this.baseKubernetesList = baseKubernetesList; - this.info = info; - this.objectMeta = objectMeta; - this.objectReference = objectReference; - this.quantity = quantity; - this.status = status; - this.typeMeta = typeMeta; - this.v1RuntimeClass = v1RuntimeClass; - this.v1RuntimeClassList = v1RuntimeClassList; - this.v1alpha1RuntimeClass = v1alpha1RuntimeClass; - this.v1alpha1RuntimeClassList = v1alpha1RuntimeClassList; - this.v1beta1RuntimeClass = v1beta1RuntimeClass; - this.v1beta1RuntimeClassList = v1beta1RuntimeClassList; - } - - @JsonProperty("BaseKubernetesList") - public KubernetesList getBaseKubernetesList() { - return baseKubernetesList; - } - - @JsonProperty("BaseKubernetesList") - public void setBaseKubernetesList(KubernetesList baseKubernetesList) { - this.baseKubernetesList = baseKubernetesList; - } - - @JsonProperty("Info") - public Info getInfo() { - return info; - } - - @JsonProperty("Info") - public void setInfo(Info info) { - this.info = info; - } - - @JsonProperty("ObjectMeta") - public ObjectMeta getObjectMeta() { - return objectMeta; - } - - @JsonProperty("ObjectMeta") - public void setObjectMeta(ObjectMeta objectMeta) { - this.objectMeta = objectMeta; - } - - @JsonProperty("ObjectReference") - public ObjectReference getObjectReference() { - return objectReference; - } - - @JsonProperty("ObjectReference") - public void setObjectReference(ObjectReference objectReference) { - this.objectReference = objectReference; - } - - @JsonProperty("Quantity") - public Quantity getQuantity() { - return quantity; - } - - @JsonProperty("Quantity") - public void setQuantity(Quantity quantity) { - this.quantity = quantity; - } - - @JsonProperty("Status") - public Status getStatus() { - return status; - } - - @JsonProperty("Status") - public void setStatus(Status status) { - this.status = status; - } - - @JsonProperty("TypeMeta") - public TypeMeta getTypeMeta() { - return typeMeta; - } - - @JsonProperty("TypeMeta") - public void setTypeMeta(TypeMeta typeMeta) { - this.typeMeta = typeMeta; - } - - @JsonProperty("V1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1.RuntimeClass getV1RuntimeClass() { - return v1RuntimeClass; - } - - @JsonProperty("V1RuntimeClass") - public void setV1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1.RuntimeClass v1RuntimeClass) { - this.v1RuntimeClass = v1RuntimeClass; - } - - @JsonProperty("V1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList getV1RuntimeClassList() { - return v1RuntimeClassList; - } - - @JsonProperty("V1RuntimeClassList") - public void setV1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1.RuntimeClassList v1RuntimeClassList) { - this.v1RuntimeClassList = v1RuntimeClassList; - } - - @JsonProperty("V1alpha1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass getV1alpha1RuntimeClass() { - return v1alpha1RuntimeClass; - } - - @JsonProperty("V1alpha1RuntimeClass") - public void setV1alpha1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClass v1alpha1RuntimeClass) { - this.v1alpha1RuntimeClass = v1alpha1RuntimeClass; - } - - @JsonProperty("V1alpha1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList getV1alpha1RuntimeClassList() { - return v1alpha1RuntimeClassList; - } - - @JsonProperty("V1alpha1RuntimeClassList") - public void setV1alpha1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1alpha1.RuntimeClassList v1alpha1RuntimeClassList) { - this.v1alpha1RuntimeClassList = v1alpha1RuntimeClassList; - } - - @JsonProperty("V1beta1RuntimeClass") - public io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass getV1beta1RuntimeClass() { - return v1beta1RuntimeClass; - } - - @JsonProperty("V1beta1RuntimeClass") - public void setV1beta1RuntimeClass(io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClass v1beta1RuntimeClass) { - this.v1beta1RuntimeClass = v1beta1RuntimeClass; - } - - @JsonProperty("V1beta1RuntimeClassList") - public io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList getV1beta1RuntimeClassList() { - return v1beta1RuntimeClassList; - } - - @JsonProperty("V1beta1RuntimeClassList") - public void setV1beta1RuntimeClassList(io.fabric8.kubernetes.api.model.node.v1beta1.RuntimeClassList v1beta1RuntimeClassList) { - this.v1beta1RuntimeClassList = v1beta1RuntimeClassList; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - -} diff --git a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1/RuntimeClass.java b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1/RuntimeClass.java index 24d671d8d3e..da3e3871212 100644 --- a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1/RuntimeClass.java +++ b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1/RuntimeClass.java @@ -17,6 +17,7 @@ import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; +import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.ObjectReference; import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; import io.fabric8.kubernetes.api.model.PodTemplateSpec; @@ -48,7 +49,7 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(io.fabric8.kubernetes.api.model.ObjectMeta.class), + @BuildableReference(ObjectMeta.class), @BuildableReference(LabelSelector.class), @BuildableReference(Container.class), @BuildableReference(PodTemplateSpec.class), @@ -84,7 +85,7 @@ public class RuntimeClass implements Editable , HasMetadata @JsonProperty("kind") private String kind = "RuntimeClass"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonProperty("overhead") private Overhead overhead; @JsonProperty("scheduling") @@ -99,7 +100,7 @@ public class RuntimeClass implements Editable , HasMetadata public RuntimeClass() { } - public RuntimeClass(String apiVersion, String handler, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, Overhead overhead, Scheduling scheduling) { + public RuntimeClass(String apiVersion, String handler, String kind, ObjectMeta metadata, Overhead overhead, Scheduling scheduling) { super(); this.apiVersion = apiVersion; this.handler = handler; @@ -160,12 +161,12 @@ public void setKind(String kind) { } @JsonProperty("metadata") - public io.fabric8.kubernetes.api.model.ObjectMeta getMetadata() { + public ObjectMeta getMetadata() { return metadata; } @JsonProperty("metadata") - public void setMetadata(io.fabric8.kubernetes.api.model.ObjectMeta metadata) { + public void setMetadata(ObjectMeta metadata) { this.metadata = metadata; } diff --git a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1alpha1/RuntimeClass.java b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1alpha1/RuntimeClass.java index 01ea3e4f488..11787316837 100644 --- a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1alpha1/RuntimeClass.java +++ b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1alpha1/RuntimeClass.java @@ -17,6 +17,7 @@ import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; +import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.ObjectReference; import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; import io.fabric8.kubernetes.api.model.PodTemplateSpec; @@ -46,7 +47,7 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(io.fabric8.kubernetes.api.model.ObjectMeta.class), + @BuildableReference(ObjectMeta.class), @BuildableReference(LabelSelector.class), @BuildableReference(Container.class), @BuildableReference(PodTemplateSpec.class), @@ -80,7 +81,7 @@ public class RuntimeClass implements Editable , HasMetadata @JsonProperty("kind") private String kind = "RuntimeClass"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonProperty("spec") private RuntimeClassSpec spec; @JsonIgnore @@ -93,7 +94,7 @@ public class RuntimeClass implements Editable , HasMetadata public RuntimeClass() { } - public RuntimeClass(String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, RuntimeClassSpec spec) { + public RuntimeClass(String apiVersion, String kind, ObjectMeta metadata, RuntimeClassSpec spec) { super(); this.apiVersion = apiVersion; this.kind = kind; @@ -142,12 +143,12 @@ public void setKind(String kind) { } @JsonProperty("metadata") - public io.fabric8.kubernetes.api.model.ObjectMeta getMetadata() { + public ObjectMeta getMetadata() { return metadata; } @JsonProperty("metadata") - public void setMetadata(io.fabric8.kubernetes.api.model.ObjectMeta metadata) { + public void setMetadata(ObjectMeta metadata) { this.metadata = metadata; } diff --git a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1beta1/RuntimeClass.java b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1beta1/RuntimeClass.java index de5e334c279..786b5140808 100644 --- a/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1beta1/RuntimeClass.java +++ b/kubernetes-model-generator/kubernetes-model-node/src/generated/java/io/fabric8/kubernetes/api/model/node/v1beta1/RuntimeClass.java @@ -17,6 +17,7 @@ import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; +import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.ObjectReference; import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; import io.fabric8.kubernetes.api.model.PodTemplateSpec; @@ -48,7 +49,7 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(io.fabric8.kubernetes.api.model.ObjectMeta.class), + @BuildableReference(ObjectMeta.class), @BuildableReference(LabelSelector.class), @BuildableReference(Container.class), @BuildableReference(PodTemplateSpec.class), @@ -84,7 +85,7 @@ public class RuntimeClass implements Editable , HasMetadata @JsonProperty("kind") private String kind = "RuntimeClass"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonProperty("overhead") private Overhead overhead; @JsonProperty("scheduling") @@ -99,7 +100,7 @@ public class RuntimeClass implements Editable , HasMetadata public RuntimeClass() { } - public RuntimeClass(String apiVersion, String handler, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, Overhead overhead, Scheduling scheduling) { + public RuntimeClass(String apiVersion, String handler, String kind, ObjectMeta metadata, Overhead overhead, Scheduling scheduling) { super(); this.apiVersion = apiVersion; this.handler = handler; @@ -160,12 +161,12 @@ public void setKind(String kind) { } @JsonProperty("metadata") - public io.fabric8.kubernetes.api.model.ObjectMeta getMetadata() { + public ObjectMeta getMetadata() { return metadata; } @JsonProperty("metadata") - public void setMetadata(io.fabric8.kubernetes.api.model.ObjectMeta metadata) { + public void setMetadata(ObjectMeta metadata) { this.metadata = metadata; } diff --git a/kubernetes-model-generator/openapi/maven-plugin/src/test/java/io/fabric8/kubernetes/schema/generator/model/KubernetesTest.java b/kubernetes-model-generator/openapi/maven-plugin/src/test/java/io/fabric8/kubernetes/schema/generator/model/KubernetesTest.java index d9bb43410e9..04420e87508 100644 --- a/kubernetes-model-generator/openapi/maven-plugin/src/test/java/io/fabric8/kubernetes/schema/generator/model/KubernetesTest.java +++ b/kubernetes-model-generator/openapi/maven-plugin/src/test/java/io/fabric8/kubernetes/schema/generator/model/KubernetesTest.java @@ -57,18 +57,6 @@ void kustomize() { .generate(); } - @Test - void node() { - new ModelGenerator(baseSettings - .clearSchemas() - .schema(new File("../schemas/kubernetes-1.21.14.json")) - .schema(new File("../schemas/kubernetes-1.30.0.json")) - .includeGenerationRegex("^io\\.k8s\\.api\\.node\\..*$") - .packageMapping("io.k8s.api.node", "io.fabric8.kubernetes.api.model.node") - .build()) - .generate(); - } - @Test void policy() { new ModelGenerator(baseSettings