sidecar

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConfigMap

func CreateConfigMap(cs kubernetes.Interface, nameSpace, name string, output []byte) error

CreateConfigMap creates a new configmap with the given data set in the "output" field of the ConfigMap.

func NewJobOutputToConfigMapEpilog

func NewJobOutputToConfigMapEpilog() func(JobContainerConfig) error

NewJobOutputToConfigMapEpilog returns an epilog function which gets the job output of a finished container and stores it in a ConfigMap named _jobname_-output-configmap. The stored output of the job is limited to 16MB.

Types

type JobContainerConfig

type JobContainerConfig struct {
	ClientSet     kubernetes.Interface
	Namespace     string
	PodName       string
	ContainerName string
}

type JobLifecycleSupervisor

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

JobLifecycleSupervisor is a controller which watches a container in the same pod and does things when the container's state changes.

func NewJobLifecylceSupervisor

func NewJobLifecylceSupervisor(jc JobContainerConfig) (*JobLifecycleSupervisor, error)

NewJobLifecylceSupervisor creates a new supervisor which executes scripts, then waits until the specified container in the given namespace and pod is finsihed, and then executes another set of specified functions.

func (*JobLifecycleSupervisor) RegisterEpilogHook

func (l *JobLifecycleSupervisor) RegisterEpilogHook(f func(jc JobContainerConfig) error) error

RegisterEpilogHook registers a function which is executed the supervised container is finished. It is expected that the container does not re-run itself. If RegisterEpilogHook is called multiple times, the registered functions are called in the same order as they are registered.

func (*JobLifecycleSupervisor) RegisterStartupHook

func (l *JobLifecycleSupervisor) RegisterStartupHook(f func() error) error

RegisterStartupHook registers a function which is executed when Run() is called. If RegisterStartupHook is called multiple times, the registered functions are called in the same order as they are registered.

func (*JobLifecycleSupervisor) Run

func (l *JobLifecycleSupervisor) Run() error

Run starts the supervisor. First it runs all functioned registered as startup hooks. Then it waits until the supervised container is finished and then it runs all epilog hooks.

Jump to

Keyboard shortcuts

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