-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Document about Informers and Listers #2579
Add Document about Informers and Listers #2579
Conversation
/assign @pooneh-m |
Build Succeeded 👏 Build Id: 9a07247d-3160-41e0-a5c8-8163c97fbe71 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Succeeded 👏 Build Id: 53da8dc4-ba66-42f5-a782-52b2a2e52495 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this - I suggested some changes of english - let me know what you think.
@@ -134,6 +134,131 @@ kubectl logs create-gs-6wz86-7qsm5 --namespace agones-system | |||
``` | |||
You have just created a GameServer using Kubernetes Go Client. | |||
|
|||
## What are Informers and Listers? How can I use these? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## What are Informers and Listers? How can I use these? | |
## Best Practice: Using Informers and Listers |
Informers and Listers are mechanism for Kubernetes. | ||
Almost all of the native Kubernetes controllers and custom controllers use these mechanisms. | ||
Kubernetes's control plane can be accessed via Kubernetes APIs, however, | ||
the load for control plane cannot be ignored when the client program accesses to the control plane every time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Informers and Listers are mechanism for Kubernetes. | |
Almost all of the native Kubernetes controllers and custom controllers use these mechanisms. | |
Kubernetes's control plane can be accessed via Kubernetes APIs, however, | |
the load for control plane cannot be ignored when the client program accesses to the control plane every time. | |
Almost all Kubernetes' controllers and custom controllers utilise `Informers` and `Listers` to reduce the load on the. | |
Kubernetes's control plane. | |
Repetitive, direct access of the Kubernetes control plane API can significantly reduce the performance of the cluster -- and Informers and Listers help resolving that issue. |
Informers and Listers can reduce the load for the control plane by using the in-memory-cache. | ||
When Informes and Listers are created, the in-memory-cache called as the store are also created. | ||
The client program accesses and queries to the in-memory-cache, not control plane, | ||
which enables reducing the load. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Informers and Listers can reduce the load for the control plane by using the in-memory-cache. | |
When Informes and Listers are created, the in-memory-cache called as the store are also created. | |
The client program accesses and queries to the in-memory-cache, not control plane, | |
which enables reducing the load. | |
Informers and Listers reduce the load on the Kubernetes control plane by creating, using and maintaining and eventually consistent an in-memory-cache. This can be watched and also queried with zero cost, since it will only read against its in-memory model of the Kubernetes resources. |
The Informer is the mechanism for watching Kubernetes object's event. | ||
When the Kubernetes objects changes(e.g. CREATE,UPDATE,DELETE), the `Event` object will create. | ||
The Informer lists and watches the object's changes through `Event` from the control plane. | ||
When the `Event` happens, the informer will watch it and store objects to the in-memory-cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Informer is the mechanism for watching Kubernetes object's event. | |
When the Kubernetes objects changes(e.g. CREATE,UPDATE,DELETE), the `Event` object will create. | |
The Informer lists and watches the object's changes through `Event` from the control plane. | |
When the `Event` happens, the informer will watch it and store objects to the in-memory-cache. | |
The Informer is the mechanism for watching a Kubernetes object's event. | |
When the Kubernetes objects changes(e.g. CREATE,UPDATE,DELETE), the Informer is informed, and can execute a callback with the relevant object as an argument. | |
This can be very useful for building event based systems against the Kubernetes API. |
Changed the wording here, since it's not an Event object - it's the actual resource object that comes through.
The Lister is the mechanism for listing Kubernetes object's. | ||
Users can list the Kubernetes objects by using Kubernetes APIs, however, | ||
if users use List API, it causes the load for the control plane. | ||
The Informer stores the cache of the object to the in-memory-cache. | ||
If users use the in-memory-cache, the load can be avoidable. | ||
The Lister provides the list method while using the in-memory-cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Lister is the mechanism for listing Kubernetes object's. | |
Users can list the Kubernetes objects by using Kubernetes APIs, however, | |
if users use List API, it causes the load for the control plane. | |
The Informer stores the cache of the object to the in-memory-cache. | |
If users use the in-memory-cache, the load can be avoidable. | |
The Lister provides the list method while using the in-memory-cache. | |
The Lister is the mechanism for querying Kubernetes object's against the client side in-memory cache. | |
Users can list the Kubernetes objects by using Kubernetes APIs, however, | |
if users do so, it places load on the Kubernetes control plane. | |
Since an Lister stores objects in an in-memory cache, queries against a come at practically no cost. |
Thank you for your review. Thank you! |
Build Succeeded 👏 Build Id: 3b75e8a8-8664-473e-82bd-97659b1c5d7d The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just doing another read through - found some typos, and some places I think can be tightened up. Please take a look!
reduce the performance of the cluster -- and Informers and Listers help resolving that issue. | ||
|
||
Informers and Listers reduce the load on the Kubernetes control plane | ||
by creating, using and maintaining and eventually consistent an in-memory-cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by creating, using and maintaining and eventually consistent an in-memory-cache. | |
by creating, using and maintaining an eventually consistent an in-memory cache. |
The Informer is the mechanism for watching a Kubernetes object's event. | ||
|
||
When the Kubernetes objects changes(e.g. CREATE,UPDATE,DELETE), the Informer is informed, | ||
and can execute a callback with the relevant object as an argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Informer is the mechanism for watching a Kubernetes object's event. | |
When the Kubernetes objects changes(e.g. CREATE,UPDATE,DELETE), the Informer is informed, | |
and can execute a callback with the relevant object as an argument. | |
An Informer is the mechanism for watching a Kubernetes object's event, such that when an Kubernetes object changes(e.g. CREATE,UPDATE,DELETE), the Informer is informed, | |
and can execute a callback with the relevant object as an argument. |
The Lister is the mechanism for querying Kubernetes object's against the client side in-memory cache. | ||
Users can list the Kubernetes objects by using Kubernetes APIs, however, | ||
if users do so, it places load on the Kubernetes control plane. | ||
|
||
Since an Lister stores objects in an in-memory cache, queries against a come at practically no cost. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Lister is the mechanism for querying Kubernetes object's against the client side in-memory cache. | |
Users can list the Kubernetes objects by using Kubernetes APIs, however, | |
if users do so, it places load on the Kubernetes control plane. | |
Since an Lister stores objects in an in-memory cache, queries against a come at practically no cost. | |
Listers are a mechanism for querying Kubernetes object's against the client side in-memory cache. | |
Since an Lister stores objects in an in-memory cache, queries against a come at practically no cost. |
I don't think we need to repeat the issue with direct acess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed from Listers are a mechanism
to A Lister is the mechanism
according to An Informer is the mechanism
.
Updated again. |
Build Failed 😱 Build Id: efff862b-33a0-4a06-9e59-2f4a329a31ff To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
This PR has only documentation changes, however, the test of go
/retest I'd like to retest but it looks I don't have any way to retest... |
Sounds like a weird test flake - not related to your change. |
informerFactory.Start(wait.NeverStop) | ||
agonesInformerFactory.Start(wait.NeverStop) | ||
// Wait until finish caching with List API | ||
informerFactory.WaitForCacheSync(wait.NeverStop) | ||
agonesInformerFactory.WaitForCacheSync(wait.NeverStop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 do we want to use wait.NeverStop here, or do we want to drive people towards what they probably should do - which is have a context.Context
(maybe cancellable? Might not matter, could just use context.Background), and pass in ctx.Done() into each of these?
Since it's likely better practice to use a Context
. WDYT?
Also /cc @roberthbailey in case he has opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed using context.Background
.
Build Failed 😱 Build Id: 5842b71b-312b-4e68-b830-fdc9240a670a To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: govargo, markmandel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
New changes are detected. LGTM label has been removed. |
Build Succeeded 👏 Build Id: b4d340c8-3c1b-439b-8cd9-90b26deb3597 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Failed 😱 Build Id: 19a5682b-1fb9-4bfe-8257-474e2c07cbda To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: d7cd938a-1e7c-4254-8b41-57af5b790b92 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 02fca755-5a3f-4686-8b9e-64c48fb72728 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
What this PR does / Why we need it:
/kind documentation
/kind feature
This PR add document about Kubernetes Informers and Listers.
Which issue(s) this PR fixes:
Closes #1260
Special notes for your reviewer:
This is my first contribution for Agones.
Please let me know if you have any advices.
Thanks in advance.