-
Notifications
You must be signed in to change notification settings - Fork 1
/
driver.go
54 lines (43 loc) · 1.14 KB
/
driver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package orchestrator
import (
"context"
"time"
)
type Resource struct {
CPU string
Memory string
}
type Container struct {
Env map[string]string
VolumeMounts map[string]string
Limit Resource
Requests Resource
Name string
Image string
Cmd []string
Args []string
}
type Driver interface {
TriggerJob(ctx context.Context, request JobCreator) error
DeleteJob(ctx context.Context, request JobDeleter) error
CleanExpiredJobs(ctx context.Context, namespace string, interval *time.Duration) error
}
// Type JobCreator interface defines methods to access data required for a job creation
// irrespective of the driver implementation.
type JobCreator interface {
Name() string
Namespace() string
JobLabels() map[string]string
PodLabels() map[string]string
Volumes() []string
Container() *Container
InitContainer() *Container
NodeSelector() map[string]string
ImagePullSecrets() []string
}
// Type JobDeleter interface defines methods to access data required for a job deletion
// irrespective of the driver implementation.
type JobDeleter interface {
Name() string
Namespace() string
}