Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Maksim Nabokikh <[email protected]>
  • Loading branch information
diafour and nabokihms authored Mar 18, 2021
1 parent 020ac6f commit 86f0304
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions HOOKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ If pod `pod-321d12` is then added into namespace 'default', then the hook will b

Shell-operator maintains an up-to-date list of objects for each `kubernetes` binding. `schedule` and `kubernetes` bindings can be configured to receive these lists via `includeSnapshotsFrom` parameter. Also, there is a `group` parameter to automatically receive all snapshots from multiple bindings and to deduplicate executions.

Snapshot is a JSON array of with Kubernetes objects and corresponding jqFilter results. To access the snapshot during the hook execution, there is a map `snapshots` in the binding context. The key of this map is a binding name and the value is the snapshot.
Snapshot is a JSON array of Kubernetes objects and corresponding jqFilter results. To access the snapshot during the hook execution, there is a map `snapshots` in the binding context. The key of this map is a binding name, and the value is the snapshot.

`snapshots` example:

Expand Down Expand Up @@ -674,9 +674,9 @@ Every 3 hours, the hook will be executed with the binding context that include 2

### Binding context of grouped bindings

`group` parameter defines a named group of bindings. Group is used when the source of event is not important and data in snapshots is enough for the hook. When binding with `group` is triggered with the event, the hook receives snapshots from all `kubernetes` bindings with the same `group` name.
`group` parameter defines a named group of bindings. Group is used when the source of the event is not important, and data in snapshots is enough for the hook. When binding with `group` is triggered with the event, the hook receives snapshots from all `kubernetes` bindings with the same `group` name.

Adjacent tasks for `kubernetes` and `schedule` bindings with the same `group` and `queue` are "compacted" and hook is executed only once. So it is wise to use the same `queue` for all hooks in a group. This "compaction" mechanism is not available for `kubernetesValidating` and `kubernetesCustomResourceConversion` bindings as they're not queued.
Adjacent tasks for `kubernetes` and `schedule` bindings with the same `group` and `queue` are "compacted", and the hook is executed only once. So it is wise to use the same `queue` for all hooks in a group. This "compaction" mechanism is not available for `kubernetesValidating` and `kubernetesCustomResourceConversion` bindings as they're not queued.

`executeHookOnSynchronization`, `executeHookOnEvent` and `keepFullObjectsInMemory` can be used with `group`. Their effects are as described above for non-grouped bindings.

Expand Down
4 changes: 0 additions & 4 deletions pkg/kube_events_manager/kube_events_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ func Test_FakeClient_CatchUpdates(t *testing.T) {
t.FailNow()
}

//mgr.Start()

fmt.Printf("mgr Started\n")

// First event — Synchronization, second and third are Event
eventCounter := 0
done := false
Expand Down

0 comments on commit 86f0304

Please sign in to comment.