k8s_client

package
v0.2.0-test-release-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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