forked from IBM/kube-safe-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
foo.go
44 lines (35 loc) · 804 Bytes
/
foo.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
// +build foo all
package main
import (
v1 "k8s.io/api/core/v1"
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
"kube-safe-scheduler/foo"
)
// Initialize agent
func init() {
InitMain()
// add agent predicates
AddRouterPredicate(fooPredicate)
// add agent priority functions
AddRouterPriority(fooPriority)
}
/**
* Define foo predicate
*/
// fooPredicate : predicate
var fooPredicate = Predicate{
Name: foo.PredicateFooName,
Func: func(pod v1.Pod, node v1.Node) (bool, error) {
return foo.PredicateFunc(pod, node)
},
}
/**
* Define foo priority function
*/
// fooPriority : priority function
var fooPriority = Prioritize{
Name: foo.PriorityFooName,
Func: func(pod v1.Pod, nodes []v1.Node) (*schedulerapi.HostPriorityList, error) {
return foo.PriorityFunc(pod, nodes)
},
}