client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 12 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 {
	*kubernetes.Clientset
	// contains filtered or unexported fields
}

Client is a Kubernetes client that provides simpler interfaces than the official Kubernetes package.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient returns a new client.

func (*Client) AddNodeLabel

func (c *Client) AddNodeLabel(ctx context.Context, nodeName, label, value string) error

AddNodeLabel adds or replaces a node label to the Kubernetes node.

func (*Client) FilterReadyPods

func (c *Client) FilterReadyPods(pods []core.Pod) []core.Pod

FilterReadyPods filters out not-ready pods.

func (*Client) Nodes

func (c *Client) Nodes(ctx context.Context, labelSelector map[string]string) ([]core.Node, error)

Nodes returns a list of Kubernetes nodes labeled by the argument labelSelector.

func (*Client) PodReady

func (c *Client) PodReady(pod core.Pod) bool

PodReady decides whether the pod is ready.

func (*Client) Pods

func (c *Client) Pods(ctx context.Context, namespace string, labelSelector map[string]string, onlyReady bool) ([]core.Pod, error)

Pods returns a list of Kubernetes pods labeled by the argument labelSelector. It returns only ready pods if the argument onlyReady is true.

func (*Client) RemoveNodeLabel

func (c *Client) RemoveNodeLabel(ctx context.Context, nodeName, label string) error

RemoveNodeLabel removes a node label from the Kubernetes node.

func (*Client) ReplaceNodeLabel

func (c *Client) ReplaceNodeLabel(ctx context.Context, nodeName, label, value string) error

ReplaceNodeLabel replaces a node label of the Kubernetes node. Deprecated: Use AddNodeLabel. More info: https://datatracker.ietf.org/doc/html/rfc6902#section-4.1

func (*Client) Service

func (c *Client) Service(ctx context.Context, namespace, name string) (*core.Service, error)

Service returns a service resource named by the argument name defined in the given namespace.

func (*Client) UpdateDeploymentReplicas

func (c *Client) UpdateDeploymentReplicas(ctx context.Context, namespace, deploymentName string, replicas int32) error

UpdateDeploymentReplicas updates replicas of the deployment in the namespace. The replicas are changed asynchronously, thus caller has a responsibility to check the done of change.

func (*Client) UpdateStatefulSetReplicas

func (c *Client) UpdateStatefulSetReplicas(ctx context.Context, namespace, statefulSetName string, replicas int32) error

UpdateStatefulSetReplicas updates the number of replicas of the statefulSet in the namespace. The replicas are changed asynchronously, thus caller has a responsibility to check the done of change.

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithCluster

func WithCluster(cluster string) Option

func WithClusterConnectionInfo

func WithClusterConnectionInfo(connInfo vault.ClusterConnectionInfo) Option

func WithContext

func WithContext(context string) Option

func WithMasterURL

func WithMasterURL(masterURL string) Option

func WithToken

func WithToken(token string) Option

func WithUser

func WithUser(user string) Option

type PatchOp

type PatchOp int8
const (
	PatchOpAdd PatchOp = iota
	PatchOpReplace
	PatchOpRemove
)

func (PatchOp) String

func (p PatchOp) String() string

type PatchStringValue

type PatchStringValue struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

func NewLabelPatchStringValue

func NewLabelPatchStringValue(patchOp PatchOp, label, value string) PatchStringValue

Jump to

Keyboard shortcuts

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