forked from kubeflow/common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_job_controller.go
74 lines (58 loc) · 1.97 KB
/
test_job_controller.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package test_job
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
v1 "github.com/kubeflow/common/test_job/apis/test_job/v1"
log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var _ commonv1.ControllerInterface = &TestJobController{}
type TestJobController struct {
commonv1.ControllerInterface
Job *v1.TestJob
Pods []*corev1.Pod
Services []*corev1.Service
}
func (TestJobController) ControllerName() string {
return "test-operator"
}
func (TestJobController) GetAPIGroupVersionKind() schema.GroupVersionKind {
return v1.SchemeGroupVersionKind
}
func (TestJobController) GetAPIGroupVersion() schema.GroupVersion {
return v1.SchemeGroupVersion
}
func (TestJobController) GetGroupNameLabelValue() string {
return v1.GroupName
}
func (TestJobController) GetDefaultContainerPortName() string {
return "default-port-name"
}
func (t *TestJobController) GetJobFromInformerCache(namespace, name string) (metav1.Object, error) {
return t.Job, nil
}
func (t *TestJobController) GetJobFromAPIClient(namespace, name string) (metav1.Object, error) {
return t.Job, nil
}
func (t *TestJobController) DeleteJob(job interface{}) error {
log.Info("Delete job")
t.Job = nil
return nil
}
func (t *TestJobController) UpdateJobStatus(job interface{}, replicas map[commonv1.ReplicaType]*commonv1.ReplicaSpec,
jobStatus *commonv1.JobStatus) error {
return nil
}
func (t *TestJobController) UpdateJobStatusInApiServer(job interface{}, jobStatus *commonv1.JobStatus) error {
return nil
}
func (t *TestJobController) SetClusterSpec(job interface{}, podTemplate *corev1.PodTemplateSpec, rtype, index string) error {
return nil
}
func (t *TestJobController) GetDefaultContainerName() string {
return "default-container"
}
func (t *TestJobController) IsMasterRole(replicas map[commonv1.ReplicaType]*commonv1.ReplicaSpec, rtype commonv1.ReplicaType, index int) bool {
return true
}