Skip to content

Commit 90cc2bf

Browse files
committed
feat: add DependentResourceConfiguration annotation
1 parent 83ad830 commit 90cc2bf

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/DependentResourceConfiguration.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package io.javaoperatorsdk.operator.api.config;
22

3+
import static io.javaoperatorsdk.operator.api.reconciler.DependentResourceConfiguration.CREATABLE_DEFAULT;
4+
import static io.javaoperatorsdk.operator.api.reconciler.DependentResourceConfiguration.OWNED_DEFAULT;
5+
import static io.javaoperatorsdk.operator.api.reconciler.DependentResourceConfiguration.UPDATABLE_DEFAULT;
6+
37
import java.util.Set;
48
import java.util.function.Function;
59

@@ -11,15 +15,15 @@ public interface DependentResourceConfiguration<R extends HasMetadata>
1115
extends ResourceConfiguration<R, DependentResourceConfiguration<R>> {
1216

1317
default boolean creatable() {
14-
return true;
18+
return CREATABLE_DEFAULT;
1519
}
1620

1721
default boolean updatable() {
18-
return false;
22+
return UPDATABLE_DEFAULT;
1923
}
2024

2125
default boolean owned() {
22-
return true;
26+
return OWNED_DEFAULT;
2327
}
2428

2529
default Function<R, Set<ResourceID>> getSecondaryToPrimaryResourcesMapper() {

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@
6868
*
6969
* @return the list of {@link DependentResource} implementations
7070
*/
71-
Class<? extends DependentResource>[] dependents() default {};
71+
DependentResourceConfiguration[] dependents() default {};
7272
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.javaoperatorsdk.operator.api.reconciler;
2+
3+
import io.fabric8.kubernetes.api.model.HasMetadata;
4+
5+
public @interface DependentResourceConfiguration {
6+
boolean CREATABLE_DEFAULT = true;
7+
boolean UPDATABLE_DEFAULT = false;
8+
boolean OWNED_DEFAULT = true;
9+
10+
boolean creatable() default CREATABLE_DEFAULT;
11+
12+
boolean updatable() default UPDATABLE_DEFAULT;
13+
14+
boolean owned() default OWNED_DEFAULT;
15+
16+
Class<? extends DependentResource<? extends HasMetadata>> impl();
17+
}

0 commit comments

Comments
 (0)