kube

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJobExecutionFailed = errors.ErrInternal.WithMsgf("job execution failed")
	ErrJobCreationFailed  = errors.ErrInternal.WithMsgf("job creation failed")
	ErrJobNotFound        = errors.ErrNotFound.WithMsgf("job not found")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, config Config) (*Client, error)

func (Client) GetJobProcessor added in v0.1.7

func (c Client) GetJobProcessor(j *job.Job) (*job.Processor, error)

func (Client) GetPodDetails

func (c Client) GetPodDetails(ctx context.Context, namespace string, labelSelectors map[string]string, allow func(pod corev1.Pod) bool) ([]Pod, error)

func (Client) RunJob

func (c Client) RunJob(ctx context.Context, namespace, name string, image string, cmd []string, retries int32, wait bool) (*batchv1.Job, error)

func (Client) StreamLogs

func (c Client) StreamLogs(ctx context.Context, namespace string, filter map[string]string) (<-chan LogChunk, error)

type Config

type Config struct {
	// Host - The hostname (in form of URI) of Kubernetes master.
	Host string `json:"host"`

	Timeout time.Duration `json:"timeout" default:"100ms"`

	// Token - Token to authenticate with static oauth2 access token
	Token string `json:"token"`

	// Insecure - Whether server should be accessed without verifying the TLS certificate.
	Insecure bool `json:"insecure" default:"false"`

	// ClientKey - PEM-encoded client key for TLS authentication.
	ClientKey string `json:"client_key"`

	// ClientCertificate - PEM-encoded client certificate for TLS authentication.
	ClientCertificate string `json:"client_certificate"`

	// ClusterCACertificate - PEM-encoded root certificates bundle for TLS authentication.
	ClusterCACertificate string `json:"cluster_ca_certificate"`

	// ProviderType indicates which provider that hos k8s: gke, eks, etc...
	// If it is `gke`, entropy will fetch auth from the default source
	// left it empty if token or client key will be used
	ProviderType string `json:"provider_type"`
}

func DefaultClientConfig

func DefaultClientConfig() Config

func (*Config) RESTConfig

func (conf *Config) RESTConfig(ctx context.Context) (*rest.Config, error)

func (*Config) Sanitise

func (conf *Config) Sanitise() error

func (*Config) StreamingConfig

func (conf *Config) StreamingConfig(ctx context.Context) (*rest.Config, error)

type LogChunk

type LogChunk struct {
	Data   []byte
	Labels map[string]string
}

type LogOptions

type LogOptions struct {
	App          string `mapstructure:"app"`
	Pod          string `mapstructure:"pod"`
	Container    string `mapstructure:"container"`
	Follow       string `mapstructure:"follow"`
	Previous     string `mapstructure:"previous"`
	SinceSeconds string `mapstructure:"since_seconds"`
	Timestamps   string `mapstructure:"timestamps"`
	TailLines    string `mapstructure:"tail_lines"`
}

type Pod

type Pod struct {
	Name       string   `json:"name"`
	Containers []string `json:"containers"`
	Status     string   `json:"status"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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