Documentation ¶
Overview ¶
Copyright 2021 k0s authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type LeaseConfiguration
- type LeaseEvents
- type LeaseOpt
- func WithContext(ctx context.Context) LeaseOpt
- func WithDuration(duration time.Duration) LeaseOpt
- func WithIdentity(identity string) LeaseOpt
- func WithLogger(logger *logrus.Entry) LeaseOpt
- func WithNamespace(namespace string) LeaseOpt
- func WithRenewDeadline(deadline time.Duration) LeaseOpt
- func WithRetryPeriod(retryPeriod time.Duration) LeaseOpt
- type LeasePool
- type WatchOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LeaseConfiguration ¶
type LeaseConfiguration struct {
// contains filtered or unexported fields
}
The LeaseConfiguration allows passing through various options to customise the lease.
type LeaseEvents ¶
type LeaseEvents struct { AcquiredLease chan struct{} LostLease chan struct{} }
LeaseEvents contains channels to inform the consumer when a lease is acquired and lost
type LeaseOpt ¶
type LeaseOpt func(config LeaseConfiguration) LeaseConfiguration
A LeaseOpt is a function that modifies a LeaseConfiguration
func WithContext ¶
WithContext allows the consumer to pass its own context, for example a cancelable context
func WithDuration ¶
WithDuration sets the duration of the lease (for new leases)
func WithIdentity ¶
WithIdentity sets the identity of the lease holder
func WithLogger ¶
WithLogger allows the consumer to pass a different logrus entry with additional context
func WithNamespace ¶
WithNamespace specifies which namespace the lease should be created in, defaults to kube-node-lease
func WithRenewDeadline ¶
WithRenewDeadline sets the renew deadline of the lease
func WithRetryPeriod ¶
WithRetryPeriod specifies the retry period of the lease
type LeasePool ¶
type LeasePool struct {
// contains filtered or unexported fields
}
The LeasePool represents a single lease accessed by multiple clients (considered part of the "pool")
func NewLeasePool ¶
NewLeasePool creates a new LeasePool struct to interact with a lease
func (*LeasePool) Watch ¶
func (p *LeasePool) Watch(opts ...WatchOpt) (*LeaseEvents, context.CancelFunc, error)
Watch is the primary function of LeasePool, and starts the leader election process
type WatchOpt ¶
type WatchOpt func(options watchOptions) watchOptions
WatchOpt is a callback that alters the watchOptions configuration
func WithOutputChannels ¶
func WithOutputChannels(channels *LeaseEvents) WatchOpt
WithOutputChannels allows us to pass through channels with a size greater than 0, which makes testing a lot easier.