k8s

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client watches a Kubernetes cluster and translates events into Controller method calls.

func New added in v0.4.0

func New(cfg *Config) (*Client, error)

New connects to masterAddr, using kubeconfig to authenticate.

The client uses processName to identify itself to the cluster (e.g. when logging events).

func (*Client) Errorf

func (c *Client) Errorf(svc *v1.Service, kind, msg string, args ...interface{})

Errorf logs an error event about svc to the Kubernetes cluster.

func (*Client) Infof

func (c *Client) Infof(svc *v1.Service, kind, msg string, args ...interface{})

Infof logs an informational event about svc to the Kubernetes cluster.

func (*Client) Run

func (c *Client) Run() error

Run watches for events on the Kubernetes cluster, and dispatches calls to the Controller.

func (*Client) Update

func (c *Client) Update(svc *v1.Service) (*v1.Service, error)

Update writes svc back into the Kubernetes cluster. If successful, the updated Service is returned. Note that changes to svc.Status are not propagated, for that you need to call UpdateStatus.

func (*Client) UpdateStatus

func (c *Client) UpdateStatus(svc *v1.Service) error

UpdateStatus writes the protected "status" field of svc back into the Kubernetes cluster.

type Config added in v0.6.0

type Config struct {
	ProcessName   string
	ConfigMapName string
	NodeName      string
	MetricsHost   string
	MetricsPort   int
	ReadEndpoints bool
	Logger        log.Logger

	ServiceChanged func(log.Logger, string, *v1.Service, *v1.Endpoints) SyncState
	ConfigChanged  func(log.Logger, *config.Config) SyncState
	NodeChanged    func(log.Logger, *v1.Node) SyncState
	Synced         func(log.Logger)
}

Config specifies the configuration of the Kubernetes client/watcher.

type SyncState added in v0.8.0

type SyncState int

SyncState is the result of calling synchronization callbacks.

const (
	// The update was processed successfully.
	SyncStateSuccess SyncState = iota
	// The update caused a transient error, the k8s client should
	// retry later.
	SyncStateError
	// The update was accepted, but requires reprocessing all watched
	// services.
	SyncStateReprocessAll
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL