Documentation
¶
Index ¶
- func NewClient(kubeconfig *string, config Config) (kubernetes.Interface, error)
- func NewDynamicClient(kubeconfig *string, config Config) (dynamic.Interface, error)
- func WaitForJobPodsReady(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) error
- func WatchJobPodLogs(ctx context.Context, clientset kubernetes.Interface, namespace, jobName string, ...) error
- type Config
- type DeleteFunc
- type ListFunc
- type Manager
- func (m *Manager) DeleteJobs(ctx context.Context, labelSelector string, async bool) error
- func (m *Manager) DeleteNodes(ctx context.Context, labelSelector string, async bool) error
- func (m *Manager) DeletePods(ctx context.Context, labelSelector string, async bool) error
- func (m *Manager) Metrics() (...)
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop()
- func (m *Manager) WaitForJobsToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
- func (m *Manager) WaitForNodesToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
- func (m *Manager) WaitForPodsToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
- type ManagerConfig
- type RateLimiterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(kubeconfig *string, config Config) (kubernetes.Interface, error)
NewClient creates a new Kubernetes client and automatically detects in-cluster and out-of-cluster config.
func NewDynamicClient ¶
NewDynamicClient creates a new dynamic Kubernetes client and automatically detects in-cluster and out-of-cluster config.
func WaitForJobPodsReady ¶
func WaitForJobPodsReady( ctx context.Context, clientset kubernetes.Interface, namespace string, jobName string, timeout time.Duration, ) error
WaitForJobPodsReady waits for all pods associated with the given job to become ready.
func WatchJobPodLogs ¶
func WatchJobPodLogs(ctx context.Context, clientset kubernetes.Interface, namespace, jobName string, out io.Writer) error
WatchJobPodLogs streams logs from all pods associated with the given job.
Types ¶
type DeleteFunc ¶
type DeleteFunc func(ctx context.Context, client kubernetes.Interface, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions, async bool) error
type ListFunc ¶
type ListFunc func(ctx context.Context, client kubernetes.Interface, opts metav1.ListOptions) (empty bool, err error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to manage Kubernetes resources.
func NewManager ¶
func NewManager(client kubernetes.Interface, cfg *ManagerConfig) *Manager
func (*Manager) DeleteJobs ¶
DeleteJobs deletes Kubernetes Job resources having provided label. If async is set to false, this function will block until jobs are terminated or context exceeds deadline.
func (*Manager) DeleteNodes ¶
DeleteNodes deletes all Kubernetes Node resources having provided label. If async is set to false, this function will block until nodes are terminated or context exceeds deadline.
func (*Manager) DeletePods ¶
DeletePods deletes Kubernetes Pod resources having provided label. If async is set to false, this function will block until pods are terminated or context exceeds deadline.
func (*Manager) Metrics ¶
func (m *Manager) Metrics() (nodeCreationMetrics, podCreationMetrics, jobCreationMetrics ratelimiter.Metrics)
func (*Manager) Start ¶
Start starts the Manager and the pod & node creation rate limiters. It blocks until the Manager is stopped the context is cancelled or all rate limited executors have finished.
func (*Manager) WaitForJobsToTerminate ¶
func (m *Manager) WaitForJobsToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
WaitForJobsToTerminate waits for the jobs with the provided labelSelector to terminate.
func (*Manager) WaitForNodesToTerminate ¶
func (m *Manager) WaitForNodesToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
WaitForNodesToTerminate waits for the nodes with the provided labelSelector to terminate.
func (*Manager) WaitForPodsToTerminate ¶
func (m *Manager) WaitForPodsToTerminate(ctx context.Context, client kubernetes.Interface, labelSelector string) error
WaitForPodsToTerminate waits for the pods with the provided labelSelector to terminate.
type ManagerConfig ¶
type ManagerConfig struct { // Namespace is the namespace in which resources should be created. Namespace string // Logger is the logger that should be used by the Manager. Logger *slog.Logger // PodRateLimiterConfig is the configuration for the rate limited PodCreator. PodRateLimiterConfig RateLimiterConfig // NodeRateLimiterConfig is the configuration for the rate limited NodeCreator. NodeRateLimiterConfig RateLimiterConfig // JobRateLimiterConfig is the configuration for the rate limited JobCreator. JobRateLimiterConfig RateLimiterConfig }
ManagerConfig is used to configure a new Manager.
type RateLimiterConfig ¶
type RateLimiterConfig struct { // Frequency is the frequency at which the rate limiter should be invoked. Frequency time.Duration // Requests is the number of requests that should be made per invocation. Requests int // Limit is the maximum number of items that should be processed Limit int }
RateLimiterConfig is used to configure the rate limiter for a specific resource type.