Skip to content

Commit fefb3d7

Browse files
committed
grammar fixes
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 0664b6d commit fefb3d7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/content/en/docs/documentation/access-resources.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 48
44
---
55

66
As described in [Event sources and related topics](eventing.md) event sources are the backbone
7-
for caching resources and triggering the reconciliation for primary resources thar are related
7+
for caching resources and triggering the reconciliation for primary resources that are related
88
to cached resources.
99

1010
In Kubernetes world, the component that does this is called Informer. Without going into
@@ -23,25 +23,25 @@ The purpose of such wrapping is to add additional capabilities required for cont
2323
(In general, Informers are not used only for implementing controllers).
2424

2525
Such capabilities are:
26-
- maintaining and index to which primary are the secondary resources in informer cache are related to.
26+
- maintaining an index to which primary resources the secondary resources in informer cache are related to.
2727
- setting up multiple informers for the same type if needed. You need informer per namespace if the informer
2828
is not watching the whole cluster.
2929
- Dynamically adding/removing watched namespaces.
30-
- Some others, what is out of the scope of this document.
30+
- Some others, which are out of the scope of this document.
3131

3232
### Associating Secondary Resources to Primary Resource
3333

34-
The question is, how to trigger reconciliation of a primary resources (your custom resource),
34+
The question is, how to trigger reconciliation of a primary resource (your custom resource),
3535
when Informer receives a new resource.
3636
For this purpose the framework uses [`SecondaryToPrimaryMapper`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/SecondaryToPrimaryMapper.java)
3737
that tells (usually) based on the resource which primary resource reconciliation to trigger.
3838
The mapping is usually done based on the owner reference or annotation on the secondary resource.
3939
(But not always, as we will see)
4040

4141
It is important to realize that if a resource triggers the reconciliation of a primary resource, that
42-
resource naturally will be used during reconciliation. So the reconciler will need to access them.
43-
Therefore, InformerEventSource maintains a revers index [PrimaryToSecondaryIndex](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/DefaultPrimaryToSecondaryIndex.java),
44-
based on the result of the `SecondaryToPrimaryMapper`result.
42+
resource naturally will be used during reconciliation. So the reconciler will need to access it.
43+
Therefore, InformerEventSource maintains a reverse index [PrimaryToSecondaryIndex](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/DefaultPrimaryToSecondaryIndex.java),
44+
based on the result of the `SecondaryToPrimaryMapper`.
4545

4646
## Unified API for Related Resources
4747

@@ -56,7 +56,7 @@ That will list all the related resources of a certain type, based on the `Inform
5656
Based on that index, it reads the resources from the Informers cache. Note that since all those steps work
5757
on top of indexes, those operations are very fast, usually O(1).
5858

59-
We mostly talk about InformerEventSource, but this works in similar ways for generalized EventSources concept, since
59+
We mostly talk about InformerEventSource, but this works in similar ways for the generalized EventSources concept, since
6060
the [`EventSource`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/EventSource.java#L93)
6161
actually implements the `Set<R> getSecondaryResources(P primary);` method. That is just called from the context.
6262

@@ -106,7 +106,7 @@ called and which usually have an owner reference pointing to the primary (and, t
106106
cover `related` resources (which might or might not be managed by Kubernetes) that serve as input for reconciliations.
107107

108108
There are cases where the SDK needs more information than what is readily available, in particular when some of these
109-
secondary resources do not have owner references or anything direct link to the primary resource they are associated
109+
secondary resources do not have owner references or any direct link to the primary resource they are associated
110110
with.
111111

112112
As an example we provide, consider a `Job` primary resource which can be assigned to run on a cluster, represented by a
@@ -128,13 +128,13 @@ InformerEventSourceConfiguration
128128
.collect(Collectors.toSet()))
129129
```
130130

131-
This will trigger all the related `Jobs` if the related cluster changes. Also, the maintaining the `PrimaryToSecondaryIndex`.
131+
This will trigger all the related `Jobs` if the related cluster changes. Also, it maintains the `PrimaryToSecondaryIndex`.
132132
So we can use the `getSecondaryResources` in the `Job` reconciler to access the cluster.
133-
However, there is an issue, what if now there is a new `Job` created? The new job does not propagate
133+
However, there is an issue: what if a new `Job` is created? The new job does not propagate
134134
automatically to `PrimaryToSecondaryIndex` in the `InformerEventSource` of the `Cluster`. That re-indexing
135-
happens where there is an event received for the `Cluster` and triggers all the `Jobs` again.
136-
Until that would happen again you could not use `getSecondaryResources` for the new `Job`, since the new
137-
job won't bre present in the reverse index.
135+
happens when there is an event received for the `Cluster` and triggers all the `Jobs` again.
136+
Until that happens again you could not use `getSecondaryResources` for the new `Job`, since the new
137+
job won't be present in the reverse index.
138138

139139
You could access the Cluster directly from cache though in the reconciler:
140140

@@ -171,7 +171,7 @@ context.getPrimaryCache()
171171
```
172172

173173
This can be inefficient in case there is a large number of primary (Job) resources. To make it more efficient, we can
174-
create an index in the underlying Informer, that indexed the target jobs for a cluster:
174+
create an index in the underlying Informer that indexes the target jobs for a cluster:
175175

176176
```java
177177

0 commit comments

Comments
 (0)