Documentation
¶
Overview ¶
Package kube provides a client for interacting with jobs and pods through the KubeAPI in a single namespace Originally Generated by Claude 3.5 Sonnet
Index ¶
- type Client
- func (c *Client) CleanupJob(ctx context.Context, jobName string) error
- func (c *Client) CreateJob(ctx context.Context, job *batchv1.Job) (*batchv1.Job, error)
- func (c *Client) DeleteJob(ctx context.Context, jobName string) error
- func (c *Client) GetJob(ctx context.Context, jobName string) (*batchv1.Job, error)
- func (c *Client) GetJobLogs(ctx context.Context, jobName string) (string, error)
- func (c *Client) GetNamespace() string
- func (c *Client) SetNamespace(namespace string)
- func (c *Client) WaitForJobCompletion(ctx context.Context, jobName string) error
- func (c *Client) WatchJob(ctx context.Context, jobName string) (watch.Interface, error)
- type ClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Kubernetes Client
func NewClient ¶
func NewClient(clientset kubernetes.Interface) (*Client, error)
NewClient creates a new Kubernetes client from a clientset
func (*Client) CleanupJob ¶
CleanupJob deletes a job and polls the KubeAPI until deletion is confirmed. It's context-aware, so set ctx to something like `context.WithTimeout(ctx, 10*time.Second)` to set a timeout.
func (*Client) GetJobLogs ¶
GetJobLogs retrieves logs from a Kubernetes Job's pods
func (*Client) GetNamespace ¶
GetNamespace returns the configured namespace for the client
func (*Client) SetNamespace ¶
SetNamespace sets the namespace for the client
func (*Client) WaitForJobCompletion ¶
WaitForJobCompletion waits for a job to complete (succeed or fail). It's context-aware, so set ctx to something like `context.WithTimeout(ctx, 10*time.Second)` to set a timeout.
type ClientInterface ¶
type ClientInterface interface {
GetNamespace() string
SetNamespace(namespace string)
CreateJob(ctx context.Context, job *batchv1.Job) (*batchv1.Job, error)
CleanupJob(ctx context.Context, jobName string) error
DeleteJob(ctx context.Context, jobName string) error
WaitForJobCompletion(ctx context.Context, jobName string) error
GetJobLogs(ctx context.Context, jobName string) (string, error)
}
ClientInterface defines the interface for Kubernetes operations. This interface exists to aid in testing.