batch

package
v1.20.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NamespaceDefault = "default"

Functions

func SetInstance

func SetInstance(i Ops)

SetInstance replaces the instance with the provided one. Should be used only for testing purposes.

Types

type Client

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

Client is a wrapper for the kubernetes batch client.

func New

New builds a new batch client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

NewForConfig builds a new batch client for the given config.

func (*Client) CreateCronJob

func (c *Client) CreateCronJob(cronJob *v1beta1.CronJob) (*v1beta1.CronJob, error)

CreateCron creates the given cronJob

func (*Client) CreateJob

func (c *Client) CreateJob(job *batchv1.Job) (*batchv1.Job, error)

CreateJob creates the given job

func (*Client) DeleteCronJob

func (c *Client) DeleteCronJob(name, namespace string) error

DeleteCronJob deletes the given cronJob

func (*Client) DeleteJob

func (c *Client) DeleteJob(name, namespace string) error

DeleteJob deletes the job with given namespace and name

func (*Client) GetCronJob

func (c *Client) GetCronJob(name, namespace string) (*v1beta1.CronJob, error)

GetCronJob returns the cronJob given name and namespace

func (*Client) GetJob

func (c *Client) GetJob(name, namespace string) (*batchv1.Job, error)

GetJob returns the job from given namespace and name

func (*Client) ListCronJobs

func (c *Client) ListCronJobs(namespace string) (*v1beta1.CronJobList, error)

ListCronJobs returns the cronJobs in given namespace

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client.

func (*Client) UpdateCronJob

func (c *Client) UpdateCronJob(cronJob *v1beta1.CronJob) (*v1beta1.CronJob, error)

UpdateCronJob creates the given cronJob

func (*Client) ValidateCronJob

func (c *Client) ValidateCronJob(cronJob *v1beta1.CronJob, timeout, retryInterval time.Duration) error

ValidateCronJob validates the given cronJob

func (*Client) ValidateJob

func (c *Client) ValidateJob(name, namespace string, timeout time.Duration) error

ValidateJob validates if the job with given namespace and name succeeds. It waits for timeout duration for job to succeed

type CronOps

type CronOps interface {
	// CreateCronJob creates the given cronJob
	CreateCronJob(cronJob *v1beta1.CronJob) (*v1beta1.CronJob, error)
	// UpdateCronJob creates the given cronJob
	UpdateCronJob(cronJob *v1beta1.CronJob) (*v1beta1.CronJob, error)
	// GetCronJob returns the cronJob given name and namespace
	GetCronJob(name, namespace string) (*v1beta1.CronJob, error)
	// DeleteCronJob deletes the given cronJob
	DeleteCronJob(name, namespace string) error
	// ValidateCronJob validates the given cronJob
	ValidateCronJob(cronJob *v1beta1.CronJob, timeout, retryInterval time.Duration) error
	// ListCronJobs list cronjobs in given namespace
	ListCronJobs(namespace string) (*v1beta1.CronJobList, error)
}

Ops is an interface to perform kubernetes related operations on the crd resources.

type JobOps

type JobOps interface {
	// CreateJob creates the given job
	CreateJob(job *batchv1.Job) (*batchv1.Job, error)
	// GetJob returns the job from given namespace and name
	GetJob(name, namespace string) (*batchv1.Job, error)
	// DeleteJob deletes the job with given namespace and name
	DeleteJob(name, namespace string) error
	// ValidateJob validates if the job with given namespace and name succeeds.
	// It waits for timeout duration for job to succeed
	ValidateJob(name, namespace string, timeout time.Duration) error
}

JobOps is an interface to perform job operations

type Ops

type Ops interface {
	JobOps
	CronOps

	// SetConfig sets the config and resets the client
	SetConfig(config *rest.Config)
}

Ops is an interface to perform kubernetes related operations on the batch resources.

func Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

Jump to

Keyboard shortcuts

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