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 1212import io .javaoperatorsdk .operator .processing .event .EventSourceRetriever ;
1313import io .javaoperatorsdk .operator .processing .event .source .IndexerResourceCache ;
1414
15- public interface Context <P extends HasMetadata > {
15+ public interface Context <P extends HasMetadata > extends CacheAware < P > {
1616
1717 Optional <RetryInfo > getRetryInfo ();
1818
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-
3319 /**
3420 * Retrieve the {@link ManagedWorkflowAndDependentResourceContext} used to interact with {@link
3521 * io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource}s and associated {@link
@@ -39,8 +25,6 @@ default <R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType) {
3925 */
4026 ManagedWorkflowAndDependentResourceContext managedWorkflowAndDependentResourceContext ();
4127
42- EventSourceRetriever <P > eventSourceRetriever ();
43-
4428 KubernetesClient getClient ();
4529
4630 /** 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