Skip to content

Commit db7ac34

Browse files
committed
feat(native): wrap config so that we don't serialize CR class
This is required to avoid having to register Jackson's ClassSerializer class, not to mention the fact that it really doesn't make sense to serialize the class in the first place.
1 parent 04334ef commit db7ac34

File tree

1 file changed

+56
-3
lines changed
  • operator-framework-quarkus-extension/tests/src/main/java/io/javaoperatorsdk/quarkus/it

1 file changed

+56
-3
lines changed

operator-framework-quarkus-extension/tests/src/main/java/io/javaoperatorsdk/quarkus/it/TestOperatorApp.java

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import io.javaoperatorsdk.operator.api.config.ConfigurationService;
44
import io.javaoperatorsdk.operator.api.config.ControllerConfiguration;
5+
import io.javaoperatorsdk.operator.api.config.RetryConfiguration;
6+
import java.util.Set;
57
import javax.inject.Inject;
68
import javax.ws.rs.GET;
79
import javax.ws.rs.Path;
@@ -22,8 +24,59 @@ public boolean getController(@PathParam("name") String name) {
2224

2325
@GET
2426
@Path("{name}/config")
25-
public ControllerConfiguration getConfig(@PathParam("name") String name) {
26-
final var config = configurationService.getConfigurationFor(controller);
27-
return name.equals(config.getName()) ? config : null;
27+
public JSONControllerConfiguration getConfig(@PathParam("name") String name) {
28+
var config = configurationService.getConfigurationFor(controller);
29+
if (config == null) {
30+
return null;
31+
}
32+
return name.equals(config.getName()) ? new JSONControllerConfiguration(config) : null;
33+
}
34+
35+
static class JSONControllerConfiguration {
36+
private final ControllerConfiguration conf;
37+
38+
public JSONControllerConfiguration(ControllerConfiguration conf) {
39+
this.conf = conf;
40+
}
41+
42+
public String getName() {
43+
return conf.getName();
44+
}
45+
46+
public String getCRDName() {
47+
return conf.getCRDName();
48+
}
49+
50+
public String getFinalizer() {
51+
return conf.getFinalizer();
52+
}
53+
54+
public boolean isGenerationAware() {
55+
return conf.isGenerationAware();
56+
}
57+
58+
public String getCustomResourceClass() {
59+
return conf.getCustomResourceClass().getCanonicalName();
60+
}
61+
62+
public String getAssociatedControllerClassName() {
63+
return conf.getAssociatedControllerClassName();
64+
}
65+
66+
public boolean isClusterScoped() {
67+
return conf.isClusterScoped();
68+
}
69+
70+
public Set<String> getNamespaces() {
71+
return conf.getNamespaces();
72+
}
73+
74+
public boolean watchAllNamespaces() {
75+
return conf.watchAllNamespaces();
76+
}
77+
78+
public RetryConfiguration getRetryConfiguration() {
79+
return conf.getRetryConfiguration();
80+
}
2881
}
2982
}

0 commit comments

Comments
 (0)