kubernetes

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APISGroupName is the api name used for epinio
	APISGroupName = "epinio.io"
)

Variables

View Source
var (
	EpinioNamespaceLabelKey     = "app.kubernetes.io/component"
	EpinioNamespaceLabelValue   = "epinio-namespace"
	EpinioAPISecretLabelKey     = fmt.Sprintf("%s/%s", APISGroupName, "api-user-credentials")
	EpinioAPISecretLabelValue   = "true"
	EpinioAPISecretRoleLabelKey = fmt.Sprintf("%s/%s", APISGroupName, "role")
)

Functions

func GetHTTP1Client added in v0.9.0

func GetHTTP1Client(ctx context.Context) (*kubernetes.Clientset, error)

GetHTTP1Client returns a clientset that is always using HTTP/1.1 (not HTTP2) We need that when using the SPDY protocol and UPGRADE requests which HTTP2 doesn't understand: https://github.com/golang/net/blob/183a9ca12b87817e0ced91cdd139606cbb193ef2/http2/transport.go#L1083-L1085

Types

type Cluster

type Cluster struct {
	//	InternalIPs []string
	//	Ingress     bool
	Kubectl    *kubernetes.Clientset
	RestConfig *restclient.Config
	// contains filtered or unexported fields
}

func GetCluster

func GetCluster(ctx context.Context) (*Cluster, error)

GetCluster returns the Cluster needed to talk to it. On first call it creates it from a Kubernetes rest client config and cli arguments / environment variables.

func (*Cluster) ClientApp added in v0.0.18

ClientApp returns a dynamic namespaced client for the app resource

func (*Cluster) ClientAppChart added in v0.8.0

func (c *Cluster) ClientAppChart() (dynamic.NamespaceableResourceInterface, error)

ClientAppChart returns a dynamic client for the app chart resource

func (*Cluster) CreateJob added in v0.3.6

func (c *Cluster) CreateJob(ctx context.Context, namespace string, job *apibatchv1.Job) error

func (*Cluster) CreateLabeledSecret

func (c *Cluster) CreateLabeledSecret(ctx context.Context, namespace, name string,
	data map[string][]byte,
	label map[string]string,
	annotations map[string]string,
) error

CreateLabeledSecret posts a new secret to the cluster. The secret is constructed from name and a key/value dictionary for labels.

func (*Cluster) CreateSecret

func (c *Cluster) CreateSecret(ctx context.Context, namespace string, secret v1.Secret) error

CreateSecret posts the specified secret to the cluster. All configuration of the secret is done by the caller.

func (*Cluster) DeleteJob added in v0.3.6

func (c *Cluster) DeleteJob(ctx context.Context, namespace string, name string) error

DeleteJob deletes the namepace

func (*Cluster) DeleteSecret

func (c *Cluster) DeleteSecret(ctx context.Context, namespace, name string) error

DeleteSecret removes a secret

func (*Cluster) GetConfigMap added in v0.6.2

func (c *Cluster) GetConfigMap(ctx context.Context, namespace, name string) (*v1.ConfigMap, error)

GetConfigMap gets a configmap's values

func (*Cluster) GetPlatform

func (c *Cluster) GetPlatform() Platform

func (*Cluster) GetSecret

func (c *Cluster) GetSecret(ctx context.Context, namespace, name string) (*v1.Secret, error)

GetSecret gets a secret's values

func (*Cluster) GetVersion

func (c *Cluster) GetVersion() (string, error)

GetVersion get the kube server version

func (*Cluster) IsJobDone added in v0.3.6

func (c *Cluster) IsJobDone(ctx context.Context, client *typedbatchv1.BatchV1Client, jobName, namespace string) wait.ConditionFunc

IsJobDone returns a condition function that indicates whether the given Job is done (Completed or Failed), or not

func (*Cluster) IsJobFailed added in v0.3.6

func (c *Cluster) IsJobFailed(ctx context.Context, jobName, namespace string) (bool, error)

IsJobFailed is a condition function that indicates whether the given Job is in Failed state or not.

func (*Cluster) ListIngress

func (c *Cluster) ListIngress(ctx context.Context, namespace, selector string) (*networkingv1.IngressList, error)

ListIngress returns the list of available ingresses in `namespace` with the given selector

func (*Cluster) ListJobs added in v0.3.6

func (c *Cluster) ListJobs(ctx context.Context, namespace, selector string) (*apibatchv1.JobList, error)

ListJobs returns the list of currently scheduled or running Jobs in `namespace` with the given selector

func (*Cluster) ListPods

func (c *Cluster) ListPods(ctx context.Context, namespace, selector string) (*v1.PodList, error)

ListPods returns the list of currently scheduled or running pods in `namespace` with the given selector

func (*Cluster) NamespaceDoesNotExist

func (c *Cluster) NamespaceDoesNotExist(ctx context.Context, namespaceName string) wait.ConditionFunc

func (*Cluster) NamespaceExists

func (c *Cluster) NamespaceExists(ctx context.Context, namespaceName string) (bool, error)

NamespaceExists checks if a namespace exists or not

func (*Cluster) PodDoesNotExist

func (c *Cluster) PodDoesNotExist(ctx context.Context, namespace, selector string) wait.ConditionFunc

func (*Cluster) WaitForCRD

func (c *Cluster) WaitForCRD(ctx context.Context, ui *termui.UI, CRDName string, timeout time.Duration) error

WaitForCRD wait for a custom resource definition to exist in the cluster. It will wait until the CRD reaches the condition "established". This method should be used when installing a Deployment that is supposed to provide that CRD and want to make sure the CRD is ready for consumption before continuing deploying things that will consume it.

func (*Cluster) WaitForJobDone added in v0.3.6

func (c *Cluster) WaitForJobDone(ctx context.Context, namespace, jobName string, timeout time.Duration) error

func (*Cluster) WaitForNamespaceMissing

func (c *Cluster) WaitForNamespaceMissing(ctx context.Context, ui *termui.UI, namespace string, timeout time.Duration) error

Wait up to timeout for Namespace to be removed. Returns an error if the Namespace is not removed within the allotted time.

func (*Cluster) WaitForPodBySelectorMissing

func (c *Cluster) WaitForPodBySelectorMissing(ctx context.Context, namespace, selector string, timeout time.Duration) error

Wait up to timeout for pod to be removed. Returns an error if the pod is not removed within the allotted time.

func (*Cluster) WaitForSecret

func (c *Cluster) WaitForSecret(ctx context.Context, namespace, secretName string, timeout time.Duration) (*v1.Secret, error)

WaitForSecret waits until the specified secret exists. If timeout is reached, an error is returned. It should be used when something is expected to create a Secret and the code needs to wait until that happens.

type Platform

type Platform interface {
	Detect(context.Context, *kubernetes.Clientset) bool
	Describe() string
	String() string
	Load(context.Context, *kubernetes.Clientset) error
	ExternalIPs() []string
}

Directories

Path Synopsis
platform
ibm
k3s
tailer manages objects which tail the logs of a collection of pods specified by a label selector.
tailer manages objects which tail the logs of a collection of pods specified by a label selector.

Jump to

Keyboard shortcuts

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