kubernetes

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DrainTimeout is maximum time to wait for the node to be drained.
	DrainTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func IsRetryableError

func IsRetryableError(err error) bool

IsRetryableError returns true if this Kubernetes API should be retried.

Types

type Client

type Client struct {
	*taloskubernetes.Client
}

Client represents a set of helper methods for interacting with the Kubernetes API.

func NewClientFromKubeletKubeconfig

func NewClientFromKubeletKubeconfig() (*Client, error)

NewClientFromKubeletKubeconfig initializes and returns a Client.

func NewClientFromPKI

func NewClientFromPKI(ca, crt, key []byte, endpoint *url.URL) (*Client, error)

NewClientFromPKI initializes and returns a Client.

func NewForConfig

func NewForConfig(config *restclient.Config) (*Client, error)

NewForConfig initializes and returns a client using the provided config.

func NewTemporaryClientControlPlane added in v1.3.2

func NewTemporaryClientControlPlane(ctx context.Context, r controller.Reader) (client *Client, err error)

NewTemporaryClientControlPlane initializes a Kubernetes client for a controlplane node using PKI information.

The client uses "localhost" endpoint, so it doesn't depend on the loadbalancer to be ready.

func NewTemporaryClientFromPKI

func NewTemporaryClientFromPKI(ca *x509.PEMEncodedCertificateAndKey, endpoint *url.URL) (client *Client, err error)

NewTemporaryClientFromPKI initializes a Kubernetes client using a certificate with a TTL of 10 minutes.

func (*Client) Cordon

func (h *Client) Cordon(ctx context.Context, name string) error

Cordon marks a node as unschedulable.

func (*Client) CordonAndDrain

func (h *Client) CordonAndDrain(ctx context.Context, node string) (err error)

CordonAndDrain cordons and drains a node in one call.

func (*Client) Drain

func (h *Client) Drain(ctx context.Context, node string) error

Drain evicts all pods on a given node.

func (*Client) LabelNodeAsControlPlane

func (h *Client) LabelNodeAsControlPlane(ctx context.Context, name string, taintNoSchedule bool) (err error)

LabelNodeAsControlPlane labels a node with the required control-plane label and NoSchedule taint.

func (*Client) NodeIPs

func (h *Client) NodeIPs(ctx context.Context, machineType machine.Type) (addrs []string, err error)

NodeIPs returns list of node IP addresses by machine type.

func (*Client) Uncordon

func (h *Client) Uncordon(ctx context.Context, name string, force bool) error

Uncordon marks a node as schedulable.

If force is set, node will be uncordoned even if cordoned not by Talos.

func (*Client) WaitUntilReady

func (h *Client) WaitUntilReady(ctx context.Context, name string) error

WaitUntilReady waits for a node to be ready.

Directories

Path Synopsis
Package kubelet provides minimal client for the kubelet API.
Package kubelet provides minimal client for the kubelet API.

Jump to

Keyboard shortcuts

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