Documentation ¶
Overview ¶
Copyright 2015 The Kubernetes Authors All rights reserved.
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.
ref: https://github.com/kubernetes/contrib/tree/master/election
Index ¶
- func NewElection(electionId, id, namespace string, ttl time.Duration, ...) (*leaderelection.LeaderElector, error)
- func NewSimpleElection(electionId, id string, callback func(leader string), c clientset.Interface) (*leaderelection.LeaderElector, error)
- func RunElection(e *leaderelection.LeaderElector)
- func SetTask(name string, t Task) error
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewElection ¶
func NewElection(electionId, id, namespace string, ttl time.Duration, callback func(leader string), c clientset.Interface) (*leaderelection.LeaderElector, error)
NewElection creates an election. 'namespace'/'election' should be an existing Kubernetes Service 'id' is the id if this leader, should be unique.
func NewSimpleElection ¶
func NewSimpleElection(electionId, id string, callback func(leader string), c clientset.Interface) (*leaderelection.LeaderElector, error)
NewSimpleElection creates an election, it defaults namespace to 'default' and ttl to 10s
func RunElection ¶
func RunElection(e *leaderelection.LeaderElector)
RunElection runs an election given an leader elector. Doesn't return.