Documentation ¶
Index ¶
- Constants
- Variables
- func AddChecksByCheckId(addChecks map[string][]any, commandMap map[string]any)
- func AddChecksByPlatform(addChecks map[string][]any, commandMap map[string]any)
- func ComputeHash(obj interface{}) string
- func GetActiveDeadlineSeconds(d time.Duration) *int64
- func GetJob(opts ...JobOption) (*batchv1.Job, error)
- func GetTerminatedContainersStatusesByPod(pod *corev1.Pod) map[string]*corev1.ContainerStateTerminated
- func IsPodControlledByJobNotFound(err error) bool
- type AddChecks
- type Collector
- type CollectorArgs
- type CollectorOption
- func WithCollectorTimeout(timeout time.Duration) CollectorOption
- func WithCommandsPath(commandPaths []string) CollectorOption
- func WithContainerResourceRequirements(rr corev1.ResourceRequirements) CollectorOption
- func WithContainerSecurityContext(securityContext *corev1.SecurityContext) CollectorOption
- func WithEmbeddedCommandFileSystem(commandsFileSystem embed.FS) CollectorOption
- func WithEmbeddedNodeConfigFilesystem(nodeConfigFileSystem embed.FS) CollectorOption
- func WithImageRef(imageRef string) CollectorOption
- func WithJobAffinity(affinity *corev1.Affinity) CollectorOption
- func WithJobAnnotation(annotation map[string]string) CollectorOption
- func WithJobLabels(labels map[string]string) CollectorOption
- func WithJobNamespace(namespace string) CollectorOption
- func WithJobTemplateName(name string) CollectorOption
- func WithJobTolerations(tolerations []corev1.Toleration) CollectorOption
- func WithName(name string) CollectorOption
- func WithNodeConfig(nodeConfig bool) CollectorOption
- func WithPodImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference) CollectorOption
- func WithPodPriorityClassName(priorityClassName string) CollectorOption
- func WithPodSpecSecurityContext(podSecurityContext *corev1.PodSecurityContext) CollectorOption
- func WithServiceAccount(sa string) CollectorOption
- func WithSpecCommands(specCommandIds []string) CollectorOption
- func WithTimetout(timeout time.Duration) CollectorOption
- func WithUseNodeSelector(useNodeSelector bool) CollectorOption
- func WithVolumes(volumes []corev1.Volume) CollectorOption
- func WithVolumesMount(volumesMount []corev1.VolumeMount) CollectorOption
- type JobBuilder
- type JobOption
- func WithAffinity(affinity *corev1.Affinity) JobOption
- func WithAnnotation(annotations map[string]string) JobOption
- func WithContainerVolumeMounts(volumeMounts []corev1.VolumeMount) JobOption
- func WithImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference) JobOption
- func WithJobName(name string) JobOption
- func WithJobServiceAccount(sa string) JobOption
- func WithJobTimeout(timeout time.Duration) JobOption
- func WithK8sKubeletConfigMapping(kubeletConfigMapping string) JobOption
- func WithK8sNodeCommands(nodeCommands string) JobOption
- func WithK8sNodeConfigData(nodeConfigData string) JobOption
- func WithKubeletConfig(kubeletConfig string) JobOption
- func WithLabels(labels map[string]string) JobOption
- func WithNamespace(namespace string) JobOption
- func WithNodeCollectorImageRef(imageRef string) JobOption
- func WithNodeConfiguration(nodeConfig bool) JobOption
- func WithNodeName(nodeName string) JobOption
- func WithPodVolumes(volumes []corev1.Volume) JobOption
- func WithPriorityClassName(priorityClassName string) JobOption
- func WithReplaceResourceReq(replaceResourceReq bool) JobOption
- func WithResourceRequirements(rr corev1.ResourceRequirements) JobOption
- func WithTemplate(template string) JobOption
- func WithTolerations(tolerations []corev1.Toleration) JobOption
- func WithUseNodeSelectorParam(useNodeSelector bool) JobOption
- type LogsReader
- type NodeCommands
- type ObjectRef
- type Runnable
- type RunnableFunc
- type Runner
- type RunnerOption
Constants ¶
const ( NodeCollectorName = "node-collector" // job headers TunnelCollectorName = "tunnel.collector.name" TunnelAutoCreated = "tunnel.automatic.created" TunnelResourceName = "tunnel.resource.name" TunnelResourceKind = "tunnel.resource.kind" )
Variables ¶
var ErrTimeout = errors.New("runner received timeout")
ErrTimeout is returned when Runner's Run method fails due to a timeout event.
Functions ¶
func AddChecksByCheckId ¶ added in v0.5.2
func AddChecksByPlatform ¶ added in v0.5.2
func ComputeHash ¶
func ComputeHash(obj interface{}) string
ComputeHash returns a hash value calculated from a given object. The hash will be safe encoded to avoid bad words.
func GetTerminatedContainersStatusesByPod ¶
func GetTerminatedContainersStatusesByPod(pod *corev1.Pod) map[string]*corev1.ContainerStateTerminated
GetTerminatedContainersStatusesByPod collect information about contianer status by pod
Types ¶
type Collector ¶
type Collector interface { ApplyAndCollect(ctx context.Context, nodeName string) (string, error) Apply(ctx context.Context, nodeName string) (*batchv1.Job, error) AppendLabels(opts ...CollectorOption) Cleanup(ctx context.Context) }
func NewCollector ¶
func NewCollector( cluster k8s.Cluster, opts ...CollectorOption, ) Collector
type CollectorArgs ¶ added in v0.5.2
type CollectorArgs struct {
// contains filtered or unexported fields
}
type CollectorOption ¶
type CollectorOption func(*jobCollector)
func WithCollectorTimeout ¶ added in v0.5.2
func WithCollectorTimeout(timeout time.Duration) CollectorOption
func WithCommandsPath ¶ added in v0.5.2
func WithCommandsPath(commandPaths []string) CollectorOption
func WithContainerResourceRequirements ¶
func WithContainerResourceRequirements(rr corev1.ResourceRequirements) CollectorOption
func WithContainerSecurityContext ¶
func WithContainerSecurityContext(securityContext *corev1.SecurityContext) CollectorOption
func WithEmbeddedCommandFileSystem ¶ added in v0.5.2
func WithEmbeddedCommandFileSystem(commandsFileSystem embed.FS) CollectorOption
func WithEmbeddedNodeConfigFilesystem ¶ added in v0.5.2
func WithEmbeddedNodeConfigFilesystem(nodeConfigFileSystem embed.FS) CollectorOption
func WithImageRef ¶
func WithImageRef(imageRef string) CollectorOption
func WithJobAffinity ¶ added in v0.5.2
func WithJobAffinity(affinity *corev1.Affinity) CollectorOption
func WithJobAnnotation ¶
func WithJobAnnotation(annotation map[string]string) CollectorOption
func WithJobLabels ¶
func WithJobLabels(labels map[string]string) CollectorOption
func WithJobNamespace ¶
func WithJobNamespace(namespace string) CollectorOption
func WithJobTemplateName ¶
func WithJobTemplateName(name string) CollectorOption
func WithJobTolerations ¶
func WithJobTolerations(tolerations []corev1.Toleration) CollectorOption
func WithName ¶
func WithName(name string) CollectorOption
func WithNodeConfig ¶ added in v0.5.2
func WithNodeConfig(nodeConfig bool) CollectorOption
func WithPodImagePullSecrets ¶
func WithPodImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference) CollectorOption
func WithPodPriorityClassName ¶
func WithPodPriorityClassName(priorityClassName string) CollectorOption
func WithPodSpecSecurityContext ¶
func WithPodSpecSecurityContext(podSecurityContext *corev1.PodSecurityContext) CollectorOption
func WithServiceAccount ¶
func WithServiceAccount(sa string) CollectorOption
func WithSpecCommands ¶ added in v0.5.2
func WithSpecCommands(specCommandIds []string) CollectorOption
func WithTimetout ¶
func WithTimetout(timeout time.Duration) CollectorOption
func WithUseNodeSelector ¶ added in v0.5.2
func WithUseNodeSelector(useNodeSelector bool) CollectorOption
func WithVolumes ¶
func WithVolumes(volumes []corev1.Volume) CollectorOption
func WithVolumesMount ¶
func WithVolumesMount(volumesMount []corev1.VolumeMount) CollectorOption
type JobBuilder ¶
type JobBuilder struct {
// contains filtered or unexported fields
}
type JobOption ¶
type JobOption func(*JobBuilder)
func WithAffinity ¶ added in v0.5.2
func WithAnnotation ¶
func WithContainerVolumeMounts ¶
func WithContainerVolumeMounts(volumeMounts []corev1.VolumeMount) JobOption
func WithImagePullSecrets ¶
func WithImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference) JobOption
func WithJobName ¶
func WithJobServiceAccount ¶
func WithJobTimeout ¶ added in v0.5.2
func WithK8sKubeletConfigMapping ¶ added in v0.5.2
func WithK8sNodeCommands ¶ added in v0.5.2
func WithK8sNodeConfigData ¶ added in v0.5.2
func WithKubeletConfig ¶ added in v0.5.2
func WithLabels ¶
func WithNamespace ¶
func WithNodeConfiguration ¶ added in v0.5.2
func WithNodeName ¶ added in v0.5.2
func WithPodVolumes ¶
func WithPriorityClassName ¶
func WithReplaceResourceReq ¶ added in v0.5.2
func WithResourceRequirements ¶
func WithResourceRequirements(rr corev1.ResourceRequirements) JobOption
func WithTemplate ¶
func WithTolerations ¶
func WithTolerations(tolerations []corev1.Toleration) JobOption
func WithUseNodeSelectorParam ¶ added in v0.5.2
type LogsReader ¶
type LogsReader interface { GetLogsByJobAndContainerName(ctx context.Context, job *batchv1.Job, containerName string) (io.ReadCloser, error) GetTerminatedContainersStatusesByJob(ctx context.Context, job *batchv1.Job) (map[string]*corev1.ContainerStateTerminated, error) }
LogsReader responsible for collecting container status and logs
func NewLogsReader ¶
func NewLogsReader(clientset kubernetes.Interface) LogsReader
NewLogsReader instansiate new log reader
type NodeCommands ¶ added in v0.5.2
type NodeCommands struct {
Commands []any `yaml:"commands"`
}
type Runnable ¶
Runnable is the interface that wraps the basic Run method.
Run should be implemented by any task intended to be executed by the Runner.
func NewRunnableJob ¶
func NewRunnableJob( clientset kubernetes.Interface, job *batchv1.Job, ) Runnable
NewRunnableJob constructs a new Runnable task defined as Kubernetes
type RunnableFunc ¶
The RunnableFunc type is an adapter to allow the use of ordinary functions as Runnable tasks. If f is a function with the appropriate signature, RunnableFunc(f) is a Runnable that calls f.
type Runner ¶
Runner is the interface that wraps the basic Run method.
Run executes submitted Runnable tasks.
func New ¶
func New(opts ...RunnerOption) Runner
New constructs a new ready-to-use Runner for running a Runnable task.
type RunnerOption ¶
type RunnerOption func(*runner)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) RunnerOption