Documentation ¶
Index ¶
- Constants
- Variables
- func GetHTTP1Client(ctx context.Context) (*kubernetes.Clientset, error)
- type Cluster
- func (c *Cluster) ClientApp() (dynamic.NamespaceableResourceInterface, error)
- func (c *Cluster) ClientAppChart() (dynamic.NamespaceableResourceInterface, error)
- func (c *Cluster) CreateJob(ctx context.Context, namespace string, job *apibatchv1.Job) error
- func (c *Cluster) CreateLabeledSecret(ctx context.Context, namespace, name string, data map[string][]byte, ...) error
- func (c *Cluster) CreateSecret(ctx context.Context, namespace string, secret v1.Secret) error
- func (c *Cluster) DeleteJob(ctx context.Context, namespace string, name string) error
- func (c *Cluster) DeleteSecret(ctx context.Context, namespace, name string) error
- func (c *Cluster) GetConfigMap(ctx context.Context, namespace, name string) (*v1.ConfigMap, error)
- func (c *Cluster) GetPlatform() Platform
- func (c *Cluster) GetSecret(ctx context.Context, namespace, name string) (*v1.Secret, error)
- func (c *Cluster) GetVersion() (string, error)
- func (c *Cluster) IsJobDone(ctx context.Context, client *typedbatchv1.BatchV1Client, ...) wait.ConditionFunc
- func (c *Cluster) IsJobFailed(ctx context.Context, jobName, namespace string) (bool, error)
- func (c *Cluster) ListIngress(ctx context.Context, namespace, selector string) (*networkingv1.IngressList, error)
- func (c *Cluster) ListJobs(ctx context.Context, namespace, selector string) (*apibatchv1.JobList, error)
- func (c *Cluster) ListPods(ctx context.Context, namespace, selector string) (*v1.PodList, error)
- func (c *Cluster) NamespaceDoesNotExist(ctx context.Context, namespaceName string) wait.ConditionFunc
- func (c *Cluster) NamespaceExists(ctx context.Context, namespaceName string) (bool, error)
- func (c *Cluster) PodDoesNotExist(ctx context.Context, namespace, selector string) wait.ConditionFunc
- func (c *Cluster) WaitForCRD(ctx context.Context, ui *termui.UI, CRDName string, timeout time.Duration) error
- func (c *Cluster) WaitForJobDone(ctx context.Context, namespace, jobName string, timeout time.Duration) error
- func (c *Cluster) WaitForNamespaceMissing(ctx context.Context, ui *termui.UI, namespace string, timeout time.Duration) error
- func (c *Cluster) WaitForPodBySelectorMissing(ctx context.Context, namespace, selector string, timeout time.Duration) error
- func (c *Cluster) WaitForSecret(ctx context.Context, namespace, secretName string, timeout time.Duration) (*v1.Secret, error)
- type Platform
Constants ¶
const (
// APISGroupName is the api name used for epinio
APISGroupName = "epinio.io"
)
Variables ¶
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") )
var SupportedPlatforms = []Platform{ kind.NewPlatform(), k3s.NewPlatform(), ibm.NewPlatform(), minikube.NewPlatform(), }
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 ¶
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
func (c *Cluster) ClientApp() (dynamic.NamespaceableResourceInterface, error)
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) 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 ¶
CreateSecret posts the specified secret to the cluster. All configuration of the secret is done by the caller.
func (*Cluster) DeleteSecret ¶
DeleteSecret removes a secret
func (*Cluster) GetConfigMap ¶ added in v0.6.2
GetConfigMap gets a configmap's values
func (*Cluster) GetPlatform ¶
func (*Cluster) GetVersion ¶
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
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 ¶
ListPods returns the list of currently scheduled or running pods in `namespace` with the given selector
func (*Cluster) NamespaceDoesNotExist ¶
func (*Cluster) NamespaceExists ¶
NamespaceExists checks if a namespace exists or not
func (*Cluster) PodDoesNotExist ¶
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 (*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.