1
1
package io .javaoperatorsdk .quarkus .extension ;
2
2
3
3
import io .fabric8 .kubernetes .client .CustomResource ;
4
- import io .javaoperatorsdk .operator .api .config .ControllerConfiguration ;
4
+ import io .javaoperatorsdk .operator .api .config .AbstractControllerConfiguration ;
5
5
import io .javaoperatorsdk .operator .api .config .RetryConfiguration ;
6
6
import io .quarkus .runtime .annotations .RecordableConstructor ;
7
7
import java .util .Collections ;
8
8
import java .util .Set ;
9
9
10
10
public class QuarkusControllerConfiguration <R extends CustomResource >
11
- implements ControllerConfiguration <R > {
12
- private final String associatedControllerClassName ;
13
- private final String name ;
14
- private final String crdName ;
15
- private final String finalizer ;
16
- private final boolean generationAware ;
17
- private final Set <String > namespaces ;
11
+ extends AbstractControllerConfiguration <R > {
12
+
18
13
private final String crClass ;
19
- private final boolean watchAllNamespaces ;
20
- private final RetryConfiguration retryConfiguration ;
14
+ private Class <R > clazz ;
21
15
22
16
@ RecordableConstructor
23
17
public QuarkusControllerConfiguration (
@@ -29,18 +23,15 @@ public QuarkusControllerConfiguration(
29
23
Set <String > namespaces ,
30
24
String crClass ,
31
25
RetryConfiguration retryConfiguration ) {
32
- this .associatedControllerClassName = associatedControllerClassName ;
33
- this .name = name ;
34
- this .crdName = crdName ;
35
- this .finalizer = finalizer ;
36
- this .generationAware = generationAware ;
37
- this .namespaces = namespaces ;
26
+ super (
27
+ associatedControllerClassName ,
28
+ name ,
29
+ crdName ,
30
+ finalizer ,
31
+ generationAware ,
32
+ namespaces ,
33
+ retryConfiguration );
38
34
this .crClass = crClass ;
39
- this .watchAllNamespaces = this .namespaces .contains (WATCH_ALL_NAMESPACES_MARKER );
40
- this .retryConfiguration =
41
- retryConfiguration == null
42
- ? ControllerConfiguration .super .getRetryConfiguration ()
43
- : retryConfiguration ;
44
35
}
45
36
46
37
public static Set <String > asSet (String [] namespaces ) {
@@ -59,29 +50,12 @@ public String getCrClass() {
59
50
return crClass ;
60
51
}
61
52
62
- @ Override
63
- public String getName () {
64
- return name ;
65
- }
66
-
67
- @ Override
68
- public String getCRDName () {
69
- return crdName ;
70
- }
71
-
72
- @ Override
73
- public String getFinalizer () {
74
- return finalizer ;
75
- }
76
-
77
- @ Override
78
- public boolean isGenerationAware () {
79
- return generationAware ;
80
- }
81
-
82
53
@ Override
83
54
public Class <R > getCustomResourceClass () {
84
- return (Class <R >) loadClass (crClass );
55
+ if (clazz == null ) {
56
+ clazz = (Class <R >) loadClass (crClass );
57
+ }
58
+ return clazz ;
85
59
}
86
60
87
61
BE52
private Class <?> loadClass (String className ) {
@@ -91,24 +65,4 @@ private Class<?> loadClass(String className) {
91
65
throw new IllegalArgumentException ("Couldn't find class " + className );
92
66
}
93
67
}
94
-
95
- @ Override
96
- public String getAssociatedControllerClassName () {
97
- return associatedControllerClassName ;
98
- }
99
-
100
- @ Override
101
- public Set <String > getNamespaces () {
102
- return namespaces ;
103
- }
104
-
105
- @ Override
106
- public boolean watchAllNamespaces () {
107
- return watchAllNamespaces ;
108
- }
109
-
110
- @ Override
111
- public RetryConfiguration getRetryConfiguration () {
112
- return retryConfiguration ;
113
- }
114
68
}
0 commit comments