Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cache
import (
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
"volcano.sh/volcano/pkg/scheduler/api"
"volcano.sh/volcano/pkg/scheduler/capabilities/volumebinding"
)
type Cache interface {
Run(stopCh <-chan struct{})
Snapshot() *api.ClusterInfo
WaitForCacheSync(stopCh <-chan struct{})
AddBindTask(task *api.TaskInfo) error
BindPodGroup(job *api.JobInfo, cluster string) error
Evict(task *api.TaskInfo, reason string) error
RecordJobStatusEvent(job *api.JobInfo, updatePG bool)
UpdateJobStatus(job *api.JobInfo, updatePG bool) (*api.JobInfo, error)
UpdateQueueStatus(queue *api.QueueInfo) error
GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*volumebinding.PodVolumes, error)
AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *volumebinding.PodVolumes) error
BindVolumes(task *api.TaskInfo, volumes *volumebinding.PodVolumes) error
RevertVolumes(task *api.TaskInfo, podVolumes *volumebinding.PodVolumes)
Client() kubernetes.Interface
ClientConfig() *rest.Config
UpdateSchedulerNumaInfo(sets map[string]api.ResNumaSets) error
SharedInformerFactory() informers.SharedInformerFactory
SetMetricsConf(conf map[string]string)
EventRecorder() record.EventRecorder
}
type VolumeBinder interface {
GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*volumebinding.PodVolumes, error)
RevertVolumes(task *api.TaskInfo, podVolumes *volumebinding.PodVolumes)
AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *volumebinding.PodVolumes) error
BindVolumes(task *api.TaskInfo, podVolumes *volumebinding.PodVolumes) error
}
type Binder interface {
Bind(kubeClient kubernetes.Interface, tasks []*api.TaskInfo) map[api.TaskID]string
}
type Evictor interface {
Evict(pod *v1.Pod, reason string) error
}
type StatusUpdater interface {
UpdatePodStatus(pod *v1.Pod) (*v1.Pod, error)
UpdatePodGroup(pg *api.PodGroup) (*api.PodGroup, error)
UpdateQueueStatus(queue *api.QueueInfo) error
}
type BatchBinder interface {
Bind(job *api.JobInfo, cluster string) (*api.JobInfo, error)
}