Documentation ¶
Index ¶
- Constants
- Variables
- type GetResults
- type LoadBalancerType
- type RetrieveOption
- func WithCompletionChannel(completionChan chan<- struct{}) RetrieveOption
- func WithExternalLoadBalancers() RetrieveOption
- func WithExternalNames() RetrieveOption
- func WithInternalLoadBalancers() RetrieveOption
- func WithLabel(key, value string) RetrieveOption
- func WithLabels(labels map[string]string) RetrieveOption
- func WithMaxWorkers(workers uint) RetrieveOption
- func WithNamespaces(namespaces ...string) RetrieveOption
- func WithNodePorts() RetrieveOption
- func WithResultChannel(servicesChan chan<- *Service) RetrieveOption
- func WithWorkerPool(workerPool *ants.Pool) RetrieveOption
- type RetrieveOptions
- type Service
Constants ¶
const ( AllLoadBalancers = iota InternalLoadBalancers ExternalLoadBalancers )
Variables ¶
var ( ErrorInvalidChannel error = errors.New("invalid channel provided") ErrorInvalidOptions error = errors.New("invalid options provided") ErrorInvalidWorkerPool error = errors.New("invalid worker pool") ErrorCreatingPool error = errors.New("cannot create worker pool") ErrorCannotSubmitTask error = errors.New("cannot submit task to worker pool") )
Functions ¶
This section is empty.
Types ¶
type GetResults ¶
func GetServices ¶
func GetServices(ctx context.Context, clientset kubernetes.Interface, opts ...RetrieveOption) (*GetResults, error)
type LoadBalancerType ¶
type LoadBalancerType int
type RetrieveOption ¶
type RetrieveOption func(*RetrieveOptions) error
func WithCompletionChannel ¶
func WithCompletionChannel(completionChan chan<- struct{}) RetrieveOption
Signal completion to this channel.
By default, the retriever will close the channel you provide via `WithResultChannel` when its task is complete. This option will override this behavior by keeping that channel alive, and instead signal completion to this other channel by sending an empty array. This is useful in case you are re-using the channel for other purposes or when you are looping through `select`.
If not used in conjunction to `WithResultChannel`, this option will have no effect.
func WithExternalLoadBalancers ¶
func WithExternalLoadBalancers() RetrieveOption
func WithExternalNames ¶
func WithExternalNames() RetrieveOption
func WithInternalLoadBalancers ¶
func WithInternalLoadBalancers() RetrieveOption
func WithLabel ¶
func WithLabel(key, value string) RetrieveOption
func WithLabels ¶
func WithLabels(labels map[string]string) RetrieveOption
func WithMaxWorkers ¶
func WithMaxWorkers(workers uint) RetrieveOption
Set the maximum number of workers, or concurrent tasks.
By default, retrievers will try to maximize concurrency and prioritize non-blocking operations, especially in case many regions need to be queried. This option sets a limit on the concurrent tasks that can be performed.
This option will have no effect in case you are providing you own worker pool, in which case you will have to limit concurrency on your own.
Providing `0` will make it use the default value (100).
func WithNamespaces ¶
func WithNamespaces(namespaces ...string) RetrieveOption
func WithNodePorts ¶
func WithNodePorts() RetrieveOption
func WithResultChannel ¶
func WithResultChannel(servicesChan chan<- *Service) RetrieveOption
Send results to this channel. The retriever will send clusters to this channel as soon as it finds them.
Once done, the retriever will close this channel to signal that there is no more data to send.
Make sure your channel is buffered before sending it to the retriever to avoid performance penalties in case you expect many clusters to be found.
func WithWorkerPool ¶
func WithWorkerPool(workerPool *ants.Pool) RetrieveOption
Sets a custom worker pool.
This is useful in case you are already using a worker pool for your own purposes and want to re-use your idle workers to perform these tasks.