2024-08-29 volcano Priority

简介
Priority plugin提供了job、task排序的实现,以及计算牺牲作业的函数preemptableFn。job的排序根据priorityClassName,task的排序依次根据priorityClassName、createTime、id。

场景
当集群运行了多个Job,但资源不足,并且每个Job下有不等数量的Pod等待被调度的时候,如果使用Kubernetes默认调度器,那么最终,具有更多Pod数量的Job将分得更多的集群资源。在这种情况下,volcano-scheduler提供算法支持不同的Job以fair-share的形式共享集群资源。

Priority plugin能够让用户自定义job、task优先级,根据自己的需求在不同层次来定制调度策略。根据job的priorityClassName在应用层面进行优先级排序,例如集群中有金融场景、物联网监控场景等需要较高实时性的应用,Priority plugin能够保证其优先得到调度。

/home/margin/code/volcano/pkg/scheduler/plugins/priority/priority_test.go

piVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
name: podgroups.scheduling.volcano.sh
spec:
group: scheduling.volcano.sh
names:
kind: PodGroup
listKind: PodGroupList
plural: podgroups
shortNames:
- pg
- podgroup-v1beta1
singular: podgroup
scope: Namespaced
versions:

  • additionalPrinterColumns:
    • jsonPath: .status.phase
      name: STATUS
      type: string
    • jsonPath: .spec.minMember
      name: minMember
      type: integer
    • jsonPath: .status.running
      name: RUNNINGS
      type: integer
    • jsonPath: .metadata.creationTimestamp
      name: AGE
      type: date
    • jsonPath: .spec.queue
      name: QUEUE
      priority: 1
      type: string
      name: v1beta1
      schema:
      openAPIV3Schema:
      description: PodGroup is a collection of Pod; used for batch workload.
      properties:
      apiVersion:
      description: |-
      APIVersion defines the versioned schema of this representation of an object.
      Servers should convert recognized schemas to the latest internal value, and
      may reject unrecognized values.
      More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
      type: string
      kind:
      description: |-
      Kind is a string value representing the REST resource this object represents.
      Servers may infer this from the endpoint the client submits requests to.
      Cannot be updated.
      In CamelCase.
      More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
      type: string
      metadata:
      type: object
      spec:
      description: |-
      Specification of the desired behavior of the pod group.
      More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
      properties:
      minMember:
      description: |-
      MinMember defines the minimal number of members/tasks to run the pod group;
      if there's not enough resources to start all tasks, the scheduler
      will not start anyone.
      format: int32
      type: integer
      minResources:
      additionalProperties:
      anyOf:
      - type: integer
      - type: string
      pattern: ^(+|-)?(([0-9]+(.[0-9])?)|(.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|(eE?(([0-9]+(.[0-9])?)|(.[0-9]+))))?$
      x-kubernetes-int-or-string: true
      description: |-
      MinResources defines the minimal resource of members/tasks to run the pod group;
      if there's not enough resources to start all tasks, the scheduler
      will not start anyone.
      type: object
      minTaskMember:
      additionalProperties:
      format: int32
      type: integer
      description: |-
      MinTaskMember defines the minimal number of pods to run each task in the pod group;
      if there's not enough resources to start each task, the scheduler
      will not start anyone.
      type: object
      priorityClassName:
      description: |-
      If specified, indicates the PodGroup's priority. "system-node-critical" and
      "system-cluster-critical" are two special keywords which indicate the
      highest priorities with the former being the highest priority. Any other
      name must be defined by creating a PriorityClass object with that name.
      If not specified, the PodGroup priority will be default or zero if there is no
      default.
      type: string
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容