kube

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDeployments added in v0.6.0

func ConvertDeployments(data []byte) ([]appsv1.Deployment, error)

ConvertDeployments returns the Deployments from this result

func ConvertReleaseName added in v0.8.6

func ConvertReleaseName(data []byte) (string, error)

ConvertReleaseName returns the ReleaseName from this result

func ConvertStatefulSet added in v0.6.0

func ConvertStatefulSet(data []byte) ([]appsv1.StatefulSet, error)

ConvertStatefulSet returns the StatefulSets from this result

func ConvertStatus added in v0.6.0

func ConvertStatus(data []byte) (bool, error)

ConvertStatus returns the status from this result

func GetInClusterConfig added in v0.6.0

func GetInClusterConfig() (*rest.Config, error)

GetInClusterConfig gets the rest config for this cluster

Types

type Agent

type Agent interface {
	GetDeployments(args *Args) (*Result, error)
	GetReleaseName(args *Args) (*Result, error)
	GetStatefulSets(args *Args) (*Result, error)
	GetStatus(args *Args) (*Result, error)
}

Agent is used for communication with Kubernetes, made into an interface for testability

type AgentAction added in v0.6.0

type AgentAction string

AgentAction is an enum/alias to make calling methods typed

const (
	// GetDeployments represents the GetDeployments method
	GetDeployments AgentAction = "GetDeployments"

	// GetReleaseName represents the GetReleaseName method
	GetReleaseName AgentAction = "GetReleaseName"

	// GetStatefulSets represents the GetStatefulSets method
	GetStatefulSets AgentAction = "GetStatefulSets"

	// GetStatus represents the GetStatus method
	GetStatus AgentAction = "GetStatus"
)

type Args added in v0.6.0

type Args struct {
	Labels    *map[string]string
	Namespace string
}

Args are arguments common to all commands

func ConvertArgs added in v0.6.0

func ConvertArgs(data []byte) (*Args, error)

ConvertArgs converts byte data back to args

type DefaultAgent

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

DefaultAgent is the default implementation of the KubeAgent

func NewDefaultAgent added in v0.6.0

func NewDefaultAgent(kubeFunc func() (kubernetes.Interface, error)) *DefaultAgent

NewDefaultAgent inits the default agent with the specified kube interface

func (DefaultAgent) GetDeployments added in v0.6.0

func (k DefaultAgent) GetDeployments(args *Args) (*Result, error)

GetDeployments gets all the deployments for a particular cluster

func (DefaultAgent) GetReleaseName added in v0.8.6

func (k DefaultAgent) GetReleaseName(args *Args) (*Result, error)

GetReleaseName name gets a helm release name from the annotation meta.helm.sh/release-name based on label selectors

func (DefaultAgent) GetStatefulSets added in v0.6.0

func (k DefaultAgent) GetStatefulSets(args *Args) (*Result, error)

GetStatefulSets gets all the statefulsets for a particular cluster

func (DefaultAgent) GetStatus added in v0.6.0

func (k DefaultAgent) GetStatus(args *Args) (*Result, error)

GetStatus returns the status of a cluster by ensuring each node is in a ready state

type ReleaseNotFoundError added in v0.8.6

type ReleaseNotFoundError struct{}

ReleaseNotFoundError represents an error when searching for a result name but none is found

func (ReleaseNotFoundError) Error added in v0.8.6

func (err ReleaseNotFoundError) Error() string

type Result added in v0.6.0

type Result struct {
	Data interface{}
	Type ResultType
}

Result is the type this agent returns

type ResultType added in v0.6.0

type ResultType string

ResultType represents types to convert for this response

const (
	// DeploymentsResult represents a result of Deployments
	DeploymentsResult ResultType = "DeploymentsResult"

	// ReleaseNameResult represents a helm release name lookup
	ReleaseNameResult ResultType = "ReleaseNameResult"

	// StatefulSetsResult represents a result of StatefulSets
	StatefulSetsResult ResultType = "StatefulSetsResult"

	// StatusResult represents a Status result
	StatusResult ResultType = "StatusResult"
)

type ResultTypeError added in v0.6.0

type ResultTypeError struct{}

ResultTypeError is an eror when the wrong type conversion is made with a result

func (ResultTypeError) Error added in v0.6.0

func (err ResultTypeError) Error() string

Jump to

Keyboard shortcuts

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