|
6 | 6 | import io.javaoperatorsdk.operator.processing.event.ResourceID;
|
7 | 7 |
|
8 | 8 | /**
|
9 |
| - * Primary to Secondary mapper only needed in some cases, typically when there is many-to-one or |
10 |
| - * many-to-many relation between primary and secondary resources. If there is owner reference (or |
11 |
| - * reference with annotations) from secondary to primary this is not needed. See |
12 |
| - * PrimaryToSecondaryIT integration tests that handles many-to-many relationship. |
| 9 | + * Identifies the set of secondary resources associated with a given primary resource. This is |
| 10 | + * typically needed when multiple secondary resources can be associated with one or several multiple |
| 11 | + * primary resources *without* a standard way (e.g. owner reference or annotations) to materialize |
| 12 | + * that relations. When owner references are present, a {@code PrimaryToSecondaryMapper} instance |
| 13 | + * should not be needed. In other words, associating such a mapper with your |
| 14 | + * {@link io.javaoperatorsdk.operator.api.config.informer.InformerConfiguration} is usually needed |
| 15 | + * when your secondary resources are referenced in some way by your primary resource but that this |
| 16 | + * link does not exist in the secondary resource information. The mapper implementation instructs |
| 17 | + * the SDK on how to find all the secondary resources associated with a given primary resource so |
| 18 | + * that this primary resource can properly be reconciled when changes impact the associated |
| 19 | + * secondary resources, even though these don't contain any information allowing to make such an |
| 20 | + * inference. |
| 21 | + * <p/> |
| 22 | + * This helps particularly in cases where several secondary resources, listed in some way in the |
| 23 | + * primary resource, need to or can be created before the primary resource exists. In that |
| 24 | + * situation, attempting to retrieve the associated secondary resources by calling |
| 25 | + * {@link io.javaoperatorsdk.operator.api.reconciler.Context#getSecondaryResource(Class)} would fail |
| 26 | + * without providing a mapper to tell JOSDK how to retrieve the secondary resources. |
| 27 | + * <p/> |
| 28 | + * You can see an example of this in action in the <a href= |
| 29 | + * "https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework/src/test/java/io/javaoperatorsdk/operator/sample/primarytosecondary/JobReconciler.java">Reconciler |
| 30 | + * for the PrimaryToSecondaryIT</a> integration tests that handles many-to-many relationship. |
13 | 31 | *
|
14 | 32 | * @param <P> primary resource type
|
15 | 33 | */
|
|
0 commit comments