From 6485ac1a0a7c32376856773b568365e607e8bad1 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 22 Jul 2024 12:33:26 +0200 Subject: [PATCH] refactor: kubernetes-model-core generated from OpenAPI schemas Signed-off-by: Marc Nuri --- Makefile | 9 +- kubernetes-model-generator/generateModel.sh | 1 - .../kubernetes-model-core/pom.xml | 82 +++++-------------- .../kubernetes/api/model/APIResourceList.java | 4 + .../kubernetes/api/model/LimitRangeItem.java | 32 ++++---- .../kubernetes/api/model/NodeStatus.java | 14 ++-- .../kubernetes/api/model/OwnerReference.java | 43 +++++++++- .../model/PersistentVolumeClaimStatus.java | 14 ++-- .../kubernetes/api/model/PodExecOptions.java | 43 +--------- .../api/model/ResourceQuotaStatus.java | 14 ++-- .../api/model/ResourceRequirements.java | 14 ++-- .../kubernetes/api/model/TypeMeta.java | 43 +++++++++- .../api/model/VolumeResourceRequirements.java | 14 ++-- .../kubernetes/api/model/WatchEvent.java | 10 +-- .../kubernetes/api/model/version/Info.java | 9 ++ kubernetes-model-generator/pom.xml | 25 ++++++ 16 files changed, 208 insertions(+), 163 deletions(-) diff --git a/Makefile b/Makefile index 2444feba0c8..44897e633c2 100644 --- a/Makefile +++ b/Makefile @@ -28,13 +28,20 @@ generate-openapi: cd kubernetes-model-generator/openapi/generator && go build ./kubernetes-model-generator/openapi/generator/generator ./kubernetes-model-generator/openapi/schemas +.PHONY: generate-openapi-classes +generate-openapi-classes: +# TODO: Do for all modules once they've all been migrated +# cd kubernetes-model-generator && mvn -Pgenerate clean package + cd kubernetes-model-generator/openapi/maven-plugin && mvn clean verify + cd kubernetes-model-generator/kubernetes-model-core && mvn -Pgenerate clean package + # Legacy generation of the model: TODO: remove .PHONY: generate-model-legacy generate-model-legacy: cd kubernetes-model-generator && ./generateModel.sh .PHONY: generate-model -generate-model: generate-openapi generate-model-legacy +generate-model: generate-openapi generate-openapi-classes generate-model-legacy .PHONY: sonar sonar: diff --git a/kubernetes-model-generator/generateModel.sh b/kubernetes-model-generator/generateModel.sh index 74203087763..7b84bce102d 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-core" "kubernetes-model-rbac" "kubernetes-model-admissionregistration" "kubernetes-model-apiextensions" diff --git a/kubernetes-model-generator/kubernetes-model-core/pom.xml b/kubernetes-model-generator/kubernetes-model-core/pom.xml index 7dc585d80de..7eb4589c54f 100644 --- a/kubernetes-model-generator/kubernetes-model-core/pom.xml +++ b/kubernetes-model-generator/kubernetes-model-core/pom.xml @@ -130,74 +130,36 @@ - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - false - - - - - - - generate - org.jsonschema2pojo - jsonschema2pojo-maven-plugin - - io.fabric8.kubernetes.jsonschema2pojo.KubernetesCoreTypeAnnotator + io.fabric8 + openapi-model-generator-maven-plugin + + + false + + ${project.basedir}/../openapi/schemas/kubernetes-1.30.0.json + ${project.basedir}/../openapi/schemas/api-machinery-extra.json + ${project.basedir}/../openapi/schemas/admission-registration.json + + + io.fabric8.kubernetes.api.model + io.fabric8.kubernetes.api.model + + + ^io\.k8s\.apimachinery\.pkg\.runtime\.RawExtension$ + + + ^io\.k8s\.api\.core\..*$ + ^io\.k8s\.apimachinery\..*$ + + - - maven-antrun-plugin - - - generate-sources - - - Removing the duplicate generated class - - - - - - - - - - - - - - - run - - - - diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/APIResourceList.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/APIResourceList.java index 684e8006678..0d4523678c2 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/APIResourceList.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/APIResourceList.java @@ -14,6 +14,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; import io.sundr.builder.annotations.Buildable; import io.sundr.transform.annotations.TemplateTransformation; import io.sundr.transform.annotations.TemplateTransformations; @@ -39,6 +41,8 @@ @TemplateTransformations({ @TemplateTransformation(value = "/manifest.vm", outputPath = "META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource", gather = true) }) +@Version("v1") +@Group("") @Generated("jsonschema2pojo") public class APIResourceList implements Editable , KubernetesResource { diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/LimitRangeItem.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/LimitRangeItem.java index 69e9b40cc14..e15a26f8a8c 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/LimitRangeItem.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/LimitRangeItem.java @@ -40,19 +40,19 @@ public class LimitRangeItem implements Editable , Kuberne @JsonProperty("default") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map _default = new LinkedHashMap<>(); + private Map _default = new LinkedHashMap<>(); @JsonProperty("defaultRequest") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map defaultRequest = new LinkedHashMap<>(); + private Map defaultRequest = new LinkedHashMap<>(); @JsonProperty("max") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map max = new LinkedHashMap<>(); + private Map max = new LinkedHashMap<>(); @JsonProperty("maxLimitRequestRatio") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map maxLimitRequestRatio = new LinkedHashMap<>(); + private Map maxLimitRequestRatio = new LinkedHashMap<>(); @JsonProperty("min") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map min = new LinkedHashMap<>(); + private Map min = new LinkedHashMap<>(); @JsonProperty("type") private String type; @JsonIgnore @@ -65,7 +65,7 @@ public class LimitRangeItem implements Editable , Kuberne public LimitRangeItem() { } - public LimitRangeItem(Map _default, Map defaultRequest, Map max, Map maxLimitRequestRatio, Map min, String type) { + public LimitRangeItem(Map _default, Map defaultRequest, Map max, Map maxLimitRequestRatio, Map min, String type) { super(); this._default = _default; this.defaultRequest = defaultRequest; @@ -77,56 +77,56 @@ public LimitRangeItem(Map _def @JsonProperty("default") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getDefault() { + public Map getDefault() { return _default; } @JsonProperty("default") - public void setDefault(Map _default) { + public void setDefault(Map _default) { this._default = _default; } @JsonProperty("defaultRequest") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getDefaultRequest() { + public Map getDefaultRequest() { return defaultRequest; } @JsonProperty("defaultRequest") - public void setDefaultRequest(Map defaultRequest) { + public void setDefaultRequest(Map defaultRequest) { this.defaultRequest = defaultRequest; } @JsonProperty("max") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getMax() { + public Map getMax() { return max; } @JsonProperty("max") - public void setMax(Map max) { + public void setMax(Map max) { this.max = max; } @JsonProperty("maxLimitRequestRatio") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getMaxLimitRequestRatio() { + public Map getMaxLimitRequestRatio() { return maxLimitRequestRatio; } @JsonProperty("maxLimitRequestRatio") - public void setMaxLimitRequestRatio(Map maxLimitRequestRatio) { + public void setMaxLimitRequestRatio(Map maxLimitRequestRatio) { this.maxLimitRequestRatio = maxLimitRequestRatio; } @JsonProperty("min") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getMin() { + public Map getMin() { return min; } @JsonProperty("min") - public void setMin(Map min) { + public void setMin(Map min) { this.min = min; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/NodeStatus.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/NodeStatus.java index 45aa54f0c41..419b2263bc6 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/NodeStatus.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/NodeStatus.java @@ -51,10 +51,10 @@ public class NodeStatus implements Editable , KubernetesResou private List addresses = new ArrayList<>(); @JsonProperty("allocatable") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map allocatable = new LinkedHashMap<>(); + private Map allocatable = new LinkedHashMap<>(); @JsonProperty("capacity") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map capacity = new LinkedHashMap<>(); + private Map capacity = new LinkedHashMap<>(); @JsonProperty("conditions") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List conditions = new ArrayList<>(); @@ -88,7 +88,7 @@ public class NodeStatus implements Editable , KubernetesResou public NodeStatus() { } - public NodeStatus(List addresses, Map allocatable, Map capacity, List conditions, NodeConfigStatus config, NodeDaemonEndpoints daemonEndpoints, List images, NodeSystemInfo nodeInfo, String phase, List runtimeHandlers, List volumesAttached, List volumesInUse) { + public NodeStatus(List addresses, Map allocatable, Map capacity, List conditions, NodeConfigStatus config, NodeDaemonEndpoints daemonEndpoints, List images, NodeSystemInfo nodeInfo, String phase, List runtimeHandlers, List volumesAttached, List volumesInUse) { super(); this.addresses = addresses; this.allocatable = allocatable; @@ -117,23 +117,23 @@ public void setAddresses(List addresses) { @JsonProperty("allocatable") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getAllocatable() { + public Map getAllocatable() { return allocatable; } @JsonProperty("allocatable") - public void setAllocatable(Map allocatable) { + public void setAllocatable(Map allocatable) { this.allocatable = allocatable; } @JsonProperty("capacity") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getCapacity() { + public Map getCapacity() { return capacity; } @JsonProperty("capacity") - public void setCapacity(Map capacity) { + public void setCapacity(Map capacity) { this.capacity = capacity; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/OwnerReference.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/OwnerReference.java index 8792bdfe564..813b1f8d730 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/OwnerReference.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/OwnerReference.java @@ -12,7 +12,11 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; import io.sundr.builder.annotations.Buildable; +import io.sundr.transform.annotations.TemplateTransformation; +import io.sundr.transform.annotations.TemplateTransformations; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; @@ -34,18 +38,33 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") +@TemplateTransformations({ + @TemplateTransformation(value = "/manifest.vm", outputPath = "META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource", gather = true) +}) +@Version("v1") +@Group("") @Generated("jsonschema2pojo") public class OwnerReference implements Editable , KubernetesResource { + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") - private String apiVersion; + private String apiVersion = "v1"; @JsonProperty("blockOwnerDeletion") private Boolean blockOwnerDeletion; @JsonProperty("controller") private Boolean controller; + /** + * + * (Required) + * + */ @JsonProperty("kind") - private String kind; + private String kind = "OwnerReference"; @JsonProperty("name") private String name; @JsonProperty("uid") @@ -70,11 +89,21 @@ public OwnerReference(String apiVersion, Boolean blockOwnerDeletion, Boolean con this.uid = uid; } + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") public String getApiVersion() { return apiVersion; } + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; @@ -100,11 +129,21 @@ public void setController(Boolean controller) { this.controller = controller; } + /** + * + * (Required) + * + */ @JsonProperty("kind") public String getKind() { return kind; } + /** + * + * (Required) + * + */ @JsonProperty("kind") public void setKind(String kind) { this.kind = kind; diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PersistentVolumeClaimStatus.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PersistentVolumeClaimStatus.java index 4fd851cd3d2..80fb8a74d1f 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PersistentVolumeClaimStatus.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PersistentVolumeClaimStatus.java @@ -50,10 +50,10 @@ public class PersistentVolumeClaimStatus implements Editable allocatedResourceStatuses = new LinkedHashMap<>(); @JsonProperty("allocatedResources") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map allocatedResources = new LinkedHashMap<>(); + private Map allocatedResources = new LinkedHashMap<>(); @JsonProperty("capacity") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map capacity = new LinkedHashMap<>(); + private Map capacity = new LinkedHashMap<>(); @JsonProperty("conditions") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List conditions = new ArrayList<>(); @@ -73,7 +73,7 @@ public class PersistentVolumeClaimStatus implements Editable accessModes, Map allocatedResourceStatuses, Map allocatedResources, Map capacity, List conditions, String currentVolumeAttributesClassName, ModifyVolumeStatus modifyVolumeStatus, String phase) { + public PersistentVolumeClaimStatus(List accessModes, Map allocatedResourceStatuses, Map allocatedResources, Map capacity, List conditions, String currentVolumeAttributesClassName, ModifyVolumeStatus modifyVolumeStatus, String phase) { super(); this.accessModes = accessModes; this.allocatedResourceStatuses = allocatedResourceStatuses; @@ -109,23 +109,23 @@ public void setAllocatedResourceStatuses(Map allocatedResourceSt @JsonProperty("allocatedResources") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getAllocatedResources() { + public Map getAllocatedResources() { return allocatedResources; } @JsonProperty("allocatedResources") - public void setAllocatedResources(Map allocatedResources) { + public void setAllocatedResources(Map allocatedResources) { this.allocatedResources = allocatedResources; } @JsonProperty("capacity") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getCapacity() { + public Map getCapacity() { return capacity; } @JsonProperty("capacity") - public void setCapacity(Map capacity) { + public void setCapacity(Map capacity) { this.capacity = capacity; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PodExecOptions.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PodExecOptions.java index d30982cf357..9a018d2e8a4 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PodExecOptions.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/PodExecOptions.java @@ -14,11 +14,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Version; import io.sundr.builder.annotations.Buildable; -import io.sundr.transform.annotations.TemplateTransformation; -import io.sundr.transform.annotations.TemplateTransformations; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; @@ -42,34 +38,19 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") -@TemplateTransformations({ - @TemplateTransformation(value = "/manifest.vm", outputPath = "META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource", gather = true) -}) -@Version("v1") -@Group("") @Generated("jsonschema2pojo") public class PodExecOptions implements Editable , KubernetesResource { - /** - * - * (Required) - * - */ @JsonProperty("apiVersion") - private String apiVersion = "v1"; + private String apiVersion; @JsonProperty("command") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List command = new ArrayList<>(); @JsonProperty("container") private String container; - /** - * - * (Required) - * - */ @JsonProperty("kind") - private String kind = "PodExecOptions"; + private String kind; @JsonProperty("stderr") private Boolean stderr; @JsonProperty("stdin") @@ -100,21 +81,11 @@ public PodExecOptions(String apiVersion, List command, String container, this.tty = tty; } - /** - * - * (Required) - * - */ @JsonProperty("apiVersion") public String getApiVersion() { return apiVersion; } - /** - * - * (Required) - * - */ @JsonProperty("apiVersion") public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; @@ -141,21 +112,11 @@ public void setContainer(String container) { this.container = container; } - /** - * - * (Required) - * - */ @JsonProperty("kind") public String getKind() { return kind; } - /** - * - * (Required) - * - */ @JsonProperty("kind") public void setKind(String kind) { this.kind = kind; diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceQuotaStatus.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceQuotaStatus.java index 061defc0bf0..cb5a60288be 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceQuotaStatus.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceQuotaStatus.java @@ -36,10 +36,10 @@ public class ResourceQuotaStatus implements Editable @JsonProperty("hard") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map hard = new LinkedHashMap<>(); + private Map hard = new LinkedHashMap<>(); @JsonProperty("used") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map used = new LinkedHashMap<>(); + private Map used = new LinkedHashMap<>(); @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -50,7 +50,7 @@ public class ResourceQuotaStatus implements Editable public ResourceQuotaStatus() { } - public ResourceQuotaStatus(Map hard, Map used) { + public ResourceQuotaStatus(Map hard, Map used) { super(); this.hard = hard; this.used = used; @@ -58,23 +58,23 @@ public ResourceQuotaStatus(Map @JsonProperty("hard") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getHard() { + public Map getHard() { return hard; } @JsonProperty("hard") - public void setHard(Map hard) { + public void setHard(Map hard) { this.hard = hard; } @JsonProperty("used") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getUsed() { + public Map getUsed() { return used; } @JsonProperty("used") - public void setUsed(Map used) { + public void setUsed(Map used) { this.used = used; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceRequirements.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceRequirements.java index e8552796780..b142f9c191d 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceRequirements.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/ResourceRequirements.java @@ -42,10 +42,10 @@ public class ResourceRequirements implements Editable claims = new ArrayList<>(); @JsonProperty("limits") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map limits = new LinkedHashMap<>(); + private Map limits = new LinkedHashMap<>(); @JsonProperty("requests") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map requests = new LinkedHashMap<>(); + private Map requests = new LinkedHashMap<>(); @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -56,7 +56,7 @@ public class ResourceRequirements implements Editable claims, Map limits, Map requests) { + public ResourceRequirements(List claims, Map limits, Map requests) { super(); this.claims = claims; this.limits = limits; @@ -76,23 +76,23 @@ public void setClaims(List claims) { @JsonProperty("limits") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getLimits() { + public Map getLimits() { return limits; } @JsonProperty("limits") - public void setLimits(Map limits) { + public void setLimits(Map limits) { this.limits = limits; } @JsonProperty("requests") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getRequests() { + public Map getRequests() { return requests; } @JsonProperty("requests") - public void setRequests(Map requests) { + public void setRequests(Map requests) { this.requests = requests; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/TypeMeta.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/TypeMeta.java index 3ad5b7e14f1..7abdc180689 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/TypeMeta.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/TypeMeta.java @@ -12,7 +12,11 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; import io.sundr.builder.annotations.Buildable; +import io.sundr.transform.annotations.TemplateTransformation; +import io.sundr.transform.annotations.TemplateTransformations; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; @@ -30,14 +34,29 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") +@TemplateTransformations({ + @TemplateTransformation(value = "/manifest.vm", outputPath = "META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource", gather = true) +}) +@Version("v1") +@Group("") @Generated("jsonschema2pojo") public class TypeMeta implements Editable , KubernetesResource { + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") - private String apiVersion; + private String apiVersion = "v1"; + /** + * + * (Required) + * + */ @JsonProperty("kind") - private String kind; + private String kind = "TypeMeta"; @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -54,21 +73,41 @@ public TypeMeta(String apiVersion, String kind) { this.kind = kind; } + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") public String getApiVersion() { return apiVersion; } + /** + * + * (Required) + * + */ @JsonProperty("apiVersion") public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; } + /** + * + * (Required) + * + */ @JsonProperty("kind") public String getKind() { return kind; } + /** + * + * (Required) + * + */ @JsonProperty("kind") public void setKind(String kind) { this.kind = kind; diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/VolumeResourceRequirements.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/VolumeResourceRequirements.java index d37d5f23faf..6ff825d0440 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/VolumeResourceRequirements.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/VolumeResourceRequirements.java @@ -36,10 +36,10 @@ public class VolumeResourceRequirements implements Editable limits = new LinkedHashMap<>(); + private Map limits = new LinkedHashMap<>(); @JsonProperty("requests") @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map requests = new LinkedHashMap<>(); + private Map requests = new LinkedHashMap<>(); @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -50,7 +50,7 @@ public class VolumeResourceRequirements implements Editable limits, Map requests) { + public VolumeResourceRequirements(Map limits, Map requests) { super(); this.limits = limits; this.requests = requests; @@ -58,23 +58,23 @@ public VolumeResourceRequirements(Map getLimits() { + public Map getLimits() { return limits; } @JsonProperty("limits") - public void setLimits(Map limits) { + public void setLimits(Map limits) { this.limits = limits; } @JsonProperty("requests") @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Map getRequests() { + public Map getRequests() { return requests; } @JsonProperty("requests") - public void setRequests(Map requests) { + public void setRequests(Map requests) { this.requests = requests; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/WatchEvent.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/WatchEvent.java index a9a0ca00a97..c86b669b395 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/WatchEvent.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/WatchEvent.java @@ -31,11 +31,11 @@ }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") @Generated("jsonschema2pojo") -public class WatchEvent implements Editable , io.fabric8.kubernetes.api.model.KubernetesResource +public class WatchEvent implements Editable , KubernetesResource { @JsonProperty("object") - private io.fabric8.kubernetes.api.model.KubernetesResource object; + private KubernetesResource object; @JsonProperty("type") private String type; @JsonIgnore @@ -48,19 +48,19 @@ public class WatchEvent implements Editable , io.fabric8.kube public WatchEvent() { } - public WatchEvent(io.fabric8.kubernetes.api.model.KubernetesResource object, String type) { + public WatchEvent(KubernetesResource object, String type) { super(); this.object = object; this.type = type; } @JsonProperty("object") - public io.fabric8.kubernetes.api.model.KubernetesResource getObject() { + public KubernetesResource getObject() { return object; } @JsonProperty("object") - public void setObject(io.fabric8.kubernetes.api.model.KubernetesResource object) { + public void setObject(KubernetesResource object) { this.object = object; } diff --git a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/version/Info.java b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/version/Info.java index e71018f3a26..b56f8c5382d 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/version/Info.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/generated/java/io/fabric8/kubernetes/api/model/version/Info.java @@ -13,7 +13,11 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; import io.fabric8.kubernetes.api.model.KubernetesResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; import io.sundr.builder.annotations.Buildable; +import io.sundr.transform.annotations.TemplateTransformation; +import io.sundr.transform.annotations.TemplateTransformations; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; @@ -38,6 +42,11 @@ "" }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") +@TemplateTransformations({ + @TemplateTransformation(value = "/manifest.vm", outputPath = "META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource", gather = true) +}) +@Version("v1") +@Group("") @Generated("jsonschema2pojo") public class Info implements Editable , KubernetesResource { diff --git a/kubernetes-model-generator/pom.xml b/kubernetes-model-generator/pom.xml index 9fa17f2a993..ff486173541 100644 --- a/kubernetes-model-generator/pom.xml +++ b/kubernetes-model-generator/pom.xml @@ -140,6 +140,31 @@ + + io.fabric8 + openapi-model-generator-maven-plugin + + + ${project.basedir} + io.fabric8.kubernetes.api.model + io.fabric8.kubernetes.api.builder + true + false + + io.fabric8.kubernetes.api.model + io.fabric8.kubernetes.api.model + io.fabric8.kubernetes.api.model + + + + + + + generate-model + + + + org.codehaus.mojo build-helper-maven-plugin