mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-14 08:23:24 +08:00
Merge pull request #74328 from daixiang0/delete-blank
delete all duplicate empty blanks Kubernetes-commit: 8993fbc543c18e73668793b5d5e234c0a136735c
This commit is contained in:
commit
034514e798
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,2 +1,2 @@
|
||||
Sorry, we do not accept changes directly against this repository. Please see
|
||||
Sorry, we do not accept changes directly against this repository. Please see
|
||||
CONTRIBUTING.md for information on where and how to contribute instead.
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.
|
||||
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/sample-controller](https://git.k8s.io/kubernetes/staging/src/k8s.io/sample-controller) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/sample-controller](https://git.k8s.io/kubernetes/staging/src/k8s.io/sample-controller) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
|
||||
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information
|
||||
|
508
Godeps/Godeps.json
generated
508
Godeps/Godeps.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
# client-go under the hood
|
||||
|
||||
The [client-go](https://github.com/kubernetes/client-go/) library contains various mechanisms that you can use when
|
||||
developing your custom controllers. These mechanisms are defined in the
|
||||
The [client-go](https://github.com/kubernetes/client-go/) library contains various mechanisms that you can use when
|
||||
developing your custom controllers. These mechanisms are defined in the
|
||||
[tools/cache folder](https://github.com/kubernetes/client-go/tree/master/tools/cache) of the library.
|
||||
|
||||
Here is a pictorial representation showing how the various components in
|
||||
the client-go library work and their interaction points with the custom
|
||||
Here is a pictorial representation showing how the various components in
|
||||
the client-go library work and their interaction points with the custom
|
||||
controller code that you will write.
|
||||
|
||||
<p align="center">
|
||||
@ -19,7 +19,7 @@ watches the Kubernetes API for the specified resource type (kind).
|
||||
The function in which this is done is *ListAndWatch*.
|
||||
The watch could be for an in-built resource or it could be for a custom resource.
|
||||
When the reflector receives notification about existence of new
|
||||
resource instance through the watch API, it gets the newly created object
|
||||
resource instance through the watch API, it gets the newly created object
|
||||
using the corresponding listing API and puts it in the Delta Fifo queue
|
||||
inside the *watchHandler* function.
|
||||
|
||||
@ -38,27 +38,27 @@ that generates an object’s key as `<namespace>/<name>` combination for that ob
|
||||
|
||||
## Custom Controller components
|
||||
|
||||
* Informer reference: This is the reference to the Informer instance that knows
|
||||
how to work with your custom resource objects. Your custom controller code needs
|
||||
* Informer reference: This is the reference to the Informer instance that knows
|
||||
how to work with your custom resource objects. Your custom controller code needs
|
||||
to create the appropriate Informer.
|
||||
|
||||
* Indexer reference: This is the reference to the Indexer instance that knows
|
||||
how to work with your custom resource objects. Your custom controller code needs
|
||||
to create this. You will be using this reference for retrieving objects for
|
||||
* Indexer reference: This is the reference to the Indexer instance that knows
|
||||
how to work with your custom resource objects. Your custom controller code needs
|
||||
to create this. You will be using this reference for retrieving objects for
|
||||
later processing.
|
||||
|
||||
The base controller in client-go provides the *NewIndexerInformer* function to create Informer and Indexer.
|
||||
In your code you can either [directly invoke this function](https://github.com/kubernetes/client-go/blob/master/examples/workqueue/main.go#L174) or [use factory methods for creating an informer.](https://github.com/kubernetes/sample-controller/blob/master/main.go#L61)
|
||||
|
||||
* Resource Event Handlers: These are the callback functions which will be called by
|
||||
the Informer when it wants to deliver an object to your controller. The typical
|
||||
* Resource Event Handlers: These are the callback functions which will be called by
|
||||
the Informer when it wants to deliver an object to your controller. The typical
|
||||
pattern to write these functions is to obtain the dispatched object’s key
|
||||
and enqueue that key in a work queue for further processing.
|
||||
|
||||
* Work queue: This is the queue that you create in your controller code to decouple
|
||||
delivery of an object from its processing. Resource event handler functions are written
|
||||
* Work queue: This is the queue that you create in your controller code to decouple
|
||||
delivery of an object from its processing. Resource event handler functions are written
|
||||
to extract the delivered object’s key and add that to the work queue.
|
||||
|
||||
* Process Item: This is the function that you create in your code which processes items
|
||||
from the work queue. There can be one or more other functions that do the actual processing.
|
||||
* Process Item: This is the function that you create in your code which processes items
|
||||
from the work queue. There can be one or more other functions that do the actual processing.
|
||||
These functions will typically use the [Indexer reference](https://github.com/kubernetes/client-go/blob/master/examples/workqueue/main.go#L73), or a Listing wrapper to retrieve the object corresponding to the key.
|
2
vendor/k8s.io/code-generator/CONTRIBUTING.md
generated
vendored
2
vendor/k8s.io/code-generator/CONTRIBUTING.md
generated
vendored
@ -2,6 +2,6 @@
|
||||
|
||||
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.
|
||||
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/code-generator](https://git.k8s.io/kubernetes/staging/src/k8s.io/code-generator) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/code-generator](https://git.k8s.io/kubernetes/staging/src/k8s.io/code-generator) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
|
||||
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information
|
||||
|
4
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go
generated
vendored
4
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go
generated
vendored
@ -152,7 +152,7 @@ func NewSharedInformerFactory(client {{.clientSetInterface|raw}}, defaultResync
|
||||
// as specified here.
|
||||
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
|
||||
func NewFilteredSharedInformerFactory(client {{.clientSetInterface|raw}}, defaultResync {{.timeDuration|raw}}, namespace string, tweakListOptions {{.interfacesTweakListOptionsFunc|raw}}) SharedInformerFactory {
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
||||
}
|
||||
|
||||
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
|
||||
@ -165,7 +165,7 @@ func NewSharedInformerFactoryWithOptions(client {{.clientSetInterface|raw}}, def
|
||||
startedInformers: make(map[{{.reflectType|raw}}]bool),
|
||||
customResync: make(map[{{.reflectType|raw}}]{{.timeDuration|raw}}),
|
||||
}
|
||||
|
||||
|
||||
// Apply all options
|
||||
for _, opt := range options {
|
||||
factory = opt(factory)
|
||||
|
Loading…
x
Reference in New Issue
Block a user