Skip to content

Commit 8b726b0

Browse files
committed
Added explanatory note about the index
1 parent 05e5d70 commit 8b726b0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/book/src/cronjob-tutorial/testdata/project/controllers/cronjob_controller.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,19 @@ func (r *CronJobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
124124
}
125125

126126
/*
127+
128+
<aside class="note">
129+
130+
<h1>What is this index about?</h1>
131+
132+
<p>The reconciler fetches all jobs owned by the cronjob for the status. As our number of cronjobs increases,
133+
looking these up can become quite slow as we have to filter through all of them. For a more efficient lookup,
134+
these jobs will be indexed locally on the controller's name. A jobOwnerKey field is added to the
135+
cached job objects. This key references the owning controller and functions as the index. Later in this
136+
document we will configure the manager to actually index this field.</p>
137+
138+
</aside>
139+
127140
Once we have all the jobs we own, we'll split them into active, successful,
128141
and failed jobs, keeping track of the most recent run so that we can record it
129142
in status. Remember, status should be able to be reconstituted from the state

0 commit comments

Comments
 (0)