kube

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const KubeVersion = "v1.13.4"

KubeVersion is the version of kubernetes we will install and assume to be working with

View Source
const Pure1UnpluggedNamespace = "pure1-unplugged"

Pure1UnpluggedNamespace Kubernetes namespace for running the Pure1 Unplugged application

View Source
const SystemNamespace = "kube-system"

SystemNamespace Kubernetes namespace for kubernetes infrastructure components

Variables

This section is empty.

Functions

func GetPodStatuses

func GetPodStatuses(ctx cli.Context, namespace string, expectedPodGroups map[string]*PodGroupInfo) (map[string]*PodGroupInfo, error)

GetPodStatuses will list all pods in the given namespace and then fill in the PodGroupInfo map passed in, and return a reference to the completed version. We only consider pods in the group ready if we can find one matching the pattern, and it is in the correct ready status.

func GetPods

func GetPods(ctx cli.Context, namespace string) ([]string, error)

GetPods gets a list of all pods in the given namespace

func GetPodsFiltered

func GetPodsFiltered(ctx cli.Context, namespace string, filter string) ([]string, error)

GetPodsFiltered gets a list of all pods in the given namespace, filtered by if the name contains the given filter string

func RunHelm

func RunHelm(exec exechelper.Executor, timeout int, helmArgs ...string) (string, error)

RunHelm runs helm and injects in our kubeconfig info

func RunKubeCTL

func RunKubeCTL(exec exechelper.Executor, kubectlArgs ...string) (string, error)

RunKubeCTL will run 'kubectl' and specify our known location for kubeconfig

func RunKubeCTLWithNamespace

func RunKubeCTLWithNamespace(exec exechelper.Executor, namespace string, kubectlArgs ...string) (string, error)

RunKubeCTLWithNamespace is a helper to inject namespace options into kubectl calls without having to always say "--namespace" blah blah

func RunKubeCTLWithNamespaceRetryOnError

func RunKubeCTLWithNamespaceRetryOnError(exec exechelper.Executor, namespace string, timeout int, kubectlArgs ...string) (string, error)

RunKubeCTLWithNamespaceRetryOnError is a wrapper around `RunKubeCTLWithNamespace` that will blindly retry on any error mostly useful for poking the API server after restarts to swallow errors as things come back online.

func RunKubeCTLWithTimeout

func RunKubeCTLWithTimeout(exec exechelper.Executor, timeout int, kubectlArgs ...string) (string, error)

RunKubeCTLWithTimeout will run 'kubectl' and specify our known location for kubeconfig

Types

type ContainerStatus

type ContainerStatus struct {
	Ready bool `json:"ready,omitempty"`
}

ContainerStatus provides minimal json parsing helpers for kubectl output of pod definitions

type Pod

type Pod struct {
	Metadata PodMetadata `json:"metadata,omitempty"`
	Status   PodStatus   `json:"status,omitempty"`
}

Pod provides minimal json parsing helpers for kubectl output of pod definitions

type PodGroupInfo

type PodGroupInfo struct {
	Pattern       string
	ReadyCount    int
	ExpectedCount int
	Pods          []string
}

PodGroupInfo defines a pod group that matches some pattern for the name and details about the group. Useful for checking on pods in a replica-set or deployment where you don't know the exact name (and don't care), but want to make sure enough are online.

func NewPodGroupInfo

func NewPodGroupInfo(pattern string, expectedCount int) *PodGroupInfo

NewPodGroupInfo is just a helper to create the PodGroupInfo objects

type PodListResponse

type PodListResponse struct {
	APIVersion string `json:"apiVersion"`
	Items      []Pod  `json:"items,omitempty"`
}

PodListResponse provides minimal json parsing helpers for kubectl output of pod definitions

type PodMetadata

type PodMetadata struct {
	Name string `json:"name,omitempty"`
}

PodMetadata provides minimal json parsing helpers for kubectl output of pod definitions

type PodStatus

type PodStatus struct {
	Phase             string            `json:"phase,omitempty"`
	ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"`
}

PodStatus provides minimal json parsing helpers for kubectl output of pod definitions

Jump to

Keyboard shortcuts

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