Documentation
¶
Index ¶
- Constants
- Variables
- type AgentClient
- func (c *AgentClient) CopyFrom(ctx context.Context, srcPath, dstPath string) error
- func (c *AgentClient) CopyTo(ctx context.Context, srcPath, dstPath string) error
- func (c *AgentClient) Exec(ctx context.Context, command []string, env []corev1.EnvVar) (*AgentExecResult, error)
- func (c *AgentClient) Stop(ctx context.Context) error
- type AgentConfig
- func (c *AgentConfig) Enabled(containerName string) bool
- func (c *AgentConfig) InstalledPath(containerName string) string
- func (c *AgentConfig) IssueJWT() ([]byte, error)
- func (c *AgentConfig) NewAllocatedPort() (uint16, error)
- func (c *AgentConfig) PublicKeyEnv() corev1.EnvVar
- func (c *AgentConfig) SetAllocationStartPort(port uint16)
- func (c *AgentConfig) SetExcludePorts(ports ...uint16)
- func (c *AgentConfig) SetTimeout(timeout time.Duration)
- func (c *AgentConfig) Timeout() string
- type AgentExecResult
- type AgentServer
- func (s *AgentServer) CopyFrom(req *agent.CopyFromRequest, stream agent.Agent_CopyFromServer) error
- func (s *AgentServer) CopyTo(stream agent.Agent_CopyToServer) error
- func (s *AgentServer) Exec(ctx context.Context, req *agent.ExecRequest) (*agent.ExecResponse, error)
- func (s *AgentServer) Finish(ctx context.Context, req *agent.FinishRequest) (*agent.FinishResponse, error)
- func (s *AgentServer) Run(ctx context.Context) error
- type CleanupError
- type CommandError
- type ContainerLog
- type ContainerLogger
- type CopyError
- type ErrorType
- type FailedJob
- type Job
- func (j *Job) DisableCommandLog()
- func (j *Job) DisableContainerLog()
- func (j *Job) DisableInitCommandLog()
- func (j *Job) DisableInitContainerLog()
- func (j *Job) PreInit(c corev1.Container, cb func(ctx context.Context, exec *JobExecutor) error)
- func (j *Job) Run(ctx context.Context) (e error)
- func (j *Job) RunWithExecutionHandler(ctx context.Context, handler JobExecutionHandler, finalizer *JobFinalizer) error
- func (j *Job) SetContainerLogger(logger ContainerLogger)
- func (j *Job) SetDeletePropagationPolicy(propagation metav1.DeletionPropagation)
- func (j *Job) SetInitContainerExecutionHandler(handler JobInitContainerExecutionHandler) error
- func (j *Job) SetLogLevel(level LogLevel)
- func (j *Job) SetLogger(logger Logger)
- func (j *Job) SetPendingPhaseTimeout(timeout time.Duration)
- func (j *Job) SetWatchTimeoutSecond(watchTimeoutSecond int64)
- func (j *Job) UseAgent(agentCfg *AgentConfig)
- type JobBuilder
- type JobCreationError
- type JobExecutionHandler
- type JobExecutor
- func (e *JobExecutor) CopyFromPod(ctx context.Context, srcPath, dstPath string) error
- func (e *JobExecutor) CopyToPod(ctx context.Context, srcPath, dstPath string) error
- func (e *JobExecutor) EnabledAgent() bool
- func (e *JobExecutor) Exec(ctx context.Context) ([]byte, error)
- func (e *JobExecutor) ExecAsync(ctx context.Context) error
- func (e *JobExecutor) ExecOnly(ctx context.Context) ([]byte, error)
- func (e *JobExecutor) ExecPrepareCommand(ctx context.Context, cmd []string) ([]byte, error)
- func (e *JobExecutor) IsRunning() bool
- func (e *JobExecutor) Stop() error
- func (e *JobExecutor) TerminationLog(log string) error
- type JobFinalizer
- type JobFinalizerHandler
- type JobInitContainerExecutionHandler
- type JobMultiError
- type JobStopContainerError
- type JobUnexpectedError
- type JobWatchError
- type LogLevel
- type LogStreamError
- type Logger
- type PendingPhaseTimeoutError
- type PreInitError
- type ValidationError
Constants ¶
const ( SelectorLabel = "kubejob.io/id" DefaultJobName = "kubejob-" DefaultContainerName = "kubejob" )
Variables ¶
var (
ExecRetryCount = 8
)
Functions ¶
This section is empty.
Types ¶
type AgentClient ¶ added in v0.3.0
type AgentClient struct {
// contains filtered or unexported fields
}
func NewAgentClient ¶ added in v0.3.0
func (*AgentClient) CopyFrom ¶ added in v0.3.0
func (c *AgentClient) CopyFrom(ctx context.Context, srcPath, dstPath string) error
func (*AgentClient) CopyTo ¶ added in v0.3.0
func (c *AgentClient) CopyTo(ctx context.Context, srcPath, dstPath string) error
func (*AgentClient) Exec ¶ added in v0.3.0
func (c *AgentClient) Exec(ctx context.Context, command []string, env []corev1.EnvVar) (*AgentExecResult, error)
type AgentConfig ¶ added in v0.3.0
type AgentConfig struct {
// contains filtered or unexported fields
}
func NewAgentConfig ¶ added in v0.3.0
func NewAgentConfig(containerNameToInstalledPathMap map[string]string) (*AgentConfig, error)
func (*AgentConfig) Enabled ¶ added in v0.3.1
func (c *AgentConfig) Enabled(containerName string) bool
func (*AgentConfig) InstalledPath ¶ added in v0.3.1
func (c *AgentConfig) InstalledPath(containerName string) string
func (*AgentConfig) IssueJWT ¶ added in v0.3.0
func (c *AgentConfig) IssueJWT() ([]byte, error)
func (*AgentConfig) NewAllocatedPort ¶ added in v0.3.0
func (c *AgentConfig) NewAllocatedPort() (uint16, error)
func (*AgentConfig) PublicKeyEnv ¶ added in v0.3.0
func (c *AgentConfig) PublicKeyEnv() corev1.EnvVar
func (*AgentConfig) SetAllocationStartPort ¶ added in v0.3.0
func (c *AgentConfig) SetAllocationStartPort(port uint16)
func (*AgentConfig) SetExcludePorts ¶ added in v0.3.0
func (c *AgentConfig) SetExcludePorts(ports ...uint16)
func (*AgentConfig) SetTimeout ¶ added in v0.5.0
func (c *AgentConfig) SetTimeout(timeout time.Duration)
func (*AgentConfig) Timeout ¶ added in v0.5.0
func (c *AgentConfig) Timeout() string
type AgentExecResult ¶ added in v0.3.0
type AgentServer ¶ added in v0.3.0
type AgentServer struct { *agent.UnimplementedAgentServer // contains filtered or unexported fields }
func NewAgentServer ¶ added in v0.3.0
func NewAgentServer(port uint16) *AgentServer
func (*AgentServer) CopyFrom ¶ added in v0.3.0
func (s *AgentServer) CopyFrom(req *agent.CopyFromRequest, stream agent.Agent_CopyFromServer) error
func (*AgentServer) CopyTo ¶ added in v0.3.0
func (s *AgentServer) CopyTo(stream agent.Agent_CopyToServer) error
func (*AgentServer) Exec ¶ added in v0.3.0
func (s *AgentServer) Exec(ctx context.Context, req *agent.ExecRequest) (*agent.ExecResponse, error)
func (*AgentServer) Finish ¶ added in v0.3.0
func (s *AgentServer) Finish(ctx context.Context, req *agent.FinishRequest) (*agent.FinishResponse, error)
type CleanupError ¶ added in v0.2.9
func (*CleanupError) Error ¶ added in v0.2.9
func (e *CleanupError) Error() string
type CommandError ¶ added in v0.2.9
func (*CommandError) Error ¶ added in v0.2.9
func (e *CommandError) Error() string
func (*CommandError) IsExitError ¶ added in v0.2.9
func (e *CommandError) IsExitError() bool
type ContainerLog ¶
type ContainerLogger ¶
type ContainerLogger func(*ContainerLog)
type Job ¶
func (*Job) DisableCommandLog ¶
func (j *Job) DisableCommandLog()
func (*Job) DisableContainerLog ¶
func (j *Job) DisableContainerLog()
func (*Job) DisableInitCommandLog ¶
func (j *Job) DisableInitCommandLog()
func (*Job) DisableInitContainerLog ¶
func (j *Job) DisableInitContainerLog()
func (*Job) PreInit ¶ added in v0.2.9
PreInit can define the process you want to execute before the process of init container specified at the time of starting Job. It is mainly intended to be used when you use `(*JobExecutor).CopyToFile` to copy an arbitrary file to pod before init processing.
func (*Job) RunWithExecutionHandler ¶
func (j *Job) RunWithExecutionHandler(ctx context.Context, handler JobExecutionHandler, finalizer *JobFinalizer) error
RunWithExecutionHandler allows control timing the container commands are executed.
finalizer: specify the container to call after executing JobExecutionHandler. If a sidecar is explicitly specified, it can be stopped after the execution handler has finished, but this will not work if an injected container is present. If SetDeletePropagationPolicy is set, kubejob itself deletes the Pod by the forced termination process, so the Job can be terminated even if an injected container exists. However, if kubejob itself does not delete Pods, the forced termination process cannot be executed either. Therefore, by specifying the finalizer container, you can explicitly terminate the injected container.
func (*Job) SetContainerLogger ¶
func (j *Job) SetContainerLogger(logger ContainerLogger)
func (*Job) SetDeletePropagationPolicy ¶ added in v0.4.0
func (j *Job) SetDeletePropagationPolicy(propagation metav1.DeletionPropagation)
func (*Job) SetInitContainerExecutionHandler ¶ added in v0.2.9
func (j *Job) SetInitContainerExecutionHandler(handler JobInitContainerExecutionHandler) error
func (*Job) SetLogLevel ¶ added in v0.2.9
func (*Job) SetPendingPhaseTimeout ¶ added in v0.2.11
SetPendingPhaseTimeout set the timeout when the process in the init container is finished but it does not switch to the Running phase ( PodInitializing state for a long time ).
func (*Job) SetWatchTimeoutSecond ¶ added in v0.5.0
func (*Job) UseAgent ¶ added in v0.3.0
func (j *Job) UseAgent(agentCfg *AgentConfig)
UseAgent when you use RunWithExecutionHandler, kubejob replace specified commands with a wait loop command to control when the command is executed. If the kubejob-agent is present in the container, you can specify its path and the port to listen to so that it will wait using the kubejob-agent.
type JobBuilder ¶
type JobBuilder struct {
// contains filtered or unexported fields
}
func NewJobBuilder ¶
func NewJobBuilder(config *rest.Config, namespace string) *JobBuilder
func (*JobBuilder) Build ¶
func (b *JobBuilder) Build() (*Job, error)
func (*JobBuilder) BuildWithJob ¶
func (b *JobBuilder) BuildWithJob(jobSpec *batchv1.Job) (*Job, error)
func (*JobBuilder) BuildWithReader ¶
func (b *JobBuilder) BuildWithReader(r io.Reader) (*Job, error)
func (*JobBuilder) SetCommand ¶
func (b *JobBuilder) SetCommand(cmd []string) *JobBuilder
func (*JobBuilder) SetImage ¶
func (b *JobBuilder) SetImage(image string) *JobBuilder
type JobCreationError ¶ added in v0.2.9
func (*JobCreationError) Error ¶ added in v0.2.9
func (e *JobCreationError) Error() string
type JobExecutionHandler ¶
type JobExecutionHandler func(context.Context, []*JobExecutor) error
type JobExecutor ¶
type JobExecutor struct { Container corev1.Container ContainerIdx int Pod *corev1.Pod // contains filtered or unexported fields }
func (*JobExecutor) CopyFromPod ¶ added in v0.2.9
func (e *JobExecutor) CopyFromPod(ctx context.Context, srcPath, dstPath string) error
CopyFromPod copy directory or files from specified path on Pod.
func (*JobExecutor) CopyToPod ¶ added in v0.2.9
func (e *JobExecutor) CopyToPod(ctx context.Context, srcPath, dstPath string) error
CopyToPod copy directory or files to specified path on Pod.
func (*JobExecutor) EnabledAgent ¶ added in v0.3.1
func (e *JobExecutor) EnabledAgent() bool
func (*JobExecutor) ExecOnly ¶ added in v0.2.2
func (e *JobExecutor) ExecOnly(ctx context.Context) ([]byte, error)
func (*JobExecutor) ExecPrepareCommand ¶ added in v0.2.5
func (*JobExecutor) IsRunning ¶ added in v0.2.4
func (e *JobExecutor) IsRunning() bool
func (*JobExecutor) Stop ¶
func (e *JobExecutor) Stop() error
func (*JobExecutor) TerminationLog ¶ added in v0.2.14
func (e *JobExecutor) TerminationLog(log string) error
type JobFinalizer ¶ added in v0.5.0
type JobFinalizer struct { Container corev1.Container Handler JobFinalizerHandler }
type JobFinalizerHandler ¶ added in v0.5.0
type JobFinalizerHandler func(context.Context, *JobExecutor) error
type JobInitContainerExecutionHandler ¶ added in v0.2.9
type JobInitContainerExecutionHandler func(context.Context, *JobExecutor) error
type JobMultiError ¶ added in v0.3.3
type JobMultiError struct {
Errs []error
}
func (*JobMultiError) Error ¶ added in v0.3.3
func (e *JobMultiError) Error() string
func (*JobMultiError) Has ¶ added in v0.3.3
func (e *JobMultiError) Has(typ ErrorType) bool
type JobStopContainerError ¶ added in v0.2.9
type JobStopContainerError struct {
Reason error
}
func (*JobStopContainerError) Error ¶ added in v0.2.9
func (e *JobStopContainerError) Error() string
type JobUnexpectedError ¶ added in v0.3.3
func (*JobUnexpectedError) Error ¶ added in v0.3.3
func (e *JobUnexpectedError) Error() string
type JobWatchError ¶ added in v0.2.9
func (*JobWatchError) Error ¶ added in v0.2.9
func (e *JobWatchError) Error() string
type LogStreamError ¶ added in v0.2.9
type LogStreamError struct { JobName string Pod *corev1.Pod Container corev1.Container InitContainer bool Err error }
func (*LogStreamError) Error ¶ added in v0.2.9
func (e *LogStreamError) Error() string
type PendingPhaseTimeoutError ¶ added in v0.2.11
func (*PendingPhaseTimeoutError) Error ¶ added in v0.2.11
func (e *PendingPhaseTimeoutError) Error() string
type PreInitError ¶ added in v0.2.9
type PreInitError struct {
Err error
}
func (*PreInitError) Error ¶ added in v0.2.9
func (e *PreInitError) Error() string
type ValidationError ¶ added in v0.2.9
func (*ValidationError) Error ¶ added in v0.2.9
func (e *ValidationError) Error() string