client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type K8sClient

type K8sClient struct {
	// contains filtered or unexported fields
}

func NewK8sClient

func NewK8sClient() (*K8sClient, error)

NewK8sClient creates kubernetes client wrapper with helper functions and direct access to k8s go client

func (*K8sClient) ApplyResource added in v0.2.0

func (w *K8sClient) ApplyResource(filePath string) (err error)

ApplyResource applies resources on the cluster, corresponding to the specified file(s)

func (*K8sClient) CurlEndpointInContainer

func (w *K8sClient) CurlEndpointInContainer(pod string, container string, endpoint string) (string, error)

CurlEndpointInContainer execs into the given container in the pod and uses curl to hit the specified endpoint

func (*K8sClient) DeleteResource added in v0.2.0

func (w *K8sClient) DeleteResource(filePath string) (err error)

DeleteResource deletes the resources from the cluster that the specified file(s) correspond to

func (*K8sClient) GetRegistryInstance

func (w *K8sClient) GetRegistryInstance(name string) (*registryv1alpha1.DevfileRegistry, error)

GetRegistryInstance uses the Kubernetes REST API to retrieve the specified instance of the DevfileRegistry custom resource If there are any issues retrieving the resource or unmarshalling it, an error is returned

func (*K8sClient) Kube

func (c *K8sClient) Kube() kubernetes.Interface

Kube returns the clientset for Kubernetes upstream.

func (*K8sClient) ListPods

func (w *K8sClient) ListPods(namespace, selector string) (*v1.PodList, error)

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

func (*K8sClient) WaitForFailedPodBySelector added in v0.1.1

func (w *K8sClient) WaitForFailedPodBySelector(namespace, selector string, timeout time.Duration) error

WaitForFailedPodBySelector waits up to timeout seconds for all pods in 'namespace' with given 'selector' to enter running state. Returns an error if no pods are found or not all discovered pods enter running state.

func (*K8sClient) WaitForPodFailedByLabel added in v0.1.1

func (w *K8sClient) WaitForPodFailedByLabel(label string) (deployed bool, err error)

WaitForPodFailedByLabel waits for the pod matching the specified label to become running An error is returned if the pod does not exist or the timeout is reached

func (*K8sClient) WaitForPodFailedByLabelWithNamespace added in v0.1.1

func (w *K8sClient) WaitForPodFailedByLabelWithNamespace(label string, namespace string) (deployed bool, err error)

WaitForPodFailedByLabelWithNamespace waits for the pod matching the specified label in a specified namespace to become running An error is returned if the pod does not exist or the timeout is reached

func (*K8sClient) WaitForPodRunningByLabel

func (w *K8sClient) WaitForPodRunningByLabel(label string) (deployed bool, err error)

WaitForPodRunningByLabel waits for the pod matching the specified label to become running An error is returned if the pod does not exist or the timeout is reached

func (*K8sClient) WaitForPodRunningByLabelWithNamespace

func (w *K8sClient) WaitForPodRunningByLabelWithNamespace(label string, namespace string) (deployed bool, err error)

WaitForPodRunningByLabelWithNamespace waits for the pod matching the specified label in a specified namespace to become running An error is returned if the pod does not exist or the timeout is reached

func (*K8sClient) WaitForRegistryInstance

func (w *K8sClient) WaitForRegistryInstance(name string, timeout time.Duration) error

WaitForRegistryInstance polls up to timeout seconds for the registry's server to become active (URL set in the status)

func (*K8sClient) WaitForRunningPodBySelector

func (w *K8sClient) WaitForRunningPodBySelector(namespace, selector string, timeout time.Duration) error

WaitForRunningPodBySelector waits up to timeout seconds for all pods in 'namespace' with given 'selector' to enter running state. Returns an error if no pods are found or not all discovered pods enter running state.

func (*K8sClient) WaitForURLChange

func (w *K8sClient) WaitForURLChange(name string, oldURL string, timeout time.Duration) (string, error)

WaitForURLChange polls up to timeout seconds for the registry's URL to change in the status and returns it. If the URL doesn't change in the specified timeout, an error is returned

Jump to

Keyboard shortcuts

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