diff --git a/Makefile b/Makefile index 4001f48a620..763cd1e8c92 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ generate-openapi-classes: 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 + cd kubernetes-model-generator/kubernetes-model-policy && 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 a5803320a9b..87088b468fe 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-policy" "kubernetes-model-scheduling" "kubernetes-model-storageclass" "kubernetes-model-resource" diff --git a/kubernetes-model-generator/kubernetes-model-policy/Makefile b/kubernetes-model-generator/kubernetes-model-policy/Makefile deleted file mode 100644 index c09a7003874..00000000000 --- a/kubernetes-model-generator/kubernetes-model-policy/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-policy/cmd/generate/generate.go b/kubernetes-model-generator/kubernetes-model-policy/cmd/generate/generate.go deleted file mode 100644 index 645e3dc3efc..00000000000 --- a/kubernetes-model-generator/kubernetes-model-policy/cmd/generate/generate.go +++ /dev/null @@ -1,109 +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" - // Dependencies of rbac - 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" - - policy "k8s.io/api/policy/v1beta1" - v1policy "k8s.io/api/policy/v1" - - "log" - "reflect" - "strings" - "time" - - "os" - - "github.com/fabric8io/kubernetes-client/kubernetes-model-generator/pkg/schemagen" -) - -type Schema struct { - Info apimachineryversion.Info - APIGroup metav1.APIGroup - APIGroupList metav1.APIGroupList - BaseKubernetesList metav1.List - ObjectMeta metav1.ObjectMeta - TypeMeta metav1.TypeMeta - Status metav1.Status - Patch metav1.Patch - ListOptions metav1.ListOptions - DeleteOptions metav1.DeleteOptions - CreateOptions metav1.CreateOptions - UpdateOptions metav1.UpdateOptions - GetOptions metav1.GetOptions - PatchOptions metav1.PatchOptions - Time metav1.Time - RootPaths metav1.RootPaths - Quantity resource.Quantity - ObjectReference kapi.ObjectReference - - PodDisruptionBudget policy.PodDisruptionBudget - PodDisruptionBudgetList policy.PodDisruptionBudgetList - Eviction policy.Eviction - V1PodDisruptionBudget v1policy.PodDisruptionBudget - V1PodDisruptionBudgetList v1policy.PodDisruptionBudgetList - V1Eviction v1policy.Eviction -} - -func main() { - packages := []schemagen.PackageDescriptor{ - {"k8s.io/apimachinery/pkg/util/intstr", "", "io.fabric8.kubernetes.api.model", "kubernetes_apimachinery_pkg_util_intstr_", false}, - {"k8s.io/apimachinery/pkg/runtime", "", "io.fabric8.kubernetes.api.model.runtime", "kubernetes_apimachinery_pkg_runtime_", 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/policy/v1beta1", "", "io.fabric8.kubernetes.api.model.policy.v1beta1", "kubernetes_policy_v1beta1_", true}, - {"k8s.io/api/policy/v1", "", "io.fabric8.kubernetes.api.model.policy.v1", "kubernetes_policy_v1_", 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{},"policy") - 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-policy/pom.xml b/kubernetes-model-generator/kubernetes-model-policy/pom.xml index f3cae7754ae..2e9c7a8cf18 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/pom.xml +++ b/kubernetes-model-generator/kubernetes-model-policy/pom.xml @@ -41,10 +41,6 @@ io.fabric8 kubernetes-model-core - - io.fabric8 - kubernetes-model-common - org.assertj assertj-core @@ -52,31 +48,28 @@ - - - - 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.policy + + + ^io\.k8s\.api\.policy\..*$ + + + diff --git a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java deleted file mode 100644 index 0af05e54e69..00000000000 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/KubeSchema.java +++ /dev/null @@ -1,332 +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 APIGroup aPIGroup; - private APIGroupList aPIGroupList; - private KubernetesList baseKubernetesList; - private CreateOptions createOptions; - private DeleteOptions deleteOptions; - private io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction; - private GetOptions getOptions; - private Info info; - private ListOptions listOptions; - private ObjectMeta objectMeta; - private ObjectReference objectReference; - private Patch patch; - private PatchOptions patchOptions; - private io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget; - private io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList; - private Quantity quantity; - private RootPaths rootPaths; - private Status status; - private String time; - private TypeMeta typeMeta; - private UpdateOptions updateOptions; - private io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction; - private io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget; - private io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList; - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - /** - * No args constructor for use in serialization - * - */ - public KubeSchema() { - } - - public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, KubernetesList baseKubernetesList, CreateOptions createOptions, DeleteOptions deleteOptions, io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction, GetOptions getOptions, Info info, ListOptions listOptions, ObjectMeta objectMeta, ObjectReference objectReference, Patch patch, PatchOptions patchOptions, io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget, io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList, Quantity quantity, RootPaths rootPaths, Status status, String time, TypeMeta typeMeta, UpdateOptions updateOptions, io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction, io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget, io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList) { - super(); - this.aPIGroup = aPIGroup; - this.aPIGroupList = aPIGroupList; - this.baseKubernetesList = baseKubernetesList; - this.createOptions = createOptions; - this.deleteOptions = deleteOptions; - this.eviction = eviction; - this.getOptions = getOptions; - this.info = info; - this.listOptions = listOptions; - this.objectMeta = objectMeta; - this.objectReference = objectReference; - this.patch = patch; - this.patchOptions = patchOptions; - this.podDisruptionBudget = podDisruptionBudget; - this.podDisruptionBudgetList = podDisruptionBudgetList; - this.quantity = quantity; - this.rootPaths = rootPaths; - this.status = status; - this.time = time; - this.typeMeta = typeMeta; - this.updateOptions = updateOptions; - this.v1Eviction = v1Eviction; - this.v1PodDisruptionBudget = v1PodDisruptionBudget; - this.v1PodDisruptionBudgetList = v1PodDisruptionBudgetList; - } - - @JsonProperty("APIGroup") - public APIGroup getAPIGroup() { - return aPIGroup; - } - - @JsonProperty("APIGroup") - public void setAPIGroup(APIGroup aPIGroup) { - this.aPIGroup = aPIGroup; - } - - @JsonProperty("APIGroupList") - public APIGroupList getAPIGroupList() { - return aPIGroupList; - } - - @JsonProperty("APIGroupList") - public void setAPIGroupList(APIGroupList aPIGroupList) { - this.aPIGroupList = aPIGroupList; - } - - @JsonProperty("BaseKubernetesList") - public KubernetesList getBaseKubernetesList() { - return baseKubernetesList; - } - - @JsonProperty("BaseKubernetesList") - public void setBaseKubernetesList(KubernetesList baseKubernetesList) { - this.baseKubernetesList = baseKubernetesList; - } - - @JsonProperty("CreateOptions") - public CreateOptions getCreateOptions() { - return createOptions; - } - - @JsonProperty("CreateOptions") - public void setCreateOptions(CreateOptions createOptions) { - this.createOptions = createOptions; - } - - @JsonProperty("DeleteOptions") - public DeleteOptions getDeleteOptions() { - return deleteOptions; - } - - @JsonProperty("DeleteOptions") - public void setDeleteOptions(DeleteOptions deleteOptions) { - this.deleteOptions = deleteOptions; - } - - @JsonProperty("Eviction") - public io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction getEviction() { - return eviction; - } - - @JsonProperty("Eviction") - public void setEviction(io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction) { - this.eviction = eviction; - } - - @JsonProperty("GetOptions") - public GetOptions getGetOptions() { - return getOptions; - } - - @JsonProperty("GetOptions") - public void setGetOptions(GetOptions getOptions) { - this.getOptions = getOptions; - } - - @JsonProperty("Info") - public Info getInfo() { - return info; - } - - @JsonProperty("Info") - public void setInfo(Info info) { - this.info = info; - } - - @JsonProperty("ListOptions") - public ListOptions getListOptions() { - return listOptions; - } - - @JsonProperty("ListOptions") - public void setListOptions(ListOptions listOptions) { - this.listOptions = listOptions; - } - - @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("Patch") - public Patch getPatch() { - return patch; - } - - @JsonProperty("Patch") - public void setPatch(Patch patch) { - this.patch = patch; - } - - @JsonProperty("PatchOptions") - public PatchOptions getPatchOptions() { - return patchOptions; - } - - @JsonProperty("PatchOptions") - public void setPatchOptions(PatchOptions patchOptions) { - this.patchOptions = patchOptions; - } - - @JsonProperty("PodDisruptionBudget") - public io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget getPodDisruptionBudget() { - return podDisruptionBudget; - } - - @JsonProperty("PodDisruptionBudget") - public void setPodDisruptionBudget(io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget) { - this.podDisruptionBudget = podDisruptionBudget; - } - - @JsonProperty("PodDisruptionBudgetList") - public io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList getPodDisruptionBudgetList() { - return podDisruptionBudgetList; - } - - @JsonProperty("PodDisruptionBudgetList") - public void setPodDisruptionBudgetList(io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList) { - this.podDisruptionBudgetList = podDisruptionBudgetList; - } - - @JsonProperty("Quantity") - public Quantity getQuantity() { - return quantity; - } - - @JsonProperty("Quantity") - public void setQuantity(Quantity quantity) { - this.quantity = quantity; - } - - @JsonProperty("RootPaths") - public RootPaths getRootPaths() { - return rootPaths; - } - - @JsonProperty("RootPaths") - public void setRootPaths(RootPaths rootPaths) { - this.rootPaths = rootPaths; - } - - @JsonProperty("Status") - public Status getStatus() { - return status; - } - - @JsonProperty("Status") - public void setStatus(Status status) { - this.status = status; - } - - @JsonProperty("Time") - public String getTime() { - return time; - } - - @JsonProperty("Time") - public void setTime(String time) { - this.time = time; - } - - @JsonProperty("TypeMeta") - public TypeMeta getTypeMeta() { - return typeMeta; - } - - @JsonProperty("TypeMeta") - public void setTypeMeta(TypeMeta typeMeta) { - this.typeMeta = typeMeta; - } - - @JsonProperty("UpdateOptions") - public UpdateOptions getUpdateOptions() { - return updateOptions; - } - - @JsonProperty("UpdateOptions") - public void setUpdateOptions(UpdateOptions updateOptions) { - this.updateOptions = updateOptions; - } - - @JsonProperty("V1Eviction") - public io.fabric8.kubernetes.api.model.policy.v1.Eviction getV1Eviction() { - return v1Eviction; - } - - @JsonProperty("V1Eviction") - public void setV1Eviction(io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction) { - this.v1Eviction = v1Eviction; - } - - @JsonProperty("V1PodDisruptionBudget") - public io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget getV1PodDisruptionBudget() { - return v1PodDisruptionBudget; - } - - @JsonProperty("V1PodDisruptionBudget") - public void setV1PodDisruptionBudget(io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget) { - this.v1PodDisruptionBudget = v1PodDisruptionBudget; - } - - @JsonProperty("V1PodDisruptionBudgetList") - public io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList getV1PodDisruptionBudgetList() { - return v1PodDisruptionBudgetList; - } - - @JsonProperty("V1PodDisruptionBudgetList") - public void setV1PodDisruptionBudgetList(io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList) { - this.v1PodDisruptionBudgetList = v1PodDisruptionBudgetList; - } - - @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-policy/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java deleted file mode 100644 index 7f3aefd28e1..00000000000 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/ValidationSchema.java +++ /dev/null @@ -1,332 +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 APIGroup aPIGroup; - private APIGroupList aPIGroupList; - private KubernetesList baseKubernetesList; - private CreateOptions createOptions; - private DeleteOptions deleteOptions; - private io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction; - private GetOptions getOptions; - private Info info; - private ListOptions listOptions; - private ObjectMeta objectMeta; - private ObjectReference objectReference; - private Patch patch; - private PatchOptions patchOptions; - private io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget; - private io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList; - private Quantity quantity; - private RootPaths rootPaths; - private Status status; - private String time; - private TypeMeta typeMeta; - private UpdateOptions updateOptions; - private io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction; - private io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget; - private io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList; - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - /** - * No args constructor for use in serialization - * - */ - public ValidationSchema() { - } - - public ValidationSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, KubernetesList baseKubernetesList, CreateOptions createOptions, DeleteOptions deleteOptions, io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction, GetOptions getOptions, Info info, ListOptions listOptions, ObjectMeta objectMeta, ObjectReference objectReference, Patch patch, PatchOptions patchOptions, io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget, io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList, Quantity quantity, RootPaths rootPaths, Status status, String time, TypeMeta typeMeta, UpdateOptions updateOptions, io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction, io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget, io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList) { - super(); - this.aPIGroup = aPIGroup; - this.aPIGroupList = aPIGroupList; - this.baseKubernetesList = baseKubernetesList; - this.createOptions = createOptions; - this.deleteOptions = deleteOptions; - this.eviction = eviction; - this.getOptions = getOptions; - this.info = info; - this.listOptions = listOptions; - this.objectMeta = objectMeta; - this.objectReference = objectReference; - this.patch = patch; - this.patchOptions = patchOptions; - this.podDisruptionBudget = podDisruptionBudget; - this.podDisruptionBudgetList = podDisruptionBudgetList; - this.quantity = quantity; - this.rootPaths = rootPaths; - this.status = status; - this.time = time; - this.typeMeta = typeMeta; - this.updateOptions = updateOptions; - this.v1Eviction = v1Eviction; - this.v1PodDisruptionBudget = v1PodDisruptionBudget; - this.v1PodDisruptionBudgetList = v1PodDisruptionBudgetList; - } - - @JsonProperty("APIGroup") - public APIGroup getAPIGroup() { - return aPIGroup; - } - - @JsonProperty("APIGroup") - public void setAPIGroup(APIGroup aPIGroup) { - this.aPIGroup = aPIGroup; - } - - @JsonProperty("APIGroupList") - public APIGroupList getAPIGroupList() { - return aPIGroupList; - } - - @JsonProperty("APIGroupList") - public void setAPIGroupList(APIGroupList aPIGroupList) { - this.aPIGroupList = aPIGroupList; - } - - @JsonProperty("BaseKubernetesList") - public KubernetesList getBaseKubernetesList() { - return baseKubernetesList; - } - - @JsonProperty("BaseKubernetesList") - public void setBaseKubernetesList(KubernetesList baseKubernetesList) { - this.baseKubernetesList = baseKubernetesList; - } - - @JsonProperty("CreateOptions") - public CreateOptions getCreateOptions() { - return createOptions; - } - - @JsonProperty("CreateOptions") - public void setCreateOptions(CreateOptions createOptions) { - this.createOptions = createOptions; - } - - @JsonProperty("DeleteOptions") - public DeleteOptions getDeleteOptions() { - return deleteOptions; - } - - @JsonProperty("DeleteOptions") - public void setDeleteOptions(DeleteOptions deleteOptions) { - this.deleteOptions = deleteOptions; - } - - @JsonProperty("Eviction") - public io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction getEviction() { - return eviction; - } - - @JsonProperty("Eviction") - public void setEviction(io.fabric8.kubernetes.api.model.policy.v1beta1.Eviction eviction) { - this.eviction = eviction; - } - - @JsonProperty("GetOptions") - public GetOptions getGetOptions() { - return getOptions; - } - - @JsonProperty("GetOptions") - public void setGetOptions(GetOptions getOptions) { - this.getOptions = getOptions; - } - - @JsonProperty("Info") - public Info getInfo() { - return info; - } - - @JsonProperty("Info") - public void setInfo(Info info) { - this.info = info; - } - - @JsonProperty("ListOptions") - public ListOptions getListOptions() { - return listOptions; - } - - @JsonProperty("ListOptions") - public void setListOptions(ListOptions listOptions) { - this.listOptions = listOptions; - } - - @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("Patch") - public Patch getPatch() { - return patch; - } - - @JsonProperty("Patch") - public void setPatch(Patch patch) { - this.patch = patch; - } - - @JsonProperty("PatchOptions") - public PatchOptions getPatchOptions() { - return patchOptions; - } - - @JsonProperty("PatchOptions") - public void setPatchOptions(PatchOptions patchOptions) { - this.patchOptions = patchOptions; - } - - @JsonProperty("PodDisruptionBudget") - public io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget getPodDisruptionBudget() { - return podDisruptionBudget; - } - - @JsonProperty("PodDisruptionBudget") - public void setPodDisruptionBudget(io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget podDisruptionBudget) { - this.podDisruptionBudget = podDisruptionBudget; - } - - @JsonProperty("PodDisruptionBudgetList") - public io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList getPodDisruptionBudgetList() { - return podDisruptionBudgetList; - } - - @JsonProperty("PodDisruptionBudgetList") - public void setPodDisruptionBudgetList(io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList podDisruptionBudgetList) { - this.podDisruptionBudgetList = podDisruptionBudgetList; - } - - @JsonProperty("Quantity") - public Quantity getQuantity() { - return quantity; - } - - @JsonProperty("Quantity") - public void setQuantity(Quantity quantity) { - this.quantity = quantity; - } - - @JsonProperty("RootPaths") - public RootPaths getRootPaths() { - return rootPaths; - } - - @JsonProperty("RootPaths") - public void setRootPaths(RootPaths rootPaths) { - this.rootPaths = rootPaths; - } - - @JsonProperty("Status") - public Status getStatus() { - return status; - } - - @JsonProperty("Status") - public void setStatus(Status status) { - this.status = status; - } - - @JsonProperty("Time") - public String getTime() { - return time; - } - - @JsonProperty("Time") - public void setTime(String time) { - this.time = time; - } - - @JsonProperty("TypeMeta") - public TypeMeta getTypeMeta() { - return typeMeta; - } - - @JsonProperty("TypeMeta") - public void setTypeMeta(TypeMeta typeMeta) { - this.typeMeta = typeMeta; - } - - @JsonProperty("UpdateOptions") - public UpdateOptions getUpdateOptions() { - return updateOptions; - } - - @JsonProperty("UpdateOptions") - public void setUpdateOptions(UpdateOptions updateOptions) { - this.updateOptions = updateOptions; - } - - @JsonProperty("V1Eviction") - public io.fabric8.kubernetes.api.model.policy.v1.Eviction getV1Eviction() { - return v1Eviction; - } - - @JsonProperty("V1Eviction") - public void setV1Eviction(io.fabric8.kubernetes.api.model.policy.v1.Eviction v1Eviction) { - this.v1Eviction = v1Eviction; - } - - @JsonProperty("V1PodDisruptionBudget") - public io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget getV1PodDisruptionBudget() { - return v1PodDisruptionBudget; - } - - @JsonProperty("V1PodDisruptionBudget") - public void setV1PodDisruptionBudget(io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget v1PodDisruptionBudget) { - this.v1PodDisruptionBudget = v1PodDisruptionBudget; - } - - @JsonProperty("V1PodDisruptionBudgetList") - public io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList getV1PodDisruptionBudgetList() { - return v1PodDisruptionBudgetList; - } - - @JsonProperty("V1PodDisruptionBudgetList") - public void setV1PodDisruptionBudgetList(io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList v1PodDisruptionBudgetList) { - this.v1PodDisruptionBudgetList = v1PodDisruptionBudgetList; - } - - @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-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/Eviction.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/Eviction.java index 6f667231d25..13affd849f5 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/Eviction.java +++ b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/Eviction.java @@ -19,6 +19,7 @@ import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; import io.fabric8.kubernetes.api.model.Namespaced; +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 Eviction implements Editable , HasMetadata, Namesp @JsonProperty("kind") private String kind = "Eviction"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -95,7 +96,7 @@ public class Eviction implements Editable , HasMetadata, Namesp public Eviction() { } - public Eviction(String apiVersion, DeleteOptions deleteOptions, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata) { + public Eviction(String apiVersion, DeleteOptions deleteOptions, String kind, ObjectMeta metadata) { super(); this.apiVersion = apiVersion; this.deleteOptions = deleteOptions; @@ -154,12 +155,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-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudget.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudget.java index db73aa7ce56..aec7794dba8 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudget.java +++ b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudget.java @@ -18,6 +18,7 @@ import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; import io.fabric8.kubernetes.api.model.Namespaced; +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), @@ -82,7 +83,7 @@ public class PodDisruptionBudget implements Editable @JsonProperty("kind") private String kind = "PodDisruptionBudget"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonProperty("spec") private PodDisruptionBudgetSpec spec; @JsonProperty("status") @@ -97,7 +98,7 @@ public class PodDisruptionBudget implements Editable public PodDisruptionBudget() { } - public PodDisruptionBudget(String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, PodDisruptionBudgetSpec spec, PodDisruptionBudgetStatus status) { + public PodDisruptionBudget(String apiVersion, String kind, ObjectMeta metadata, PodDisruptionBudgetSpec spec, PodDisruptionBudgetStatus status) { super(); this.apiVersion = apiVersion; this.kind = kind; @@ -147,12 +148,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-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudgetSpec.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudgetSpec.java index 6a6f2aa998c..d1fd14eb1ce 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudgetSpec.java +++ b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1/PodDisruptionBudgetSpec.java @@ -13,7 +13,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; import io.fabric8.kubernetes.api.model.Container; +import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.KubernetesResource; +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; @@ -42,11 +44,11 @@ }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { @BuildableReference(ObjectMeta.class), - @BuildableReference(io.fabric8.kubernetes.api.model.LabelSelector.class), + @BuildableReference(LabelSelector.class), @BuildableReference(Container.class), @BuildableReference(PodTemplateSpec.class), @BuildableReference(ResourceRequirements.class), - @BuildableReference(io.fabric8.kubernetes.api.model.IntOrString.class), + @BuildableReference(IntOrString.class), @BuildableReference(ObjectReference.class), @BuildableReference(LocalObjectReference.class), @BuildableReference(PersistentVolumeClaim.class) @@ -56,11 +58,11 @@ public class PodDisruptionBudgetSpec implements Editable , HasMetadata, Namesp @JsonProperty("kind") private String kind = "Eviction"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonIgnore private Map additionalProperties = new LinkedHashMap(); @@ -95,7 +96,7 @@ public class Eviction implements Editable , HasMetadata, Namesp public Eviction() { } - public Eviction(String apiVersion, DeleteOptions deleteOptions, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata) { + public Eviction(String apiVersion, DeleteOptions deleteOptions, String kind, ObjectMeta metadata) { super(); this.apiVersion = apiVersion; this.deleteOptions = deleteOptions; @@ -154,12 +155,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-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudget.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudget.java index 220ecba33aa..2853647459c 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudget.java +++ b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudget.java @@ -18,6 +18,7 @@ import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LocalObjectReference; import io.fabric8.kubernetes.api.model.Namespaced; +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), @@ -82,7 +83,7 @@ public class PodDisruptionBudget implements Editable @JsonProperty("kind") private String kind = "PodDisruptionBudget"; @JsonProperty("metadata") - private io.fabric8.kubernetes.api.model.ObjectMeta metadata; + private ObjectMeta metadata; @JsonProperty("spec") private PodDisruptionBudgetSpec spec; @JsonProperty("status") @@ -97,7 +98,7 @@ public class PodDisruptionBudget implements Editable public PodDisruptionBudget() { } - public PodDisruptionBudget(String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, PodDisruptionBudgetSpec spec, PodDisruptionBudgetStatus status) { + public PodDisruptionBudget(String apiVersion, String kind, ObjectMeta metadata, PodDisruptionBudgetSpec spec, PodDisruptionBudgetStatus status) { super(); this.apiVersion = apiVersion; this.kind = kind; @@ -147,12 +148,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-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudgetSpec.java b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudgetSpec.java index f8dabf4603f..1a1e992a9a0 100644 --- a/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudgetSpec.java +++ b/kubernetes-model-generator/kubernetes-model-policy/src/generated/java/io/fabric8/kubernetes/api/model/policy/v1beta1/PodDisruptionBudgetSpec.java @@ -13,7 +13,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.fabric8.kubernetes.api.builder.Editable; import io.fabric8.kubernetes.api.model.Container; +import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.KubernetesResource; +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; @@ -31,8 +33,7 @@ @JsonPropertyOrder({ "maxUnavailable", "minAvailable", - "selector", - "unhealthyPodEvictionPolicy" + "selector" }) @ToString @EqualsAndHashCode @@ -42,11 +43,11 @@ }) @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { @BuildableReference(ObjectMeta.class), - @BuildableReference(io.fabric8.kubernetes.api.model.LabelSelector.class), + @BuildableReference(LabelSelector.class), @BuildableReference(Container.class), @BuildableReference(PodTemplateSpec.class), @BuildableReference(ResourceRequirements.class), - @BuildableReference(io.fabric8.kubernetes.api.model.IntOrString.class), + @BuildableReference(IntOrString.class), @BuildableReference(ObjectReference.class), @BuildableReference(LocalObjectReference.class), @BuildableReference(PersistentVolumeClaim.class) @@ -56,13 +57,11 @@ public class PodDisruptionBudgetSpec implements Editable additionalProperties = new LinkedHashMap(); @@ -73,54 +72,43 @@ public class PodDisruptionBudgetSpec implements Editable schemas) { openAPI.getComponents().setCallbacks(new HashMap<>()); openAPI.getComponents().setExtensions(new HashMap<>()); openAPI.setPaths(new Paths()); + int apiCounter = 0; for (OpenAPI currentApi : schemas) { - openAPI.getPaths().putAll(currentApi.getPaths()); + apiCounter++; + // Merge Paths + for (Map.Entry paths : currentApi.getPaths().entrySet()) { + // Let's preserve the existing paths in case multiple versions of the same schema are added + // This is necessary for proper computation of APIVersion for the components + // We do this bases in the paths instead of the x-kubernetes-group-version-kind extension of the component + // because it's the only way to figure out if the object is namespaced or cluster scoped + if (openAPI.getPaths().containsKey(paths.getKey())) { + openAPI.getPaths().addPathItem(paths.getKey() + "/" + apiCounter, paths.getValue()); + } else { + openAPI.getPaths().addPathItem(paths.getKey(), paths.getValue()); + } + } + // Merge components if (currentApi.getComponents() != null) { Optional.ofNullable(currentApi.getComponents().getSchemas()).ifPresent(openAPI.getComponents().getSchemas()::putAll); Optional.ofNullable(currentApi.getComponents().getResponses())