k8s

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodStatusUnknown     = "Unknown"
	PodStatusPending     = "Pending"
	PodStatusRunning     = "Running"
	PodStatusTerminating = "Terminating"
	PodStatusSucceeded   = "Succeeded"
	PodStatusFailed      = "Failed"
	PodStatusKilled      = "Killed"
	PodStatusKilledOOM   = "Out of Memory"
)
View Source
const DeploymentSuccessConditionAll = "!status.unavailableReplicas"
View Source
const JobFailureCondition = "status.failed > 0"
View Source
const JobSuccessCondition = "status.succeeded > 0"

Variables

This section is empty.

Functions

func AWSCredentials

func AWSCredentials() []corev1.EnvVar

func CPU

func CPU(cpu string) k8sresource.Quantity

func CortexConfigVolume

func CortexConfigVolume() corev1.Volume

func CortexConfigVolumeMount

func CortexConfigVolumeMount() corev1.VolumeMount

func DefaultVolumeMounts

func DefaultVolumeMounts() []corev1.VolumeMount

func DefaultVolumes

func DefaultVolumes() []corev1.Volume

func Deployment

func Deployment(spec *DeploymentSpec) *appsv1b1.Deployment

func DeploymentMap

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

func DeploymentStartTime

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

func EmptyDirVolume

func EmptyDirVolume() corev1.Volume

func EmptyDirVolumeMount

func EmptyDirVolumeMount() corev1.VolumeMount

func FieldSelectorNotIn

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

func GetPodLastContainerStartTime

func GetPodLastContainerStartTime(pod *corev1.Pod) *time.Time

func GetPodStatus

func GetPodStatus(pod *corev1.Pod) string

func Ingress

func Ingress(spec *IngressSpec) *v1beta1.Ingress

func IngressMap

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

func Job

func Job(spec *JobSpec) *batchv1.Job

func JobMap

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

func LabelSelector

func LabelSelector(labels map[string]string) string

func Mem

func Mem(mem string) k8sresource.Quantity

func Pod

func Pod(spec *PodSpec) *corev1.Pod

func PodMap

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

func Service

func Service(spec *ServiceSpec) *corev1.Service

func ServiceMap

func ServiceMap(services []corev1.Service) map[string]corev1.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

Types

type Client

type Client struct {
	RestConfig *rest.Config

	Namespace string
	// contains filtered or unexported fields
}

func New

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

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(spec *DeploymentSpec) (*appsv1b1.Deployment, error)

func (*Client) CreateIngress

func (c *Client) CreateIngress(spec *IngressSpec) (*v1beta1.Ingress, error)

func (*Client) CreateJob

func (c *Client) CreateJob(spec *JobSpec) (*batchv1.Job, error)

func (*Client) CreatePod

func (c *Client) CreatePod(spec *PodSpec) (*corev1.Pod, error)

func (*Client) CreateService

func (c *Client) CreateService(spec *ServiceSpec) (*corev1.Service, error)

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(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) DeploymentExists

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

func (*Client) GetDeployment

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

func (*Client) GetIngress

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

func (*Client) GetJob

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

func (*Client) GetPod

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

func (*Client) GetService

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

func (*Client) IngressExists

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

func (*Client) JobExists

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

func (*Client) ListDeployments

func (c *Client) ListDeployments(opts *metav1.ListOptions) ([]appsv1b1.Deployment, error)

func (*Client) ListDeploymentsByLabel

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

func (*Client) ListDeploymentsByLabels

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

func (*Client) ListIngresses

func (c *Client) ListIngresses(opts *metav1.ListOptions) ([]v1beta1.Ingress, error)

func (*Client) ListIngressesByLabel

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

func (*Client) ListIngressesByLabels

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

func (*Client) ListJobs

func (c *Client) ListJobs(opts *metav1.ListOptions) ([]batchv1.Job, error)

func (*Client) ListJobsByLabel

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

func (*Client) ListJobsByLabels

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

func (*Client) ListPods

func (c *Client) ListPods(opts *metav1.ListOptions) ([]corev1.Pod, error)

func (*Client) ListPodsByLabel

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

func (*Client) ListPodsByLabels

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

func (*Client) ListServices

func (c *Client) ListServices(opts *metav1.ListOptions) ([]corev1.Service, error)

func (*Client) ListServicesByLabel

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

func (*Client) ListServicesByLabels

func (c *Client) ListServicesByLabels(labels map[string]string) ([]corev1.Service, 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() ([]corev1.Pod, error)

func (*Client) UpdateDeployment

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

func (*Client) UpdateJob

func (c *Client) UpdateJob(job *batchv1.Job) (*batchv1.Job, error)

func (*Client) WaitForPodRunning

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

type DeploymentSpec

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

type IngressSpec

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

type JobSpec

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

type PodSpec

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

type ServiceSpec

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

Jump to

Keyboard shortcuts

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