Skip to content

Commit 5605022

Browse files
committed
feat: support cluster scoped and different namespace resources
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 58e2a38 commit 5605022

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/main/java/io/csviri/operator/glue/customresource/glue/DependentResourceSpec.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ public class DependentResourceSpec {
1414
@Required
1515
private String name;
1616

17-
private String resourceTemplate;
17+
private boolean clusterScoped = Boolean.FALSE;
1818

1919
@PreserveUnknownFields
2020
private GenericKubernetesResource resource;
2121

22+
private String resourceTemplate;
23+
2224
private List<String> dependsOn = new ArrayList<>();
2325

2426
@PreserveUnknownFields
@@ -82,22 +84,32 @@ public DependentResourceSpec setResourceTemplate(String resourceTemplate) {
8284
return this;
8385
}
8486

87+
public boolean isClusterScoped() {
88+
return clusterScoped;
89+
}
90+
91+
public void setClusterScoped(boolean clusterScoped) {
92+
this.clusterScoped = clusterScoped;
93+
}
94+
8595
@Override
8696
public boolean equals(Object o) {
8797
if (this == o)
8898
return true;
8999
if (o == null || getClass() != o.getClass())
90100
return false;
91101
DependentResourceSpec that = (DependentResourceSpec) o;
92-
return Objects.equals(name, that.name)
102+
return clusterScoped == that.clusterScoped && Objects.equals(name, that.name)
103+
&& Objects.equals(resource, that.resource)
93104
&& Objects.equals(resourceTemplate, that.resourceTemplate)
94-
&& Objects.equals(resource, that.resource) && Objects.equals(dependsOn, that.dependsOn)
105+
&& Objects.equals(dependsOn, that.dependsOn)
95106
&& Objects.equals(readyPostCondition, that.readyPostCondition)
96107
&& Objects.equals(condition, that.condition);
97108
}
98109

99110
@Override
100111
public int hashCode() {
101-
return Objects.hash(name, resourceTemplate, resource, dependsOn, readyPostCondition, condition);
112+
return Objects.hash(name, clusterScoped, resource, resourceTemplate, dependsOn,
113+
readyPostCondition, condition);
102114
}
103115
}

src/main/java/io/csviri/operator/glue/customresource/glue/RelatedResourceSpec.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class RelatedResourceSpec {
1515
private String apiVersion;
1616
@Required
1717
private String kind;
18+
private boolean clusterScoped = Boolean.FALSE;
1819
private String namespace;
1920
private List<String> resourceNames;
2021

@@ -71,13 +72,22 @@ public boolean equals(Object o) {
7172
if (o == null || getClass() != o.getClass())
7273
return false;
7374
RelatedResourceSpec that = (RelatedResourceSpec) o;
74-
return Objects.equals(name, that.name) && Objects.equals(apiVersion, that.apiVersion)
75-
&& Objects.equals(kind, that.kind) && Objects.equals(namespace, that.namespace)
75+
return clusterScoped == that.clusterScoped && Objects.equals(name, that.name)
76+
&& Objects.equals(apiVersion, that.apiVersion) && Objects.equals(kind, that.kind)
77+
&& Objects.equals(namespace, that.namespace)
7678
&& Objects.equals(resourceNames, that.resourceNames);
7779
}
7880

7981
@Override
8082
public int hashCode() {
81-
return Objects.hash(name, apiVersion, kind, namespace, resourceNames);
83+
return Objects.hash(name, apiVersion, kind, clusterScoped, namespace, resourceNames);
84+
}
85+
86+
public boolean isClusterScoped() {
87+
return clusterScoped;
88+
}
89+
90+
public void setClusterScoped(boolean clusterScoped) {
91+
this.clusterScoped = clusterScoped;
8292
}
8393
}

0 commit comments

Comments
 (0)