Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: kubernetes-model-rbac generated from OpenAPI schemas #6173

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ generate-openapi-classes:
cd kubernetes-model-generator/kubernetes-model-common && mvn clean install
cd kubernetes-model-generator/openapi/maven-plugin && mvn clean verify
cd kubernetes-model-generator/kubernetes-model-core && mvn -Pgenerate clean install
cd kubernetes-model-generator/kubernetes-model-rbac && mvn -Pgenerate clean install

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

# Array for all existing modules
declare -a modules=(
"kubernetes-model-rbac"
"kubernetes-model-admissionregistration"
"kubernetes-model-apiextensions"
"kubernetes-model-apps"
Expand Down
27 changes: 0 additions & 27 deletions kubernetes-model-generator/kubernetes-model-rbac/Makefile

This file was deleted.

This file was deleted.

34 changes: 15 additions & 19 deletions kubernetes-model-generator/kubernetes-model-rbac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,27 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<configuration>
<skipAttach>false</skipAttach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>generate</id>
<build>
<plugins>
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>openapi-model-generator-maven-plugin</artifactId>
<configuration >
<settings combine.self="append">
<schemas>
<schema>${project.basedir}/../openapi/schemas/kubernetes-1.30.0.json</schema>
</schemas>
<packageMappings combine.self="append">
<io.k8s.api.rbac.v1>io.fabric8.kubernetes.api.model.rbac</io.k8s.api.rbac.v1>
</packageMappings>
<includeGenerationRegexes>
<includeGenerationRegex>^io\.k8s\.api\.rbac\..*$</includeGenerationRegex>
</includeGenerationRegexes>
</settings>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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;
Expand All @@ -42,7 +43,7 @@
})
@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),
Expand All @@ -57,7 +58,7 @@ public class AggregationRule implements Editable<AggregationRuleBuilder> , Kuber

@JsonProperty("clusterRoleSelectors")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<io.fabric8.kubernetes.api.model.LabelSelector> clusterRoleSelectors = new ArrayList<>();
private List<LabelSelector> clusterRoleSelectors = new ArrayList<>();
@JsonIgnore
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();

Expand All @@ -68,19 +69,19 @@ public class AggregationRule implements Editable<AggregationRuleBuilder> , Kuber
public AggregationRule() {
}

public AggregationRule(List<io.fabric8.kubernetes.api.model.LabelSelector> clusterRoleSelectors) {
public AggregationRule(List<LabelSelector> clusterRoleSelectors) {
super();
this.clusterRoleSelectors = clusterRoleSelectors;
}

@JsonProperty("clusterRoleSelectors")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public List<io.fabric8.kubernetes.api.model.LabelSelector> getClusterRoleSelectors() {
public List<LabelSelector> getClusterRoleSelectors() {
return clusterRoleSelectors;
}

@JsonProperty("clusterRoleSelectors")
public void setClusterRoleSelectors(List<io.fabric8.kubernetes.api.model.LabelSelector> clusterRoleSelectors) {
public void setClusterRoleSelectors(List<LabelSelector> clusterRoleSelectors) {
this.clusterRoleSelectors = clusterRoleSelectors;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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;
Expand Down Expand Up @@ -49,7 +50,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),
Expand Down Expand Up @@ -85,7 +86,7 @@ public class ClusterRole implements Editable<ClusterRoleBuilder> , HasMetadata
@JsonProperty("kind")
private String kind = "ClusterRole";
@JsonProperty("metadata")
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
private ObjectMeta metadata;
@JsonProperty("rules")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<PolicyRule> rules = new ArrayList<>();
Expand All @@ -99,7 +100,7 @@ public class ClusterRole implements Editable<ClusterRoleBuilder> , HasMetadata
public ClusterRole() {
}

public ClusterRole(AggregationRule aggregationRule, String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, List<PolicyRule> rules) {
public ClusterRole(AggregationRule aggregationRule, String apiVersion, String kind, ObjectMeta metadata, List<PolicyRule> rules) {
super();
this.aggregationRule = aggregationRule;
this.apiVersion = apiVersion;
Expand Down Expand Up @@ -159,12 +160,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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;
Expand Down Expand Up @@ -49,7 +50,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),
Expand Down Expand Up @@ -83,7 +84,7 @@ public class ClusterRoleBinding implements Editable<ClusterRoleBindingBuilder> ,
@JsonProperty("kind")
private String kind = "ClusterRoleBinding";
@JsonProperty("metadata")
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
private ObjectMeta metadata;
@JsonProperty("roleRef")
private RoleRef roleRef;
@JsonProperty("subjects")
Expand All @@ -99,7 +100,7 @@ public class ClusterRoleBinding implements Editable<ClusterRoleBindingBuilder> ,
public ClusterRoleBinding() {
}

public ClusterRoleBinding(String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, RoleRef roleRef, List<Subject> subjects) {
public ClusterRoleBinding(String apiVersion, String kind, ObjectMeta metadata, RoleRef roleRef, List<Subject> subjects) {
super();
this.apiVersion = apiVersion;
this.kind = kind;
Expand Down Expand Up @@ -149,12 +150,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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;
Expand Down Expand Up @@ -49,7 +50,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),
Expand Down Expand Up @@ -83,7 +84,7 @@ public class Role implements Editable<RoleBuilder> , HasMetadata, Namespaced
@JsonProperty("kind")
private String kind = "Role";
@JsonProperty("metadata")
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
private ObjectMeta metadata;
@JsonProperty("rules")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<PolicyRule> rules = new ArrayList<>();
Expand All @@ -97,7 +98,7 @@ public class Role implements Editable<RoleBuilder> , HasMetadata, Namespaced
public Role() {
}

public Role(String apiVersion, String kind, io.fabric8.kubernetes.api.model.ObjectMeta metadata, List<PolicyRule> rules) {
public Role(String apiVersion, String kind, ObjectMeta metadata, List<PolicyRule> rules) {
super();
this.apiVersion = apiVersion;
this.kind = kind;
Expand Down Expand Up @@ -146,12 +147,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;
}

Expand Down
Loading
Loading