k8s_client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sStatePollInterval = 3 * time.Second
)

Variables

This section is empty.

Functions

func GetLocalK8sDeps

func GetLocalK8sDeps() (*kubernetes.Clientset, *rest.Config, error)

GetLocalK8sDeps get local k8s context config

Types

type Client

type Client struct {
	ClientSet  *kubernetes.Clientset
	RESTConfig *rest.Config
	// contains filtered or unexported fields
}

High level k8s client

func NewClient

func NewClient() *Client

NewK8sClient creates a new k8s client with a REST config

func (*Client) GetPodLogs

func (m *Client) GetPodLogs(ctx context.Context, namespace string, pods []v1.Pod) (map[string]string, error)

func (*Client) ListJobs

func (m *Client) ListJobs(ctx context.Context, namespace, syncLabel string) (*batchV1.JobList, error)

func (*Client) ListPods

func (m *Client) ListPods(ctx context.Context, namespace, syncLabel string) (*v1.PodList, error)

func (*Client) LogNamespaceEvents

func (m *Client) LogNamespaceEvents(ctx context.Context, namespace string)

func (*Client) PrintPodLogs

func (m *Client) PrintPodLogs(ctx context.Context, namespace string, syncLabelValue string)

func (*Client) RemoveJobs

func (m *Client) RemoveJobs(ctx context.Context, nsName string, syncLabelValue string) error

func (*Client) WaitUntilJobsComplete

func (m *Client) WaitUntilJobsComplete(ctx context.Context, namespace, syncLabelValue string, expectedJobsCount int) error

Use polling to wait for jobs to complete. `watch` does not work in CI (GAP), so we have to poll.

Jump to

Keyboard shortcuts

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