Documentation ¶
Index ¶
- Constants
- type Deployment
- func (d *Deployment) GetGeneration() int
- func (d *Deployment) GetKey() string
- func (d *Deployment) GetKind() string
- func (d *Deployment) GetName() string
- func (d *Deployment) GetNamespace() string
- func (d *Deployment) GetPodSelector() []string
- func (d *Deployment) GetSelector() []string
- func (d *Deployment) GetStatusString() string
- func (d *Deployment) GetUUID() string
- func (d *Deployment) IsReady() bool
- func (d *Deployment) ToDeployment() (*Deployment, error)
- type KubeCall
- func CommandApply(configurationYaml string) *KubeCall
- func CommandDeploymentInfo(namespace string, name string) *KubeCall
- func CommandDeploymentList(namespace string) *KubeCall
- func CommandDeploymentListBySelector(namespace string, selector []string) *KubeCall
- func CommandExec(namespace, pod, container, command string) *KubeCall
- func CommandNamespaceList() *KubeCall
- func CommandPodListBySelector(namespace string, selector []string) *KubeCall
- func CommandPodLogs(namespace, name string, container string) *KubeCall
- func CommandReplicaSetList(namespace string) *KubeCall
- func CommandReplicaSetListBySelector(namespace string, selector []string) *KubeCall
- func CommandRollback(namespace, kind, name string) *KubeCall
- type KubeResourceInterface
- type Namespace
- type Pod
- type ReplicaSet
- type ResourceList
Constants ¶
const ( // KindDeployment name of Deployment resource type KindDeployment = "deployment" // KindReplicaSet name of ReplicaSet resource type KindReplicaSet = "replicaset" // KindNamespace name of Namespace resource type KindNamespace = "namespace" // KindPod name of Pod resource type KindPod = "pod" // KindList name of List resource type KindList = "list" // PodStatusRunning string representation of running pod PodStatusRunning = "Running" // ClusterContextEnv is the name of environment variable to get kubectl requested context ClusterContextEnv = "CLUSTER_CONTEXT" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deployment ¶
type Deployment struct { Kind string `yaml:"kind"` Metadata resourceMetadata `yaml:"metadata"` Spec resourceSpec `yaml:"spec"` Status resourceStatus `yaml:"status"` }
Deployment is k8s Deployment resource
func (*Deployment) GetGeneration ¶
func (d *Deployment) GetGeneration() int
GetGeneration will return current deployment generation
func (*Deployment) GetKey ¶
func (d *Deployment) GetKey() string
GetKey will return unique name within a cluster
func (*Deployment) GetKind ¶
func (d *Deployment) GetKind() string
GetKind interface method support, returns string "deployment"
func (*Deployment) GetName ¶
func (d *Deployment) GetName() string
GetName return name of Deployment
func (*Deployment) GetNamespace ¶
func (d *Deployment) GetNamespace() string
GetNamespace return deployment namespace
func (*Deployment) GetPodSelector ¶
func (d *Deployment) GetPodSelector() []string
GetPodSelector return slice of selectors associated with Deployment Spec template
func (*Deployment) GetSelector ¶
func (d *Deployment) GetSelector() []string
GetSelector return slice of selectors associated with Deployment
func (*Deployment) GetStatusString ¶
func (d *Deployment) GetStatusString() string
GetStatusString return deployment status message
func (*Deployment) GetUUID ¶
func (d *Deployment) GetUUID() string
GetUUID return UUID of deployment
func (*Deployment) IsReady ¶
func (d *Deployment) IsReady() bool
IsReady check deploy has been rolled out @see https://kubernetes.io/docs/user-guide/deployments/#the-status-of-a-deployment
func (*Deployment) ToDeployment ¶
func (d *Deployment) ToDeployment() (*Deployment, error)
ToDeployment interface method
type KubeCall ¶
type KubeCall struct { Cmd kubeCommandInterface Parser kubeResourceParserInterface }
KubeCall is kubectl wrapper combined with parser
func CommandApply ¶
CommandApply apply new yaml configuration to cluster
func CommandDeploymentInfo ¶
CommandDeploymentInfo get information about single deployment
func CommandDeploymentList ¶
CommandDeploymentList return call which return list of deployments registered in kubernetes clusted
func CommandDeploymentListBySelector ¶
CommandDeploymentListBySelector fetch deployments by provided selector
func CommandExec ¶
CommandExec execute command in container of pod
func CommandNamespaceList ¶
func CommandNamespaceList() *KubeCall
CommandNamespaceList return call which will return list of namespaces registered in kubernetes cluster
func CommandPodListBySelector ¶
CommandPodListBySelector return list of pods in namespace with selector
func CommandPodLogs ¶
CommandPodLogs return logs for pod
func CommandReplicaSetList ¶
CommandReplicaSetList return call which return list of replicasets registered in kubernetes cluster
func CommandReplicaSetListBySelector ¶
CommandReplicaSetListBySelector get replica set list by selector
func CommandRollback ¶
CommandRollback allow to rollback any resource to previous version
func (*KubeCall) RunAndParse ¶
func (c *KubeCall) RunAndParse() (ResourceList, error)
RunAndParse run command and try to parse output with provided parser
func (*KubeCall) RunAndParseFirst ¶
func (c *KubeCall) RunAndParseFirst() (KubeResourceInterface, error)
RunAndParseFirst run command, parse output and return first element of decoded items
type KubeResourceInterface ¶
type KubeResourceInterface interface { GetKind() string GetName() string ToDeployment() (*Deployment, error) }
KubeResourceInterface is common interface to all k8s resource types
type Namespace ¶
type Namespace struct { Kind string `yaml:"kind"` Metadata resourceMetadata `yaml:"metadata"` }
Namespace is k8s Namespace resource
func (*Namespace) ToDeployment ¶
func (n *Namespace) ToDeployment() (*Deployment, error)
ToDeployment interface method
type Pod ¶
type Pod struct { Kind string `yaml:"kind"` Metadata resourceMetadata `yaml:"metadata"` Spec resourceContainerSpec `yaml:"spec"` Status resourceStatus `yaml:"status"` }
Pod is k8s Pod resource
func (*Pod) GetNamespace ¶
GetNamespace return namespace name for pod
func (*Pod) ToDeployment ¶
func (p *Pod) ToDeployment() (*Deployment, error)
ToDeployment interface method
type ReplicaSet ¶
type ReplicaSet struct { Kind string `yaml:"kind"` Metadata resourceMetadata `yaml:"metadata"` Spec resourceSpec `yaml:"spec"` Status resourceStatus `yaml:"status"` }
ReplicaSet is k8s ReplicaSet resource
func (*ReplicaSet) GetImages ¶
func (r *ReplicaSet) GetImages() []string
GetImages return list of docker images registered in ReplicaSet
func (*ReplicaSet) GetKind ¶
func (r *ReplicaSet) GetKind() string
GetKind interface method support, returns string "replicaset"
func (*ReplicaSet) GetName ¶
func (r *ReplicaSet) GetName() string
GetName return name of ReplicaSet
func (*ReplicaSet) ToDeployment ¶
func (r *ReplicaSet) ToDeployment() (*Deployment, error)
ToDeployment interface method
type ResourceList ¶
type ResourceList []KubeResourceInterface
ResourceList is an alias for []KubeResourceInterface
func ParseLocalFile ¶
func ParseLocalFile(filename string) (ResourceList, error)
ParseLocalFile will allow to parse local file and fetch all resources defined there
func (ResourceList) FilteredByKind ¶
func (rl ResourceList) FilteredByKind(kind string) ResourceList
FilteredByKind return filtered slice of resources by kind
func (ResourceList) ToDeploymentList ¶
func (rl ResourceList) ToDeploymentList() []Deployment
ToDeploymentList is helper to convert []KubeResourceInterface to []Deployment
func (ResourceList) ToNamespaceList ¶
func (rl ResourceList) ToNamespaceList() []Namespace
ToNamespaceList is helper to convert []KubeResourceInterface type to []Namespace
func (ResourceList) ToPodList ¶
func (rl ResourceList) ToPodList() []Pod
ToPodList is helper to convert []KubeResourceInterface type to []Pod
func (ResourceList) ToReplicaSetList ¶
func (rl ResourceList) ToReplicaSetList() []ReplicaSet
ToReplicaSetList is helper to convert []KubeResourceInterface to []ReplicaSet