File tree Expand file tree Collapse file tree 4 files changed +65
-17
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler Expand file tree Collapse file tree 4 files changed +65
-17
lines changed Original file line number Diff line number Diff line change
1
+ package io .javaoperatorsdk .operator .api .reconciler ;
2
+
3
+ import io .fabric8 .kubernetes .api .model .HasMetadata ;
4
+ import io .javaoperatorsdk .operator .api .config .ControllerConfiguration ;
5
+ import io .javaoperatorsdk .operator .processing .event .EventSourceRetriever ;
6
+ import io .javaoperatorsdk .operator .processing .event .source .IndexerResourceCache ;
7
+
8
+ import java .util .Optional ;
9
+ import java .util .Set ;
10
+ import java .util .stream .Stream ;
11
+
12
+ public interface CacheAware <P extends HasMetadata > {
13
+ default <R > Optional <R > getSecondaryResource (Class <R > expectedType ) {
14
+ return getSecondaryResource (expectedType , null );
15
+ }
16
+
17
+ <R > Set <R > getSecondaryResources (Class <R > expectedType );
18
+
19
+ default <R > Stream <R > getSecondaryResourcesAsStream (Class <R > expectedType ) {
20
+ return getSecondaryResources (expectedType ).stream ();
21
+ }
22
+
23
+ <R > Optional <R > getSecondaryResource (Class <R > expectedType , String eventSourceName );
24
+
25
+ ControllerConfiguration <P > getControllerConfiguration ();
26
+
27
+ /**
28
+ * Retrieves the primary resource.
29
+ *
30
+ * @return the primary resource associated with the current reconciliation
31
+ */
32
+ P getPrimaryResource ();
33
+
34
+ /**
35
+ * Retrieves the primary resource cache.
36
+ *
37
+ * @return the {@link IndexerResourceCache} associated with the associated {@link Reconciler} for
38
+ * this context
39
+ */
40
+ @ SuppressWarnings ("unused" )
41
+ IndexedResourceCache <P > getPrimaryCache ();
42
+
43
+ EventSourceRetriever <P > eventSourceRetriever ();
44
+ }
Original file line number Diff line number Diff line change 12
12
import io .javaoperatorsdk .operator .processing .event .EventSourceRetriever ;
13
13
import io .javaoperatorsdk .operator .processing .event .source .IndexerResourceCache ;
14
14
15
- public interface Context <P extends HasMetadata > {
15
+ public interface Context <P extends HasMetadata > extends CacheAware < P > {
16
16
17
17
Optional <RetryInfo > getRetryInfo ();
18
18
19
- default <R > Optional <R > getSecondaryResource (Class <R > expectedType ) {
20
- return getSecondaryResource (expectedType , null );
21
- }
22
-
23
- <R > Set <R > getSecondaryResources (Class <R > expectedType );
24
-
25
- default <R > Stream <R > getSecondaryResourcesAsStream (Class <R > expectedType ) {
26
- return getSecondaryResources (expectedType ).stream ();
27
- }
28
-
29
- <R > Optional <R > getSecondaryResource (Class <R > expectedType , String eventSourceName );
30
-
31
- ControllerConfiguration <P > getControllerConfiguration ();
32
-
33
19
/**
34
20
* Retrieve the {@link ManagedWorkflowAndDependentResourceContext} used to interact with {@link
35
21
* io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource}s and associated {@link
@@ -39,8 +25,6 @@ default <R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType) {
39
25
*/
40
26
ManagedWorkflowAndDependentResourceContext managedWorkflowAndDependentResourceContext ();
41
27
42
- EventSourceRetriever <P > eventSourceRetriever ();
43
-
44
28
KubernetesClient getClient ();
45
29
46
30
/** ExecutorService initialized by framework for workflows. Used for workflow standalone mode. */
Original file line number Diff line number Diff line change
1
+ package io .javaoperatorsdk .operator .api .reconciler .expectation ;
2
+
3
+ import io .fabric8 .kubernetes .api .model .HasMetadata ;
4
+
5
+ import java .time .Duration ;
6
+
7
+ public interface Expectation <P extends HasMetadata > {
8
+
9
+ boolean isMet (P primary , ExpectationContext <P > context );
10
+
11
+ Duration timeout ();
12
+ }
Original file line number Diff line number Diff line change
1
+ package io .javaoperatorsdk .operator .api .reconciler .expectation ;
2
+
3
+ import io .fabric8 .kubernetes .api .model .HasMetadata ;
4
+ import io .javaoperatorsdk .operator .api .reconciler .CacheAware ;
5
+
6
+ public interface ExpectationContext <P extends HasMetadata > extends CacheAware <P > {
7
+
8
+ }
You can’t perform that action at this time.
0 commit comments