k8s

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const ReasonEvicted = "Evicted"

Variables

This section is empty.

Functions

func AWSCredentials

func AWSCredentials() []kcore.EnvVar

func CPU

func CPU(cpu string) kresource.Quantity

func ConfigMap added in v0.7.0

func ConfigMap(spec *ConfigMapSpec) *kcore.ConfigMap

func ConfigMapMap added in v0.7.0

func ConfigMapMap(configMaps []kcore.ConfigMap) map[string]kcore.ConfigMap

func Deployment

func Deployment(spec *DeploymentSpec) *kapps.Deployment

func DeploymentMap

func DeploymentMap(deployments []kapps.Deployment) map[string]kapps.Deployment

func DeploymentStartTime

func DeploymentStartTime(deployment *kapps.Deployment) *time.Time

func EmptyDirVolume

func EmptyDirVolume(volumeName string) kcore.Volume

func EmptyDirVolumeMount

func EmptyDirVolumeMount(volumeName string, mountPath string) kcore.VolumeMount

func ErrorParseQuantity added in v0.9.0

func ErrorParseQuantity(qtyStr string) error

func FieldSelectorNotIn

func FieldSelectorNotIn(key string, values []string) string

func GetPodReadyTime added in v0.7.0

func GetPodReadyTime(pod *kcore.Pod) *time.Time

func GetVirtualServiceEndpoints added in v0.10.0

func GetVirtualServiceEndpoints(virtualService *kunstructured.Unstructured) (strset.Set, error)

func GetVirtualServiceGateways added in v0.10.0

func GetVirtualServiceGateways(virtualService *kunstructured.Unstructured) (strset.Set, error)

func HPA added in v0.6.0

func Ingress

func Ingress(spec *IngressSpec) *kextensions.Ingress

func IngressMap

func IngressMap(ingresses []kextensions.Ingress) map[string]kextensions.Ingress

func IsHPAUpToDate added in v0.7.0

func IsHPAUpToDate(hpa *kautoscaling.HorizontalPodAutoscaler, minReplicas int32, maxReplicas int32, targetCPUUtilization int32) bool

func IsPodReady added in v0.7.0

func IsPodReady(pod *kcore.Pod) bool

func Job

func Job(spec *JobSpec) *kbatch.Job

func JobMap

func JobMap(jobs []kbatch.Job) map[string]kbatch.Job

func LabelSelector

func LabelSelector(labels map[string]string) string

func Mem

func Mem(mem string) kresource.Quantity

func Pod

func Pod(spec *PodSpec) *kcore.Pod

func PodMap

func PodMap(pods []kcore.Pod) map[string]kcore.Pod

func QuantityParser added in v0.11.0

func QuantityParser(v *QuantityValidation) func(string) (interface{}, error)

func QuantityPtr added in v0.11.0

func QuantityPtr(k8sQuantity kresource.Quantity) *kresource.Quantity

func QuantityPtrID added in v0.11.0

func QuantityPtrID(quantity *Quantity) string

func QuantityPtrsEqual added in v0.11.0

func QuantityPtrsEqual(quantity *Quantity, quantity2 *Quantity) bool

func Service

func Service(spec *ServiceSpec) *kcore.Service

func ServiceMap

func ServiceMap(services []kcore.Service) map[string]kcore.Service

func ValidName

func ValidName(name string) string

ValidName ensures name contains only lower case alphanumeric, '-', or '.'

func ValidNameContainer

func ValidNameContainer(name string) string

ValidNameContainer ensures name contains only lower case alphanumeric or '-', must start with alphabetic, end with alphanumeric

func VirtualService added in v0.8.0

func VirtualService(spec *VirtualServiceSpec) *kunstructured.Unstructured

Types

type Client

type Client struct {
	RestConfig *kclientrest.Config

	Namespace string
	// contains filtered or unexported fields
}

func New

func New(namespace string, inCluster bool) (*Client, error)

func (*Client) ApplyConfigMap added in v0.7.0

func (c *Client) ApplyConfigMap(configMap *kcore.ConfigMap) (*kcore.ConfigMap, error)

func (*Client) ApplyDeployment added in v0.7.0

func (c *Client) ApplyDeployment(deployment *kapps.Deployment) (*kapps.Deployment, error)

func (*Client) ApplyHPA added in v0.7.0

func (*Client) ApplyIngress added in v0.7.0

func (c *Client) ApplyIngress(ingress *kextensions.Ingress) (*kextensions.Ingress, error)

func (*Client) ApplyJob added in v0.7.0

func (c *Client) ApplyJob(job *kbatch.Job) (*kbatch.Job, error)

func (*Client) ApplyPod added in v0.7.0

func (c *Client) ApplyPod(pod *kcore.Pod) (*kcore.Pod, error)

func (*Client) ApplyService added in v0.7.0

func (c *Client) ApplyService(service *kcore.Service) (*kcore.Service, error)

func (*Client) ApplyVirtualService added in v0.8.0

func (c *Client) ApplyVirtualService(spec *kunstructured.Unstructured) (*kunstructured.Unstructured, error)

func (*Client) ConfigMapExists added in v0.7.0

func (c *Client) ConfigMapExists(name string) (bool, error)

func (*Client) CreateConfigMap added in v0.7.0

func (c *Client) CreateConfigMap(configMap *kcore.ConfigMap) (*kcore.ConfigMap, error)

func (*Client) CreateDeployment

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

func (*Client) CreateHPA added in v0.6.0

func (*Client) CreateIngress

func (c *Client) CreateIngress(ingress *kextensions.Ingress) (*kextensions.Ingress, error)

func (*Client) CreateJob

func (c *Client) CreateJob(job *kbatch.Job) (*kbatch.Job, error)

func (*Client) CreatePod

func (c *Client) CreatePod(pod *kcore.Pod) (*kcore.Pod, error)

func (*Client) CreateService

func (c *Client) CreateService(service *kcore.Service) (*kcore.Service, error)

func (*Client) CreateVirtualService added in v0.8.0

func (c *Client) CreateVirtualService(spec *kunstructured.Unstructured) (*kunstructured.Unstructured, error)

func (*Client) DeleteConfigMap added in v0.7.0

func (c *Client) DeleteConfigMap(name string) (bool, error)

func (*Client) DeleteDeployment

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

func (*Client) DeleteHPA added in v0.6.0

func (c *Client) DeleteHPA(name string) (bool, error)

func (*Client) DeleteIngress

func (c *Client) DeleteIngress(name string) (bool, error)

func (*Client) DeleteJob

func (c *Client) DeleteJob(name string) (bool, error)

func (*Client) DeletePod

func (c *Client) DeletePod(name string) (bool, error)

func (*Client) DeleteService

func (c *Client) DeleteService(name string) (bool, error)

func (*Client) DeleteVirtualService added in v0.8.0

func (c *Client) DeleteVirtualService(name, namespace string) (bool, error)

func (*Client) DeploymentExists

func (c *Client) DeploymentExists(name string) (bool, error)

func (*Client) GetConfigMap added in v0.7.0

func (c *Client) GetConfigMap(name string) (*kcore.ConfigMap, error)

func (*Client) GetConfigMapData added in v0.7.0

func (c *Client) GetConfigMapData(name string) (map[string]string, error)

func (*Client) GetDeployment

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

func (*Client) GetHPA added in v0.6.0

func (*Client) GetIngress

func (c *Client) GetIngress(name string) (*kextensions.Ingress, error)

func (*Client) GetJob

func (c *Client) GetJob(name string) (*kbatch.Job, error)

func (*Client) GetPod

func (c *Client) GetPod(name string) (*kcore.Pod, error)

func (*Client) GetService

func (c *Client) GetService(name string) (*kcore.Service, error)

func (*Client) GetVirtualService added in v0.8.0

func (c *Client) GetVirtualService(name, namespace string) (*kunstructured.Unstructured, error)

func (*Client) HPAExists added in v0.6.0

func (c *Client) HPAExists(name string) (bool, error)

func (*Client) IngressExists

func (c *Client) IngressExists(name string) (bool, error)

func (*Client) IsJobRunning added in v0.7.0

func (c *Client) IsJobRunning(name string) (bool, error)

func (*Client) JobExists

func (c *Client) JobExists(name string) (bool, error)

func (*Client) ListConfigMaps added in v0.7.0

func (c *Client) ListConfigMaps(opts *kmeta.ListOptions) ([]kcore.ConfigMap, error)

func (*Client) ListConfigMapsByLabel added in v0.7.0

func (c *Client) ListConfigMapsByLabel(labelKey string, labelValue string) ([]kcore.ConfigMap, error)

func (*Client) ListConfigMapsByLabels added in v0.7.0

func (c *Client) ListConfigMapsByLabels(labels map[string]string) ([]kcore.ConfigMap, error)

func (*Client) ListDeployments

func (c *Client) ListDeployments(opts *kmeta.ListOptions) ([]kapps.Deployment, error)

func (*Client) ListDeploymentsByLabel

func (c *Client) ListDeploymentsByLabel(labelKey string, labelValue string) ([]kapps.Deployment, error)

func (*Client) ListDeploymentsByLabels

func (c *Client) ListDeploymentsByLabels(labels map[string]string) ([]kapps.Deployment, error)

func (*Client) ListHPAs added in v0.6.0

func (*Client) ListHPAsByLabel added in v0.6.0

func (c *Client) ListHPAsByLabel(labelKey string, labelValue string) ([]kautoscaling.HorizontalPodAutoscaler, error)

func (*Client) ListHPAsByLabels added in v0.6.0

func (c *Client) ListHPAsByLabels(labels map[string]string) ([]kautoscaling.HorizontalPodAutoscaler, error)

func (*Client) ListIngresses

func (c *Client) ListIngresses(opts *kmeta.ListOptions) ([]kextensions.Ingress, error)

func (*Client) ListIngressesByLabel

func (c *Client) ListIngressesByLabel(labelKey string, labelValue string) ([]kextensions.Ingress, error)

func (*Client) ListIngressesByLabels

func (c *Client) ListIngressesByLabels(labels map[string]string) ([]kextensions.Ingress, error)

func (*Client) ListJobs

func (c *Client) ListJobs(opts *kmeta.ListOptions) ([]kbatch.Job, error)

func (*Client) ListJobsByLabel

func (c *Client) ListJobsByLabel(labelKey string, labelValue string) ([]kbatch.Job, error)

func (*Client) ListJobsByLabels

func (c *Client) ListJobsByLabels(labels map[string]string) ([]kbatch.Job, error)

func (*Client) ListNodes added in v0.8.0

func (c *Client) ListNodes(opts *kmeta.ListOptions) ([]kcore.Node, error)

func (*Client) ListPods

func (c *Client) ListPods(opts *kmeta.ListOptions) ([]kcore.Pod, error)

func (*Client) ListPodsByLabel

func (c *Client) ListPodsByLabel(labelKey string, labelValue string) ([]kcore.Pod, error)

func (*Client) ListPodsByLabels

func (c *Client) ListPodsByLabels(labels map[string]string) ([]kcore.Pod, error)

func (*Client) ListServices

func (c *Client) ListServices(opts *kmeta.ListOptions) ([]kcore.Service, error)

func (*Client) ListServicesByLabel

func (c *Client) ListServicesByLabel(labelKey string, labelValue string) ([]kcore.Service, error)

func (*Client) ListServicesByLabels

func (c *Client) ListServicesByLabels(labels map[string]string) ([]kcore.Service, error)

func (*Client) ListVirtualServices added in v0.8.0

func (c *Client) ListVirtualServices(namespace string, opts *kmeta.ListOptions) ([]kunstructured.Unstructured, error)

func (*Client) ListVirtualServicesByLabel added in v0.8.0

func (c *Client) ListVirtualServicesByLabel(namespace string, labelKey string, labelValue string) ([]kunstructured.Unstructured, error)

func (*Client) ListVirtualServicesByLabels added in v0.8.0

func (c *Client) ListVirtualServicesByLabels(namespace string, labels map[string]string) ([]kunstructured.Unstructured, error)

func (*Client) PodExists

func (c *Client) PodExists(name string) (bool, error)

func (*Client) ServiceExists

func (c *Client) ServiceExists(name string) (bool, error)

func (*Client) StalledPods

func (c *Client) StalledPods() ([]kcore.Pod, error)

func (*Client) VirtualServiceExists added in v0.8.0

func (c *Client) VirtualServiceExists(name, namespace string) (bool, error)

func (*Client) WaitForPodRunning

func (c *Client) WaitForPodRunning(name string, numSeconds int) error

type ConfigMapSpec added in v0.7.0

type ConfigMapSpec struct {
	Name        string
	Namespace   string
	Data        map[string]string
	Labels      map[string]string
	Annotations map[string]string
}

type DeploymentSpec

type DeploymentSpec struct {
	Name        string
	Namespace   string
	Replicas    int32
	PodSpec     PodSpec
	Selector    map[string]string
	Labels      map[string]string
	Annotations map[string]string
}

type Error added in v0.9.0

type Error struct {
	Kind ErrorKind
	// contains filtered or unexported fields
}

func (Error) Error added in v0.9.0

func (e Error) Error() string

type ErrorKind added in v0.9.0

type ErrorKind int
const (
	ErrUnknown       ErrorKind = iota
	ErrParseQuantity ErrorKind = iota
)

func (ErrorKind) MarshalBinary added in v0.9.0

func (t ErrorKind) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (ErrorKind) MarshalText added in v0.9.0

func (t ErrorKind) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (ErrorKind) String added in v0.9.0

func (t ErrorKind) String() string

func (*ErrorKind) UnmarshalBinary added in v0.9.0

func (t *ErrorKind) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*ErrorKind) UnmarshalText added in v0.9.0

func (t *ErrorKind) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type HPASpec added in v0.6.0

type HPASpec struct {
	DeploymentName       string
	Namespace            string
	MinReplicas          int32
	MaxReplicas          int32
	TargetCPUUtilization int32
	Labels               map[string]string
	Annotations          map[string]string
}

type IngressSpec

type IngressSpec struct {
	Name         string
	Namespace    string
	IngressClass string
	ServiceName  string
	ServicePort  int32
	Path         string
	Labels       map[string]string
	Annotations  map[string]string
}

type JobSpec

type JobSpec struct {
	Name        string
	Namespace   string
	PodSpec     PodSpec
	Labels      map[string]string
	Annotations map[string]string
}

type PodSpec

type PodSpec struct {
	Name        string
	Namespace   string
	K8sPodSpec  kcore.PodSpec
	Labels      map[string]string
	Annotations map[string]string
}

type PodStatus added in v0.5.0

type PodStatus string
const (
	PodStatusUnknown      PodStatus = "Unknown"
	PodStatusPending      PodStatus = "Pending"
	PodStatusInitializing PodStatus = "Initializing"
	PodStatusRunning      PodStatus = "Running"
	PodStatusTerminating  PodStatus = "Terminating"
	PodStatusSucceeded    PodStatus = "Succeeded"
	PodStatusFailed       PodStatus = "Failed"
	PodStatusKilled       PodStatus = "Killed"
	PodStatusKilledOOM    PodStatus = "Out of Memory"
)

func GetPodStatus

func GetPodStatus(pod *kcore.Pod) PodStatus

func PodStatusFromContainerStatuses added in v0.8.0

func PodStatusFromContainerStatuses(containerStatuses []kcore.ContainerStatus) PodStatus

type Quantity added in v0.11.0

type Quantity struct {
	kresource.Quantity
	UserString string
}

func (*Quantity) Equal added in v0.11.0

func (quantity *Quantity) Equal(quantity2 Quantity) bool

func (*Quantity) ID added in v0.11.0

func (quantity *Quantity) ID() string

func (Quantity) MarshalBinary added in v0.11.0

func (quantity Quantity) MarshalBinary() ([]byte, error)

func (Quantity) MarshalJSON added in v0.11.0

func (quantity Quantity) MarshalJSON() ([]byte, error)

func (Quantity) MarshalText added in v0.11.0

func (quantity Quantity) MarshalText() ([]byte, error)

func (Quantity) MarshalYAML added in v0.11.0

func (quantity Quantity) MarshalYAML() (interface{}, error)

func (*Quantity) SplitInTwo added in v0.11.0

func (quantity *Quantity) SplitInTwo() (*kresource.Quantity, *kresource.Quantity)

SplitInTwo divides the quantity in two and return both halves (ensuring they add up to the original value)

func (*Quantity) String added in v0.11.0

func (quantity *Quantity) String() string

func (*Quantity) ToFloat32 added in v0.11.0

func (quantity *Quantity) ToFloat32() float32

func (*Quantity) ToKi added in v0.11.0

func (quantity *Quantity) ToKi() int64

func (*Quantity) UnmarshalBinary added in v0.11.0

func (quantity *Quantity) UnmarshalBinary(data []byte) error

func (*Quantity) UnmarshalJSON added in v0.11.0

func (quantity *Quantity) UnmarshalJSON(data []byte) error

func (*Quantity) UnmarshalText added in v0.11.0

func (quantity *Quantity) UnmarshalText(data []byte) error

func (*Quantity) UnmarshalYAML added in v0.11.0

func (quantity *Quantity) UnmarshalYAML(unmarshal func(interface{}) error) error

type QuantityValidation added in v0.11.0

type QuantityValidation struct {
	GreaterThan          *kresource.Quantity
	GreaterThanOrEqualTo *kresource.Quantity
	LessThan             *kresource.Quantity
	LessThanOrEqualTo    *kresource.Quantity
}

type ServiceSpec

type ServiceSpec struct {
	Name        string
	Namespace   string
	Port        int32
	TargetPort  int32
	Selector    map[string]string
	Labels      map[string]string
	Annotations map[string]string
}

type VirtualServiceSpec added in v0.8.0

type VirtualServiceSpec struct {
	Name        string
	Namespace   string
	Gateways    []string
	ServiceName string
	ServicePort int32
	Path        string
	Rewrite     *string
	Labels      map[string]string
	Annotations map[string]string
}

Jump to

Keyboard shortcuts

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