apps

package
v1.20.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 19 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance(i Ops)

SetInstance replaces the instance with the provided one. Should be used only for testing purposes.

Types

type Client

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

Client provides a wrapper for the kubernetes apps client.

func New

New builds a new apps client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

NewForConfig builds a new apps client for the given config.

func (*Client) CreateDaemonSet

func (c *Client) CreateDaemonSet(ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)

CreateDaemonSet creates the given daemonset

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error)

CreateDeployment creates the given deployment

func (*Client) CreateReplicaSet

func (c *Client) CreateReplicaSet(rs *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)

CreateReplicaSet creates the given ReplicaSet

func (*Client) CreateStatefulSet

func (c *Client) CreateStatefulSet(statefulset *appsv1.StatefulSet) (*appsv1.StatefulSet, error)

CreateStatefulSet creates the given statefulset

func (*Client) DeleteDaemonSet

func (c *Client) DeleteDaemonSet(name, namespace string) error

DeleteDaemonSet deletes the given daemonset

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(name, namespace string) error

DeleteDeployment deletes the given deployment

func (*Client) DeleteReplicaSet

func (c *Client) DeleteReplicaSet(name, namespace string) error

DeleteReplicaSet deletes the given ReplicaSet

func (*Client) DeleteStatefulSet

func (c *Client) DeleteStatefulSet(name, namespace string) error

DeleteStatefulSet deletes the given statefulset

func (*Client) DescribeDeployment

func (c *Client) DescribeDeployment(depName, depNamespace string) (*appsv1.DeploymentStatus, error)

DescribeDeployment gets the deployment status

func (*Client) DescribeStatefulSet

func (c *Client) DescribeStatefulSet(ssetName string, ssetNamespace string) (*appsv1.StatefulSetStatus, error)

DescribeStatefulSet gets status of the statefulset

func (*Client) GetDaemonSet

func (c *Client) GetDaemonSet(name, namespace string) (*appsv1.DaemonSet, error)

GetDaemonSet gets the the daemon set with given name

func (*Client) GetDaemonSetPods

func (c *Client) GetDaemonSetPods(ds *appsv1.DaemonSet) ([]corev1.Pod, error)

GetDaemonSetPods returns list of pods for the daemonset

func (*Client) GetDeployment

func (c *Client) GetDeployment(name, namespace string) (*appsv1.Deployment, error)

GetDeployment returns a deployment for the give name and namespace

func (*Client) GetDeploymentPods

func (c *Client) GetDeploymentPods(deployment *appsv1.Deployment) ([]corev1.Pod, error)

GetDeploymentPods returns pods for the given deployment

func (*Client) GetDeploymentsUsingStorageClass

func (c *Client) GetDeploymentsUsingStorageClass(scName string) ([]appsv1.Deployment, error)

GetDeploymentsUsingStorageClass returns all deployments using the given storage class

func (*Client) GetPVCsForStatefulSet

func (c *Client) GetPVCsForStatefulSet(ss *appsv1.StatefulSet) (*corev1.PersistentVolumeClaimList, error)

GetPVCsForStatefulSet returns all the PVCs for given stateful set

func (*Client) GetReplicaSet

func (c *Client) GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)

GetReplicaSet gets the the daemon set with given name

func (*Client) GetReplicaSetByDeployment

func (c *Client) GetReplicaSetByDeployment(deployment *appsv1.Deployment) (*appsv1.ReplicaSet, error)

GetReplicaSetByDeployment get ReplicaSet for a Given Deployment

func (*Client) GetReplicaSetPods

func (c *Client) GetReplicaSetPods(rs *appsv1.ReplicaSet) ([]corev1.Pod, error)

GetReplicaSetPods returns list of pods for the ReplicaSet

func (*Client) GetStatefulSet

func (c *Client) GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)

GetStatefulSet returns a statefulset for given name and namespace

func (*Client) GetStatefulSetPods

func (c *Client) GetStatefulSetPods(statefulset *appsv1.StatefulSet) ([]corev1.Pod, error)

GetStatefulSetPods returns pods for the given statefulset

func (*Client) GetStatefulSetsUsingStorageClass

func (c *Client) GetStatefulSetsUsingStorageClass(scName string) ([]appsv1.StatefulSet, error)

GetStatefulSetsUsingStorageClass returns all statefulsets using given storage class

func (*Client) ListDaemonSets

func (c *Client) ListDaemonSets(namespace string, listOpts metav1.ListOptions) ([]appsv1.DaemonSet, error)

ListDaemonSets lists all daemonsets in given namespace

func (*Client) ListDeployments

func (c *Client) ListDeployments(namespace string, options metav1.ListOptions) (*appsv1.DeploymentList, error)

ListDeployments lists all deployments for the given namespace

func (*Client) ListReplicaSets

func (c *Client) ListReplicaSets(namespace string, listOpts metav1.ListOptions) ([]appsv1.ReplicaSet, error)

ListReplicaSets lists all ReplicaSets in given namespace

func (*Client) ListStatefulSets

func (c *Client) ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)

ListStatefulSets lists all the statefulsets for a given namespace

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client

func (*Client) UpdateDaemonSet

func (c *Client) UpdateDaemonSet(ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)

UpdateDaemonSet updates the given daemon set and returns the updated ds

func (*Client) UpdateDeployment

func (c *Client) UpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error)

UpdateDeployment updates the given deployment

func (*Client) UpdateReplicaSet

func (c *Client) UpdateReplicaSet(rs *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)

UpdateReplicaSet updates the given daemon set and returns the updated rs

func (*Client) UpdateStatefulSet

func (c *Client) UpdateStatefulSet(statefulset *appsv1.StatefulSet) (*appsv1.StatefulSet, error)

UpdateStatefulSet creates the given statefulset

func (*Client) ValidateDaemonSet

func (c *Client) ValidateDaemonSet(name, namespace string, timeout time.Duration) error

ValidateDaemonSet checks if the given daemonset is ready within given timeout

func (*Client) ValidateDeployment

func (c *Client) ValidateDeployment(deployment *appsv1.Deployment, timeout, retryInterval time.Duration) error

ValidateDeployment validates the given deployment if it's running and healthy

func (*Client) ValidatePVCsForStatefulSet

func (c *Client) ValidatePVCsForStatefulSet(ss *appsv1.StatefulSet, timeout, retryTimeout time.Duration) error

ValidatePVCsForStatefulSet validates the PVCs for the given stateful set

func (*Client) ValidateReplicaSet

func (c *Client) ValidateReplicaSet(name, namespace string, timeout time.Duration) error

ValidateReplicaSet checks if the given ReplicaSet is ready within given timeout

func (*Client) ValidateStatefulSet

func (c *Client) ValidateStatefulSet(statefulset *appsv1.StatefulSet, timeout time.Duration) error

ValidateStatefulSet validates the given statefulset if it's running and healthy within the given timeout

func (*Client) ValidateTerminatedDeployment

func (c *Client) ValidateTerminatedDeployment(deployment *appsv1.Deployment, timeout, timeBeforeRetry time.Duration) error

ValidateTerminatedDeployment validates if given deployment is terminated

func (*Client) ValidateTerminatedStatefulSet

func (c *Client) ValidateTerminatedStatefulSet(statefulset *appsv1.StatefulSet, timeout, timeBeforeRetry time.Duration) error

ValidateTerminatedStatefulSet validates if given deployment is terminated

type DaemonSetOps

type DaemonSetOps interface {
	// CreateDaemonSet creates the given daemonset
	CreateDaemonSet(ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)
	// ListDaemonSets lists all daemonsets in given namespace
	ListDaemonSets(namespace string, listOpts metav1.ListOptions) ([]appsv1.DaemonSet, error)
	// GetDaemonSet gets the the daemon set with given name
	GetDaemonSet(string, string) (*appsv1.DaemonSet, error)
	// ValidateDaemonSet checks if the given daemonset is ready within given timeout
	ValidateDaemonSet(name, namespace string, timeout time.Duration) error
	// GetDaemonSetPods returns list of pods for the daemonset
	GetDaemonSetPods(*appsv1.DaemonSet) ([]corev1.Pod, error)
	// UpdateDaemonSet updates the given daemon set and returns the updated ds
	UpdateDaemonSet(*appsv1.DaemonSet) (*appsv1.DaemonSet, error)
	// DeleteDaemonSet deletes the given daemonset
	DeleteDaemonSet(name, namespace string) error
}

DaemonSetOps is an interface to perform k8s daemon set operations

type DeploymentOps

type DeploymentOps interface {
	// ListDeployments lists all deployments for the given namespace
	ListDeployments(namespace string, options metav1.ListOptions) (*appsv1.DeploymentList, error)
	// GetDeployment returns a deployment for the give name and namespace
	GetDeployment(name, namespace string) (*appsv1.Deployment, error)
	// CreateDeployment creates the given deployment
	CreateDeployment(*appsv1.Deployment) (*appsv1.Deployment, error)
	// UpdateDeployment updates the given deployment
	UpdateDeployment(*appsv1.Deployment) (*appsv1.Deployment, error)
	// DeleteDeployment deletes the given deployment
	DeleteDeployment(name, namespace string) error
	// ValidateDeployment validates the given deployment if it's running and healthy
	ValidateDeployment(deployment *appsv1.Deployment, timeout, retryInterval time.Duration) error
	// ValidateTerminatedDeployment validates if given deployment is terminated
	ValidateTerminatedDeployment(*appsv1.Deployment, time.Duration, time.Duration) error
	// GetDeploymentPods returns pods for the given deployment
	GetDeploymentPods(*appsv1.Deployment) ([]corev1.Pod, error)
	// DescribeDeployment gets the deployment status
	DescribeDeployment(name, namespace string) (*appsv1.DeploymentStatus, error)
	// GetDeploymentsUsingStorageClass returns all deployments using the given storage class
	GetDeploymentsUsingStorageClass(scName string) ([]appsv1.Deployment, error)
}

DeploymentOps is an interface to perform k8s deployment operations

type Ops

type Ops interface {
	DaemonSetOps
	DeploymentOps
	StatefulSetOps
	ReplicaSetOps

	// SetConfig sets the config and resets the client
	SetConfig(config *rest.Config)
}

Ops is an interface to perform kubernetes related operations on the apps resources.

func Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

type ReplicaSetOps

type ReplicaSetOps interface {
	// CreateReplicaSet creates the given ReplicaSet
	CreateReplicaSet(rs *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)
	// ListReplicaSets lists all ReplicaSets in given namespace
	ListReplicaSets(namespace string, listOpts metav1.ListOptions) ([]appsv1.ReplicaSet, error)
	// GetReplicaSet gets the the daemon set with given name
	GetReplicaSet(string, string) (*appsv1.ReplicaSet, error)
	// ValidateReplicaSet checks if the given ReplicaSet is ready within given timeout
	ValidateReplicaSet(name, namespace string, timeout time.Duration) error
	// GetReplicaSetPods returns list of pods for the ReplicaSet
	GetReplicaSetPods(*appsv1.ReplicaSet) ([]corev1.Pod, error)
	// UpdateReplicaSet updates the given daemon set and returns the updated rs
	UpdateReplicaSet(*appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)
	// DeleteReplicaSet deletes the given ReplicaSet
	DeleteReplicaSet(name, namespace string) error
	// GetReplicaSetByDeployment deletes the given ReplicaSet
	GetReplicaSetByDeployment(deployment *appsv1.Deployment) (*appsv1.ReplicaSet, error)
}

ReplicaSetOps is an interface to perform k8s daemon set operations

type StatefulSetOps

type StatefulSetOps interface {
	// ListStatefulSets lists all the statefulsets for a given namespace
	ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)
	// GetStatefulSet returns a statefulset for given name and namespace
	GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)
	// CreateStatefulSet creates the given statefulset
	CreateStatefulSet(ss *appsv1.StatefulSet) (*appsv1.StatefulSet, error)
	// UpdateStatefulSet creates the given statefulset
	UpdateStatefulSet(ss *appsv1.StatefulSet) (*appsv1.StatefulSet, error)
	// DeleteStatefulSet deletes the given statefulset
	DeleteStatefulSet(name, namespace string) error
	// ValidateStatefulSet validates the given statefulset if it's running and healthy within the given timeout
	ValidateStatefulSet(ss *appsv1.StatefulSet, timeout time.Duration) error
	// ValidateTerminatedStatefulSet validates if given deployment is terminated
	ValidateTerminatedStatefulSet(ss *appsv1.StatefulSet, timeout, retryInterval time.Duration) error
	// GetStatefulSetPods returns pods for the given statefulset
	GetStatefulSetPods(ss *appsv1.StatefulSet) ([]corev1.Pod, error)
	// DescribeStatefulSet gets status of the statefulset
	DescribeStatefulSet(name, namespace string) (*appsv1.StatefulSetStatus, error)
	// GetStatefulSetsUsingStorageClass returns all statefulsets using given storage class
	GetStatefulSetsUsingStorageClass(scName string) ([]appsv1.StatefulSet, error)
	// GetPVCsForStatefulSet returns all the PVCs for given stateful set
	GetPVCsForStatefulSet(ss *appsv1.StatefulSet) (*corev1.PersistentVolumeClaimList, error)
	// ValidatePVCsForStatefulSet validates the PVCs for the given stateful set
	ValidatePVCsForStatefulSet(ss *appsv1.StatefulSet, timeout, retryInterval time.Duration) error
}

StatefulSetOps is an interface to perform k8s stateful set operations

Jump to

Keyboard shortcuts

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