Documentation ¶
Index ¶
- func NodeHasHealthyEndpoint(eps *v1.Endpoints, node string) bool
- type Client
- func (c *Client) Errorf(svc *v1.Service, kind, msg string, args ...interface{})
- func (c *Client) Infof(svc *v1.Service, kind, msg string, args ...interface{})
- func (c *Client) NewLeaderElector(a *arp.Announce, lockName string) (*le.LeaderElector, error)
- func (c *Client) Run(httpPort int) error
- func (c *Client) Update(svc *v1.Service) (*v1.Service, error)
- func (c *Client) UpdateStatus(svc *v1.Service) error
- type Controller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client watches a Kubernetes cluster and translates events into Controller method calls.
func NewClient ¶
func NewClient(name, masterAddr, kubeconfig string, watchEps bool, ctrls ...Controller) (*Client, error)
NewClient connects to masterAddr, using kubeconfig to authenticate, and calls methods on ctrls as the cluster state changes.
The client uses the given name to identify itself to the cluster (e.g. when logging events). watchEps defines whether ctrl cares about the endpoints associated with a service. If watchEps is false, the controller will not watch endpoint objects, and the endpoints in SetBalancer calls will always be nil.
func (*Client) NewLeaderElector ¶ added in v0.2.0
NewLeaderElector returns a new LeaderElector used for endpoint leader election using c.
func (*Client) Run ¶
Run watches for events on the Kubernetes cluster, and dispatches calls to the Controller.
type Controller ¶
type Controller interface { // SetBalancer is called whenever a Service or its related // Endpoints change. When the Service is deleted, SetBalancer is // called with svc=nil and eps=nil. SetBalancer(name string, svc *v1.Service, eps *v1.Endpoints) error // SetConfig is called whenever the MetalLB configuration for the // cluster changes. If the config is deleted from the cluster, // SetConfig is called with cfg=nil. SetConfig(cfg *config.Config) error // MarkSynced is called when SetBalancer has been called at least // once for every Service in the cluster, and SetConfig has been // called. MarkSynced() }
A Controller takes action when watched Kubernetes objects change.