kube

package
v0.0.0-...-8fc2537 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActiveDeadlineSeconds is an active deadline for a job to run
	// 4 hours is default to avoid crashing jobs
	ActiveDeadlineSeconds = 60 * 60 * 4
	// JobTTLSeconds is a default ttl for jobs, before they will be garbage
	// collected
	JobTTLSeconds = ActiveDeadlineSeconds * 2
	// DefaultNamespace is a default kubernetes namespace
	DefaultNamespace = "default"
	KindJob          = "Job"
	KindPod          = "Pod"
)
View Source
const (
	// Key is a name of the github plugin variable
	Key      = Namespace("kube")
	KeySetup = "Setup"
	KeyRun   = "Run"
	KeyApply = "Apply"
)

Variables

This section is empty.

Functions

func ConvertError

func ConvertError(err error) error

ConvertError converts kubernetes client error to trace error

func GetClient

func GetClient(configPath string) (client *kubernetes.Clientset, config *rest.Config, err error)

GetClient returns instance of client to the kubernetes cluster using in-cluster configuration if available and falling back to configuration file under configPath otherwise

func IsClosedResponseBodyErrorMessage

func IsClosedResponseBodyErrorMessage(err string) bool

IsClosedResponseBodyErrorMessage determines if the error message describes a closed response body error

func IsStreamClosedError

func IsStreamClosedError(err error) bool

IsStreamClosedError determines if the given error is a response/stream closed error

func Name

func Name(in string) (string, error)

Name converts string to a safe to use k8s resource

func Scope

func Scope() (force.Group, error)

Scope returns a new scope with all the functions and structs defined, this is the entrypoint into plugin as far as force is concerned

Types

type ApplyAction

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

ApplyAction runs kubernetes job to it's completion

func (*ApplyAction) Eval

func (r *ApplyAction) Eval(ctx force.ExecutionContext) (interface{}, error)

Eval creates or updates K8s object

func (*ApplyAction) MarshalCode

func (s *ApplyAction) MarshalCode(ctx force.ExecutionContext) ([]byte, error)

MarshalCode marshals the action into code representation

func (*ApplyAction) Type

func (r *ApplyAction) Type() interface{}

Type returns apply action type

type Config

type Config struct {
	// Path is a path to kubernetes config file
	Path string
}

Config specifies kube plugin configuration

func (*Config) CheckAndSetDefaults

func (cfg *Config) CheckAndSetDefaults(ctx force.ExecutionContext) error

CheckAndSetDefaults checks and sets defaults

type Namespace

type Namespace string

Namespace is a wrapper around string to namespace a variable

type NewApply

type NewApply struct {
}

NewApply specifies new job runners

func (*NewApply) NewInstance

func (n *NewApply) NewInstance(group force.Group) (force.Group, interface{})

NewApply returns functions creating kubernetes job runner action

type NewRun

type NewRun struct {
}

NewRun specifies new job runners

func (*NewRun) NewInstance

func (n *NewRun) NewInstance(group force.Group) (force.Group, interface{})

NewRun returns functions creating kubernetes job runner action

type Plugin

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

Plugin is a new plugin

type RunAction

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

RunAction runs kubernetes job to it's completion

func (*RunAction) Eval

func (r *RunAction) Eval(ctx force.ExecutionContext) (interface{}, error)

Eval runs kubernetes job

func (*RunAction) MarshalCode

func (s *RunAction) MarshalCode(ctx force.ExecutionContext) ([]byte, error)

MarshalCode marshals the action into code representation

func (*RunAction) Type

func (r *RunAction) Type() interface{}

type Setup

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

Setup creates new plugins

func (*Setup) Eval

func (n *Setup) Eval(ctx force.ExecutionContext) (interface{}, error)

func (*Setup) MarshalCode

func (n *Setup) MarshalCode(ctx force.ExecutionContext) ([]byte, error)

MarshalCode marshals plugin to code representation

func (*Setup) NewInstance

func (n *Setup) NewInstance(group force.Group) (force.Group, interface{})

NewInstance returns a new kubernetes client bound to the process group and registers plugin within variable

func (*Setup) Type

func (n *Setup) Type() interface{}

Jump to

Keyboard shortcuts

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