diff --git a/hack/.golint_failures b/hack/.golint_failures index 738280ed68..b6db6b4ccd 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -1,6 +1,4 @@ volcano.sh/volcano/pkg/apis/scheduling -volcano.sh/volcano/pkg/apis/scheduling/v1alpha1 -volcano.sh/volcano/pkg/apis/scheduling/v1alpha2 volcano.sh/volcano/pkg/apis/scheduling/v1beta1 volcano.sh/volcano/pkg/apis/utils volcano.sh/volcano/pkg/scheduler/actions/allocate diff --git a/hack/generate-yaml.sh b/hack/generate-yaml.sh index e978c4f7ac..a3bea2918c 100755 --- a/hack/generate-yaml.sh +++ b/hack/generate-yaml.sh @@ -72,8 +72,6 @@ ${HELM_BIN_DIR}/helm template ${VK_ROOT}/installer/helm/chart/volcano --namespac -x templates/bus_v1alpha1_command.yaml \ -x templates/controllers.yaml \ -x templates/scheduler.yaml \ - -x templates/scheduling_v1alpha1_podgroup.yaml \ - -x templates/scheduling_v1alpha1_queue.yaml \ - -x templates/scheduling_v1alpha2_podgroup.yaml \ - -x templates/scheduling_v1alpha2_queue.yaml \ + -x templates/scheduling_v1beta1_podgroup.yaml \ + -x templates/scheduling_v1beta1_queue.yaml \ --notes >> ${DEPLOYMENT_FILE} diff --git a/hack/update-gencode.sh b/hack/update-gencode.sh index e05fc47f9b..7049d2430a 100755 --- a/hack/update-gencode.sh +++ b/hack/update-gencode.sh @@ -29,12 +29,12 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ volcano.sh/volcano/pkg/client volcano.sh/volcano/pkg/apis \ - "batch:v1alpha1 bus:v1alpha1 scheduling:v1alpha1,v1alpha2,v1beta1" \ + "batch:v1alpha1 bus:v1alpha1 scheduling:v1beta1" \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt "${CODEGEN_PKG}/generate-internal-groups.sh" "deepcopy,conversion" \ volcano.sh/volcano/pkg/apis/ volcano.sh/volcano/pkg/apis volcano.sh/volcano/pkg/apis\ - "scheduling:v1alpha1,v1alpha2,v1beta1" \ + "scheduling:v1beta1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt diff --git a/installer/helm/chart/volcano/templates/admission.yaml b/installer/helm/chart/volcano/templates/admission.yaml index 8bc482174f..76f2dff35f 100644 --- a/installer/helm/chart/volcano/templates/admission.yaml +++ b/installer/helm/chart/volcano/templates/admission.yaml @@ -25,13 +25,13 @@ rules: - apiGroups: [""] resources: ["secrets"] verbs: ["create", "get", "patch"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["queues"] verbs: ["get", "list"] - apiGroups: [""] resources: ["services"] verbs: ["get"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups"] verbs: ["get", "list", "watch"] diff --git a/installer/helm/chart/volcano/templates/controllers.yaml b/installer/helm/chart/volcano/templates/controllers.yaml index ed343eacf9..b544884659 100644 --- a/installer/helm/chart/volcano/templates/controllers.yaml +++ b/installer/helm/chart/volcano/templates/controllers.yaml @@ -43,7 +43,7 @@ rules: - apiGroups: [""] resources: ["secrets"] verbs: ["get", "list", "watch", "create", "delete", "update"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups", "queues", "queues/status"] verbs: ["get", "list", "watch", "create", "delete", "update"] - apiGroups: ["scheduling.k8s.io"] diff --git a/installer/helm/chart/volcano/templates/scheduler.yaml b/installer/helm/chart/volcano/templates/scheduler.yaml index 94b181bcde..cd245437fc 100644 --- a/installer/helm/chart/volcano/templates/scheduler.yaml +++ b/installer/helm/chart/volcano/templates/scheduler.yaml @@ -59,10 +59,10 @@ rules: - apiGroups: ["scheduling.k8s.io"] resources: ["priorityclasses"] verbs: ["get", "list", "watch"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["queues"] verbs: ["get", "list", "watch", "create", "delete"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups"] verbs: ["list", "watch", "update"] diff --git a/installer/helm/chart/volcano/templates/scheduling_v1alpha1_podgroup.yaml b/installer/helm/chart/volcano/templates/scheduling_v1alpha1_podgroup.yaml deleted file mode 100644 index 244459a520..0000000000 --- a/installer/helm/chart/volcano/templates/scheduling_v1alpha1_podgroup.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: podgroups.scheduling.incubator.k8s.io -spec: - group: scheduling.incubator.k8s.io - names: - kind: PodGroup - plural: podgroups - scope: Namespaced - validation: - openAPIV3Schema: - type: object - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - minMember: - format: int32 - type: integer - type: object - status: - properties: - succeeded: - format: int32 - type: integer - failed: - format: int32 - type: integer - running: - format: int32 - type: integer - type: object - version: v1alpha1 diff --git a/installer/helm/chart/volcano/templates/scheduling_v1alpha1_queue.yaml b/installer/helm/chart/volcano/templates/scheduling_v1alpha1_queue.yaml deleted file mode 100644 index 1398b51b8e..0000000000 --- a/installer/helm/chart/volcano/templates/scheduling_v1alpha1_queue.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: queues.scheduling.incubator.k8s.io -spec: - group: scheduling.incubator.k8s.io - names: - kind: Queue - plural: queues - scope: Cluster - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - weight: - format: int32 - type: integer - type: object - type: object - version: v1alpha1 - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/installer/helm/chart/volcano/templates/scheduling_v1alpha2_podgroup.yaml b/installer/helm/chart/volcano/templates/scheduling_v1beta1_podgroup.yaml similarity index 88% rename from installer/helm/chart/volcano/templates/scheduling_v1alpha2_podgroup.yaml rename to installer/helm/chart/volcano/templates/scheduling_v1beta1_podgroup.yaml index a5c8a7d08f..f63b04b2ad 100644 --- a/installer/helm/chart/volcano/templates/scheduling_v1alpha2_podgroup.yaml +++ b/installer/helm/chart/volcano/templates/scheduling_v1beta1_podgroup.yaml @@ -1,15 +1,15 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: podgroups.scheduling.sigs.dev + name: podgroups.scheduling.volcano.sh spec: - group: scheduling.sigs.dev + group: scheduling.volcano.sh names: kind: PodGroup plural: podgroups shortNames: - pg - - podgroup-v1alpha2 + - podgroup-v1beta1 scope: Namespaced validation: openAPIV3Schema: @@ -43,4 +43,4 @@ spec: type: integer type: object type: object - version: v1alpha2 + version: v1beta1 diff --git a/installer/helm/chart/volcano/templates/scheduling_v1alpha2_queue.yaml b/installer/helm/chart/volcano/templates/scheduling_v1beta1_queue.yaml similarity index 90% rename from installer/helm/chart/volcano/templates/scheduling_v1alpha2_queue.yaml rename to installer/helm/chart/volcano/templates/scheduling_v1beta1_queue.yaml index 195053253e..c11e2e89bf 100644 --- a/installer/helm/chart/volcano/templates/scheduling_v1alpha2_queue.yaml +++ b/installer/helm/chart/volcano/templates/scheduling_v1beta1_queue.yaml @@ -1,15 +1,15 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: queues.scheduling.sigs.dev + name: queues.scheduling.volcano.sh spec: - group: scheduling.sigs.dev + group: scheduling.volcano.sh names: kind: Queue plural: queues shortNames: - q - - queue-v1alpha2 + - queue-v1beta1 scope: Cluster validation: openAPIV3Schema: @@ -48,6 +48,6 @@ spec: type: integer type: object type: object - version: v1alpha2 + version: v1beta1 subresources: status: {} diff --git a/installer/volcano-development.yaml b/installer/volcano-development.yaml index bce0fb1f3a..521b4db370 100644 --- a/installer/volcano-development.yaml +++ b/installer/volcano-development.yaml @@ -78,10 +78,10 @@ rules: - apiGroups: ["scheduling.k8s.io"] resources: ["priorityclasses"] verbs: ["get", "list", "watch"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["queues"] verbs: ["get", "list", "watch", "create", "delete"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups"] verbs: ["list", "watch", "update"] @@ -165,13 +165,13 @@ rules: - apiGroups: [""] resources: ["secrets"] verbs: ["create", "get", "patch"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["queues"] verbs: ["get", "list"] - apiGroups: [""] resources: ["services"] verbs: ["get"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups"] verbs: ["get", "list", "watch"] @@ -318,7 +318,7 @@ rules: - apiGroups: [""] resources: ["secrets"] verbs: ["get", "list", "watch", "create", "delete", "update"] - - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.sigs.dev"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] resources: ["podgroups", "queues", "queues/status"] verbs: ["get", "list", "watch", "create", "delete", "update"] - apiGroups: ["scheduling.k8s.io"] @@ -620,99 +620,19 @@ status: storedVersions: [] --- -# Source: volcano/templates/scheduling_v1alpha1_podgroup.yaml +# Source: volcano/templates/scheduling_v1beta1_podgroup.yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: podgroups.scheduling.incubator.k8s.io + name: podgroups.scheduling.volcano.sh spec: - group: scheduling.incubator.k8s.io - names: - kind: PodGroup - plural: podgroups - scope: Namespaced - validation: - openAPIV3Schema: - type: object - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - minMember: - format: int32 - type: integer - type: object - status: - properties: - succeeded: - format: int32 - type: integer - failed: - format: int32 - type: integer - running: - format: int32 - type: integer - type: object - version: v1alpha1 - ---- -# Source: volcano/templates/scheduling_v1alpha1_queue.yaml -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: queues.scheduling.incubator.k8s.io -spec: - group: scheduling.incubator.k8s.io - names: - kind: Queue - plural: queues - scope: Cluster - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - weight: - format: int32 - type: integer - type: object - type: object - version: v1alpha1 - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] - ---- -# Source: volcano/templates/scheduling_v1alpha2_podgroup.yaml -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: podgroups.scheduling.sigs.dev -spec: - group: scheduling.sigs.dev + group: scheduling.volcano.sh names: kind: PodGroup plural: podgroups shortNames: - pg - - podgroup-v1alpha2 + - podgroup-v1beta1 scope: Namespaced validation: openAPIV3Schema: @@ -746,22 +666,22 @@ spec: type: integer type: object type: object - version: v1alpha2 + version: v1beta1 --- -# Source: volcano/templates/scheduling_v1alpha2_queue.yaml +# Source: volcano/templates/scheduling_v1beta1_queue.yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: queues.scheduling.sigs.dev + name: queues.scheduling.volcano.sh spec: - group: scheduling.sigs.dev + group: scheduling.volcano.sh names: kind: Queue plural: queues shortNames: - q - - queue-v1alpha2 + - queue-v1beta1 scope: Cluster validation: openAPIV3Schema: @@ -800,7 +720,7 @@ spec: type: integer type: object type: object - version: v1alpha2 + version: v1beta1 subresources: status: {} diff --git a/installer/volcano-latest.yaml b/installer/volcano-latest.yaml new file mode 100644 index 0000000000..d509388ac3 --- /dev/null +++ b/installer/volcano-latest.yaml @@ -0,0 +1,726 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: volcano-system +--- +# Source: volcano/templates/scheduler.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: volcano-scheduler-configmap + namespace: volcano-system +data: + volcano-scheduler.conf: | + actions: "enqueue, allocate, backfill" + tiers: + - plugins: + - name: priority + - name: gang + - name: conformance + - plugins: + - name: drf + - name: predicates + - name: proportion + - name: nodeorder + - name: binpack + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: volcano-scheduler + namespace: volcano-system +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-scheduler +rules: + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["create", "get", "list", "watch", "delete"] + - apiGroups: ["batch.volcano.sh"] + resources: ["jobs"] + verbs: ["get", "list", "watch", "update", "delete"] + - apiGroups: ["batch.volcano.sh"] + resources: ["jobs/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["create", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["pods", "pods/status"] + verbs: ["create", "get", "list", "watch", "update", "bind", "updateStatus", "delete"] + - apiGroups: [""] + resources: ["pods/binding"] + verbs: ["create"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["list", "watch"] + - apiGroups: [""] + resources: ["namespaces"] + verbs: ["list", "watch"] + - apiGroups: [""] + resources: ["resourcequotas"] + verbs: ["list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["list", "watch"] + - apiGroups: ["policy"] + resources: ["poddisruptionbudgets"] + verbs: ["list", "watch"] + - apiGroups: ["scheduling.k8s.io"] + resources: ["priorityclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] + resources: ["queues"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] + resources: ["podgroups"] + verbs: ["list", "watch", "update"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-scheduler-role +subjects: + - kind: ServiceAccount + name: volcano-scheduler + namespace: volcano-system +roleRef: + kind: ClusterRole + name: volcano-scheduler + apiGroup: rbac.authorization.k8s.io + +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: volcano-scheduler + namespace: volcano-system + labels: + app: volcano-scheduler +spec: + replicas: 1 + selector: + matchLabels: + app: volcano-scheduler + template: + metadata: + labels: + app: volcano-scheduler + spec: + serviceAccount: volcano-scheduler + + containers: + - name: volcano-scheduler + image: volcanosh/vc-scheduler:latest + args: + - --alsologtostderr + - --scheduler-conf=/volcano.scheduler/volcano-scheduler.conf + - -v=3 + - 2>&1 + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: scheduler-config + mountPath: /volcano.scheduler + volumes: + - name: scheduler-config + configMap: + name: volcano-scheduler-configmap + +--- +# Source: volcano/templates/admission.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: volcano-admission + namespace: volcano-system +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-admission +rules: + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "watch"] + - apiGroups: ["admissionregistration.k8s.io"] + resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"] + verbs: ["get", "list", "watch", "create", "update"] + # Rules below is used generate admission service secret + - apiGroups: ["certificates.k8s.io"] + resources: ["certificatesigningrequests"] + verbs: ["get", "list", "create", "delete"] + - apiGroups: ["certificates.k8s.io"] + resources: ["certificatesigningrequests/approval"] + verbs: ["create", "update"] + - apiGroups: [""] + resources: ["secrets"] + verbs: ["create", "get", "patch"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] + resources: ["queues"] + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["services"] + verbs: ["get"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] + resources: ["podgroups"] + verbs: ["get", "list", "watch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-admission-role +subjects: + - kind: ServiceAccount + name: volcano-admission + namespace: volcano-system +roleRef: + kind: ClusterRole + name: volcano-admission + apiGroup: rbac.authorization.k8s.io + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: volcano-admission + name: volcano-admission + namespace: volcano-system +spec: + replicas: 1 + selector: + matchLabels: + app: volcano-admission + template: + metadata: + labels: + app: volcano-admission + spec: + serviceAccount: volcano-admission + + containers: + - args: + - --tls-cert-file=/admission.local.config/certificates/tls.crt + - --tls-private-key-file=/admission.local.config/certificates/tls.key + - --ca-cert-file=/admission.local.config/certificates/ca.crt + - --webhook-namespace=volcano-system + - --webhook-service-name=volcano-admission-service + - --alsologtostderr + - --port=443 + - -v=4 + - 2>&1 + image: volcanosh/vc-webhook-manager:latest + imagePullPolicy: IfNotPresent + name: admission + volumeMounts: + - mountPath: /admission.local.config/certificates + name: admission-certs + readOnly: true + volumes: + - name: admission-certs + secret: + defaultMode: 420 + secretName: volcano-admission-secret + +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: volcano-admission + name: volcano-admission-service + namespace: volcano-system +spec: + ports: + - port: 443 + protocol: TCP + targetPort: 443 + selector: + app: volcano-admission + sessionAffinity: None + +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: volcano-admission-init + namespace: volcano-system + labels: + app: volcano-admission-init +spec: + backoffLimit: 3 + template: + spec: + serviceAccountName: volcano-admission + restartPolicy: Never + containers: + - name: main + image: volcanosh/vc-webhook-manager:latest + imagePullPolicy: IfNotPresent + command: ["./gen-admission-secret.sh", "--service", "volcano-admission-service", "--namespace", + "volcano-system", "--secret", "volcano-admission-secret"] + +--- +# Source: volcano/templates/controllers.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: volcano-controllers + namespace: volcano-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-controllers +rules: + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["create", "get", "list", "watch", "delete"] + - apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create", "get", "list", "watch", "delete", "update"] + - apiGroups: ["batch.volcano.sh"] + resources: ["jobs"] + verbs: ["get", "list", "watch", "update", "delete"] + - apiGroups: ["batch.volcano.sh"] + resources: ["jobs/status"] + verbs: ["update", "patch"] + - apiGroups: ["bus.volcano.sh"] + resources: ["commands"] + verbs: ["get", "list", "watch", "delete"] + - apiGroups: [""] + resources: ["events"] + verbs: ["create", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["create", "get", "list", "watch", "update", "bind", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "create"] + - apiGroups: [""] + resources: ["services"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "watch", "create", "delete", "update"] + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list", "watch", "create", "delete", "update"] + - apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] + resources: ["podgroups", "queues", "queues/status"] + verbs: ["get", "list", "watch", "create", "delete", "update"] + - apiGroups: ["scheduling.k8s.io"] + resources: ["priorityclasses"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: ["networking.k8s.io"] + resources: ["networkpolicies"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: volcano-controllers-role +subjects: + - kind: ServiceAccount + name: volcano-controllers + namespace: volcano-system +roleRef: + kind: ClusterRole + name: volcano-controllers + apiGroup: rbac.authorization.k8s.io + +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: volcano-controllers + namespace: volcano-system + labels: + app: volcano-controller +spec: + replicas: 1 + selector: + matchLabels: + app: volcano-controller + template: + metadata: + labels: + app: volcano-controller + spec: + serviceAccount: volcano-controllers + + containers: + - name: volcano-controllers + image: volcanosh/vc-controller-manager:latest + args: + - --alsologtostderr + - -v=4 + - 2>&1 + imagePullPolicy: "IfNotPresent" + +--- +# Source: volcano/templates/batch_v1alpha1_job.yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: jobs.batch.volcano.sh +spec: + group: batch.volcano.sh + names: + kind: Job + plural: jobs + shortNames: + - vcjob + - vj + scope: Namespaced + validation: + openAPIV3Schema: + type: object + 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/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/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Specification of the desired behavior of a cron job, including + the minAvailable + properties: + volumes: + description: The volumes for Job + items: + properties: + volumeClaim: + description: VolumeClaim defines the PVC used by the VolumeMount. + type: object + mountPath: + description: Path within the container at which the volume should be mounted. + Must not contain ':'. + type: string + volumeClaimName: + description: The name of the volume claim. + type: string + type: object + required: + - mountPath + type: array + minAvailable: + description: The minimal available pods to run for this Job + format: int32 + type: integer + policies: + description: Specifies the default lifecycle of tasks + items: + properties: + action: + description: The action that will be taken to the PodGroup according + to Event. One of "Restart", "None". Default to None. + type: string + event: + description: The Event recorded by scheduler; the controller takes + actions according to this Event. + type: string + events: + description: The Events recorded by scheduler; the controller takes + actions according to this Events. + type: array + items: + type: string + timeout: + description: Timeout is the grace period for controller to take + actions. Default to nil (take action immediately). + type: object + type: object + type: array + schedulerName: + description: SchedulerName is the default value of `tasks.template.spec.schedulerName`. + type: string + plugins: + description: Enabled task plugins when creating job. + type: object + tasks: + description: Tasks specifies the task specification of Job + items: + properties: + name: + description: Name specifies the name of tasks + type: string + policies: + description: Specifies the lifecycle of task + items: + properties: + action: + description: The action that will be taken to the PodGroup + according to Event. One of "Restart", "None". Default + to None. + type: string + event: + description: The Event recorded by scheduler; the controller + takes actions according to this Event. + type: string + events: + description: The Events recorded by scheduler; the controller takes + actions according to this Events. + type: array + items: + type: string + timeout: + description: Timeout is the grace period for controller + to take actions. Default to nil (take action immediately). + type: object + type: object + type: array + replicas: + description: Replicas specifies the replicas of this TaskSpec + in Job + format: int32 + type: integer + template: + description: Specifies the pod that will be created for this TaskSpec + when executing a Job + type: object + type: object + type: array + queue: + description: The name of the queue on which job should been created + type: string + maxRetry: + description: The limit for retrying submiting job, default is 3 + format: int32 + type: integer + type: object + status: + description: Current status of Job + properties: + Succeeded: + description: The number of pods which reached phase Succeeded. + format: int32 + type: integer + failed: + description: The number of pods which reached phase Failed. + format: int32 + type: integer + minAvailable: + description: The minimal available pods to run for this Job + format: int32 + type: integer + pending: + description: The number of pending pods. + format: int32 + type: integer + running: + description: The number of running pods. + format: int32 + type: integer + version: + description: Job's current version + format: int32 + type: integer + retryCount: + description: The number that volcano retried to submit the job. + format: int32 + type: integer + ControlledResources: + description: All of the resources that are controlled by this job. + type: object + additionalProperties: + type: string + state: + description: Current state of Job. + properties: + message: + description: Human-readable message indicating details about last + transition. + type: string + phase: + description: The phase of Job + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + type: string + type: object + type: object + version: v1alpha1 + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] + +--- +# Source: volcano/templates/bus_v1alpha1_command.yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: commands.bus.volcano.sh +spec: + group: bus.volcano.sh + names: + kind: Command + plural: commands + scope: Namespaced + validation: + openAPIV3Schema: + type: object + properties: + action: + description: Action defines the action that will be took to the target object. + type: string + 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/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/api-conventions.md#types-kinds' + type: string + message: + description: Human-readable message indicating details of this command. + type: string + metadata: + type: object + reason: + description: Unique, one-word, CamelCase reason for this command. + type: string + target: + description: TargetObject defines the target object of this command. + type: object + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] + +--- +# Source: volcano/templates/scheduling_v1beta1_podgroup.yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: podgroups.scheduling.volcano.sh +spec: + group: scheduling.volcano.sh + names: + kind: PodGroup + plural: podgroups + shortNames: + - pg + - podgroup-v1alpha2 + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + minMember: + format: int32 + type: integer + queue: + type: string + priorityClassName: + type: string + type: object + status: + properties: + succeeded: + format: int32 + type: integer + failed: + format: int32 + type: integer + running: + format: int32 + type: integer + type: object + type: object + version: v1beta1 + +--- +# Source: volcano/templates/scheduling_v1beta1_queue.yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: queues.scheduling.volcano.sh +spec: + group: scheduling.volcano.sh + names: + kind: Queue + plural: queues + shortNames: + - q + - queue-v1alpha2 + scope: Cluster + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + weight: + format: int32 + type: integer + capability: + type: object + state: + type: string + type: object + status: + properties: + state: + type: string + unknown: + format: int32 + type: integer + pending: + format: int32 + type: integer + running: + format: int32 + type: integer + inqueue: + format: int32 + type: integer + type: object + type: object + version: v1beta1 + subresources: + status: {} + diff --git a/pkg/apis/helpers/helpers.go b/pkg/apis/helpers/helpers.go index 30e53c5612..9e2467c792 100644 --- a/pkg/apis/helpers/helpers.go +++ b/pkg/apis/helpers/helpers.go @@ -40,7 +40,7 @@ import ( vcbatch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" vcbus "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulerv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulerv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) // JobKind creates job GroupVersionKind @@ -49,8 +49,8 @@ var JobKind = vcbatch.SchemeGroupVersion.WithKind("Job") // CommandKind creates command GroupVersionKind var CommandKind = vcbus.SchemeGroupVersion.WithKind("Command") -// V1alpha2QueueKind is queue kind with v1alpha2 version -var V1alpha2QueueKind = schedulerv1alpha2.SchemeGroupVersion.WithKind("Queue") +// V1beta1QueueKind is queue kind with v1alpha2 version +var V1beta1QueueKind = schedulerv1beta1.SchemeGroupVersion.WithKind("Queue") // GetController returns the controller uid func GetController(obj interface{}) types.UID { diff --git a/pkg/apis/scheduling/scheme/scheme.go b/pkg/apis/scheduling/scheme/scheme.go index 6a03f0f856..533f615599 100644 --- a/pkg/apis/scheduling/scheme/scheme.go +++ b/pkg/apis/scheduling/scheme/scheme.go @@ -20,8 +20,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" "volcano.sh/volcano/pkg/apis/scheduling" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) var ( @@ -38,7 +37,6 @@ func init() { // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { - v1alpha1.AddToScheme(scheme) - v1alpha2.AddToScheme(scheme) + v1beta1.AddToScheme(scheme) scheduling.AddToScheme(scheme) } diff --git a/pkg/apis/scheduling/v1alpha1/conversion.go b/pkg/apis/scheduling/v1alpha1/conversion.go deleted file mode 100644 index 18b14af33b..0000000000 --- a/pkg/apis/scheduling/v1alpha1/conversion.go +++ /dev/null @@ -1,44 +0,0 @@ -package v1alpha1 - -import ( - "unsafe" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/conversion" - "k8s.io/apimachinery/pkg/runtime" - - "volcano.sh/volcano/pkg/apis/scheduling" -) - -func init() { - localSchemeBuilder.Register(addConversionFuncs) -} - -func addConversionFuncs(scheme *runtime.Scheme) error { - // Add non-generated conversion functions to handle the *int32 -> int32 - // conversion. A pointer is useful in the versioned type so we can default - // it, but a plain int32 is more convenient in the internal type. These - // functions are the same as the autogenerated ones in every other way. - err := scheme.AddConversionFuncs( - Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus, - Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec, - ) - if err != nil { - return err - } - - return nil -} - -func Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { - out.Unknown = in.Unknown - out.Pending = in.Pending - out.Running = in.Running - return nil -} - -func Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { - out.Weight = in.Weight - out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - return nil -} diff --git a/pkg/apis/scheduling/v1alpha1/doc.go b/pkg/apis/scheduling/v1alpha1/doc.go deleted file mode 100644 index 5a1739b071..0000000000 --- a/pkg/apis/scheduling/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -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. -*/ - -// +k8s:deepcopy-gen=package -// +k8s:conversion-gen=volcano.sh/volcano/pkg/apis/scheduling - -package v1alpha1 diff --git a/pkg/apis/scheduling/v1alpha1/labels.go b/pkg/apis/scheduling/v1alpha1/labels.go deleted file mode 100644 index 0fe02fe0b1..0000000000 --- a/pkg/apis/scheduling/v1alpha1/labels.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2018 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 v1alpha1 - -// GroupNameAnnotationKey is the annotation key of Pod to identify -// which PodGroup it belongs to. -const GroupNameAnnotationKey = "scheduling.k8s.io/group-name" diff --git a/pkg/apis/scheduling/v1alpha1/register.go b/pkg/apis/scheduling/v1alpha1/register.go deleted file mode 100644 index 97fe681e58..0000000000 --- a/pkg/apis/scheduling/v1alpha1/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = SchemeBuilder.AddToScheme -) - -const ( - // GroupName is the group name used in this package. - GroupName = "scheduling.incubator.k8s.io" - - // GroupVersion is the version of scheduling group - GroupVersion = "v1alpha1" -) - -// SchemeGroupVersion is the group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} - -// Resource takes an unqualified resource and returns a Group-qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PodGroup{}, - &PodGroupList{}, - &Queue{}, - &QueueList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/scheduling/v1alpha1/types.go b/pkg/apis/scheduling/v1alpha1/types.go deleted file mode 100644 index 03e1d97185..0000000000 --- a/pkg/apis/scheduling/v1alpha1/types.go +++ /dev/null @@ -1,237 +0,0 @@ -/* -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 v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// PodGroupPhase is the phase of a pod group at the current time. -type PodGroupPhase string - -// These are the valid phase of podGroups. -const ( - // PodPending means the pod group has been accepted by the system, but scheduler can not allocate - // enough resources to it. - PodGroupPending PodGroupPhase = "Pending" - - // PodRunning means `spec.minMember` pods of PodGroups has been in running phase. - PodGroupRunning PodGroupPhase = "Running" - - // PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not - // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it. - PodGroupUnknown PodGroupPhase = "Unknown" - - // PodGroupInqueue means controllers can start to create pods, - // is a new state between PodGroupPending and PodGroupRunning - PodGroupInqueue PodGroupPhase = "Inqueue" -) - -type PodGroupConditionType string - -const ( - // PodGroupUnschedulableType is Unschedulable event type - PodGroupUnschedulableType PodGroupConditionType = "Unschedulable" - - // PodGroupScheduled is scheduled event type - PodGroupScheduled PodGroupConditionType = "Scheduled" -) - -type PodGroupConditionDetail string - -const ( - // PodGroupReady is that PodGroup has reached scheduling restriction - PodGroupReady PodGroupConditionDetail = "pod group is ready" - // PodGroupNotReady is that PodGroup has not yet reached the scheduling restriction - PodGroupNotReady PodGroupConditionDetail = "pod group is not ready" -) - -// PodGroupCondition contains details for the current state of this pod group. -type PodGroupCondition struct { - // Type is the type of the condition - Type PodGroupConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` - - // Status is the status of the condition. - Status v1.ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` - - // The ID of condition transition. - TransitionID string `json:"transitionID,omitempty" protobuf:"bytes,3,opt,name=transitionID"` - - // Last time the phase transitioned from another to current phase. - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` - - // Unique, one-word, CamelCase reason for the phase's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` - - // Human-readable message indicating details about last transition. - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` -} - -const ( - // PodFailedReason is probed if pod of PodGroup failed - PodFailedReason string = "PodFailed" - - // PodDeletedReason is probed if pod of PodGroup deleted - PodDeletedReason string = "PodDeleted" - - // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods - NotEnoughResourcesReason string = "NotEnoughResources" - - // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember` - NotEnoughPodsReason string = "NotEnoughTasks" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodGroup is a collection of Pod; used for batch workload. -type PodGroup struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the pod group. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - // +optional - Spec PodGroupSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Status represents the current information about a pod group. - // This data may not be up to date. - // +optional - Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// PodGroupSpec represents the template of a pod group. -type PodGroupSpec struct { - // 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. - MinMember int32 `json:"minMember,omitempty" protobuf:"bytes,1,opt,name=minMember"` - - // Queue defines the queue to allocate resource for PodGroup; if queue does not exist, - // the PodGroup will not be scheduled. Defaults to `default` Queue with the lowest weight. - // +optional - Queue string `json:"queue,omitempty" protobuf:"bytes,2,opt,name=queue"` - - // 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. - // +optional - PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,3,opt,name=priorityClassName"` - - // 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. - MinResources *v1.ResourceList `json:"minResources,omitempty" protobuf:"bytes,4,opt,name=minResources"` -} - -// PodGroupStatus represents the current state of a pod group. -type PodGroupStatus struct { - // Current phase of PodGroup. - Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"` - - // The conditions of PodGroup. - // +optional - Conditions []PodGroupCondition `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` - - // The number of actively running pods. - // +optional - Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` - - // The number of pods which reached phase Succeeded. - // +optional - Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,4,opt,name=succeeded"` - - // The number of pods which reached phase Failed. - // +optional - Failed int32 `json:"failed,omitempty" protobuf:"bytes,5,opt,name=failed"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodGroupList is a collection of pod groups. -type PodGroupList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of PodGroup - Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Queue is a queue of PodGroup. -type Queue struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the queue. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - // +optional - Spec QueueSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // The status of queue. - // +optional - Status QueueStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// QueueStatus represents the status of Queue. -type QueueStatus struct { - // The number of 'Unknown' PodGroup in this queue. - Unknown int32 `json:"unknown,omitempty" protobuf:"bytes,1,opt,name=unknown"` - // The number of 'Pending' PodGroup in this queue. - Pending int32 `json:"pending,omitempty" protobuf:"bytes,2,opt,name=pending"` - // The number of 'Running' PodGroup in this queue. - Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` -} - -// QueueSpec represents the template of Queue. -type QueueSpec struct { - Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` - Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// QueueList is a collection of queues. -type QueueList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of PodGroup - Items []Queue `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go b/pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go deleted file mode 100644 index 5db7d4efa6..0000000000 --- a/pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go +++ /dev/null @@ -1,392 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - unsafe "unsafe" - - v1 "k8s.io/api/core/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - scheduling "volcano.sh/volcano/pkg/apis/scheduling" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*PodGroup)(nil), (*scheduling.PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodGroup_To_scheduling_PodGroup(a.(*PodGroup), b.(*scheduling.PodGroup), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroup)(nil), (*PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroup_To_v1alpha1_PodGroup(a.(*scheduling.PodGroup), b.(*PodGroup), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupCondition)(nil), (*scheduling.PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodGroupCondition_To_scheduling_PodGroupCondition(a.(*PodGroupCondition), b.(*scheduling.PodGroupCondition), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupCondition)(nil), (*PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupCondition_To_v1alpha1_PodGroupCondition(a.(*scheduling.PodGroupCondition), b.(*PodGroupCondition), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupList)(nil), (*scheduling.PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodGroupList_To_scheduling_PodGroupList(a.(*PodGroupList), b.(*scheduling.PodGroupList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupList)(nil), (*PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupList_To_v1alpha1_PodGroupList(a.(*scheduling.PodGroupList), b.(*PodGroupList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupSpec)(nil), (*scheduling.PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec(a.(*PodGroupSpec), b.(*scheduling.PodGroupSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupSpec)(nil), (*PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec(a.(*scheduling.PodGroupSpec), b.(*PodGroupSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupStatus)(nil), (*scheduling.PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus(a.(*PodGroupStatus), b.(*scheduling.PodGroupStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupStatus)(nil), (*PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus(a.(*scheduling.PodGroupStatus), b.(*PodGroupStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Queue)(nil), (*scheduling.Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_Queue_To_scheduling_Queue(a.(*Queue), b.(*scheduling.Queue), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.Queue)(nil), (*Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_Queue_To_v1alpha1_Queue(a.(*scheduling.Queue), b.(*Queue), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueList)(nil), (*scheduling.QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_QueueList_To_scheduling_QueueList(a.(*QueueList), b.(*scheduling.QueueList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueList)(nil), (*QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueList_To_v1alpha1_QueueList(a.(*scheduling.QueueList), b.(*QueueList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueSpec)(nil), (*scheduling.QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_QueueSpec_To_scheduling_QueueSpec(a.(*QueueSpec), b.(*scheduling.QueueSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueSpec)(nil), (*QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(a.(*scheduling.QueueSpec), b.(*QueueSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueStatus)(nil), (*scheduling.QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_QueueStatus_To_scheduling_QueueStatus(a.(*QueueStatus), b.(*scheduling.QueueStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueStatus)(nil), (*QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(a.(*scheduling.QueueStatus), b.(*QueueStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*scheduling.QueueSpec)(nil), (*QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(a.(*scheduling.QueueSpec), b.(*QueueSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*scheduling.QueueStatus)(nil), (*QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(a.(*scheduling.QueueStatus), b.(*QueueStatus), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha1_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_PodGroup_To_scheduling_PodGroup is an autogenerated conversion function. -func Convert_v1alpha1_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { - return autoConvert_v1alpha1_PodGroup_To_scheduling_PodGroup(in, out, s) -} - -func autoConvert_scheduling_PodGroup_To_v1alpha1_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_scheduling_PodGroup_To_v1alpha1_PodGroup is an autogenerated conversion function. -func Convert_scheduling_PodGroup_To_v1alpha1_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { - return autoConvert_scheduling_PodGroup_To_v1alpha1_PodGroup(in, out, s) -} - -func autoConvert_v1alpha1_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { - out.Type = scheduling.PodGroupConditionType(in.Type) - out.Status = v1.ConditionStatus(in.Status) - out.TransitionID = in.TransitionID - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_v1alpha1_PodGroupCondition_To_scheduling_PodGroupCondition is an autogenerated conversion function. -func Convert_v1alpha1_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { - return autoConvert_v1alpha1_PodGroupCondition_To_scheduling_PodGroupCondition(in, out, s) -} - -func autoConvert_scheduling_PodGroupCondition_To_v1alpha1_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { - out.Type = PodGroupConditionType(in.Type) - out.Status = v1.ConditionStatus(in.Status) - out.TransitionID = in.TransitionID - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_scheduling_PodGroupCondition_To_v1alpha1_PodGroupCondition is an autogenerated conversion function. -func Convert_scheduling_PodGroupCondition_To_v1alpha1_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupCondition_To_v1alpha1_PodGroupCondition(in, out, s) -} - -func autoConvert_v1alpha1_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]scheduling.PodGroup)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha1_PodGroupList_To_scheduling_PodGroupList is an autogenerated conversion function. -func Convert_v1alpha1_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { - return autoConvert_v1alpha1_PodGroupList_To_scheduling_PodGroupList(in, out, s) -} - -func autoConvert_scheduling_PodGroupList_To_v1alpha1_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]PodGroup)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_scheduling_PodGroupList_To_v1alpha1_PodGroupList is an autogenerated conversion function. -func Convert_scheduling_PodGroupList_To_v1alpha1_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupList_To_v1alpha1_PodGroupList(in, out, s) -} - -func autoConvert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { - out.MinMember = in.MinMember - out.Queue = in.Queue - out.PriorityClassName = in.PriorityClassName - out.MinResources = (*v1.ResourceList)(unsafe.Pointer(in.MinResources)) - return nil -} - -// Convert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec is an autogenerated conversion function. -func Convert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_PodGroupSpec_To_scheduling_PodGroupSpec(in, out, s) -} - -func autoConvert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { - out.MinMember = in.MinMember - out.Queue = in.Queue - out.PriorityClassName = in.PriorityClassName - out.MinResources = (*v1.ResourceList)(unsafe.Pointer(in.MinResources)) - return nil -} - -// Convert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec is an autogenerated conversion function. -func Convert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupSpec_To_v1alpha1_PodGroupSpec(in, out, s) -} - -func autoConvert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { - out.Phase = scheduling.PodGroupPhase(in.Phase) - out.Conditions = *(*[]scheduling.PodGroupCondition)(unsafe.Pointer(&in.Conditions)) - out.Running = in.Running - out.Succeeded = in.Succeeded - out.Failed = in.Failed - return nil -} - -// Convert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus is an autogenerated conversion function. -func Convert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_PodGroupStatus_To_scheduling_PodGroupStatus(in, out, s) -} - -func autoConvert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { - out.Phase = PodGroupPhase(in.Phase) - out.Conditions = *(*[]PodGroupCondition)(unsafe.Pointer(&in.Conditions)) - out.Running = in.Running - out.Succeeded = in.Succeeded - out.Failed = in.Failed - return nil -} - -// Convert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus is an autogenerated conversion function. -func Convert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupStatus_To_v1alpha1_PodGroupStatus(in, out, s) -} - -func autoConvert_v1alpha1_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_QueueSpec_To_scheduling_QueueSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_QueueStatus_To_scheduling_QueueStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_Queue_To_scheduling_Queue is an autogenerated conversion function. -func Convert_v1alpha1_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { - return autoConvert_v1alpha1_Queue_To_scheduling_Queue(in, out, s) -} - -func autoConvert_scheduling_Queue_To_v1alpha1_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_scheduling_Queue_To_v1alpha1_Queue is an autogenerated conversion function. -func Convert_scheduling_Queue_To_v1alpha1_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { - return autoConvert_scheduling_Queue_To_v1alpha1_Queue(in, out, s) -} - -func autoConvert_v1alpha1_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]scheduling.Queue, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_Queue_To_scheduling_Queue(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha1_QueueList_To_scheduling_QueueList is an autogenerated conversion function. -func Convert_v1alpha1_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { - return autoConvert_v1alpha1_QueueList_To_scheduling_QueueList(in, out, s) -} - -func autoConvert_scheduling_QueueList_To_v1alpha1_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Queue, len(*in)) - for i := range *in { - if err := Convert_scheduling_Queue_To_v1alpha1_Queue(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_scheduling_QueueList_To_v1alpha1_QueueList is an autogenerated conversion function. -func Convert_scheduling_QueueList_To_v1alpha1_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { - return autoConvert_scheduling_QueueList_To_v1alpha1_QueueList(in, out, s) -} - -func autoConvert_v1alpha1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { - out.Weight = in.Weight - out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - return nil -} - -// Convert_v1alpha1_QueueSpec_To_scheduling_QueueSpec is an autogenerated conversion function. -func Convert_v1alpha1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_QueueSpec_To_scheduling_QueueSpec(in, out, s) -} - -func autoConvert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { - out.Weight = in.Weight - out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - // WARNING: in.State requires manual conversion: does not exist in peer-type - // WARNING: in.Reclaimable requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha1_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { - out.Unknown = in.Unknown - out.Pending = in.Pending - out.Running = in.Running - return nil -} - -// Convert_v1alpha1_QueueStatus_To_scheduling_QueueStatus is an autogenerated conversion function. -func Convert_v1alpha1_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_QueueStatus_To_scheduling_QueueStatus(in, out, s) -} - -func autoConvert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { - // WARNING: in.State requires manual conversion: does not exist in peer-type - out.Unknown = in.Unknown - out.Pending = in.Pending - out.Running = in.Running - // WARNING: in.Inqueue requires manual conversion: does not exist in peer-type - return nil -} diff --git a/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index e803319da5..0000000000 --- a/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,255 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroup) DeepCopyInto(out *PodGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. -func (in *PodGroup) DeepCopy() *PodGroup { - if in == nil { - return nil - } - out := new(PodGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroup) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupCondition) DeepCopyInto(out *PodGroupCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupCondition. -func (in *PodGroupCondition) DeepCopy() *PodGroupCondition { - if in == nil { - return nil - } - out := new(PodGroupCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PodGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. -func (in *PodGroupList) DeepCopy() *PodGroupList { - if in == nil { - return nil - } - out := new(PodGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { - *out = *in - if in.MinResources != nil { - in, out := &in.MinResources, &out.MinResources - *out = new(v1.ResourceList) - if **in != nil { - in, out := *in, *out - *out = make(map[v1.ResourceName]resource.Quantity, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. -func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { - if in == nil { - return nil - } - out := new(PodGroupSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]PodGroupCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. -func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { - if in == nil { - return nil - } - out := new(PodGroupStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Queue) DeepCopyInto(out *Queue) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Queue. -func (in *Queue) DeepCopy() *Queue { - if in == nil { - return nil - } - out := new(Queue) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Queue) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueList) DeepCopyInto(out *QueueList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Queue, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueList. -func (in *QueueList) DeepCopy() *QueueList { - if in == nil { - return nil - } - out := new(QueueList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *QueueList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueSpec) DeepCopyInto(out *QueueSpec) { - *out = *in - if in.Capability != nil { - in, out := &in.Capability, &out.Capability - *out = make(v1.ResourceList, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueSpec. -func (in *QueueSpec) DeepCopy() *QueueSpec { - if in == nil { - return nil - } - out := new(QueueSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueStatus) DeepCopyInto(out *QueueStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueStatus. -func (in *QueueStatus) DeepCopy() *QueueStatus { - if in == nil { - return nil - } - out := new(QueueStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/scheduling/v1alpha2/doc.go b/pkg/apis/scheduling/v1alpha2/doc.go deleted file mode 100644 index 8586157eb9..0000000000 --- a/pkg/apis/scheduling/v1alpha2/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -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. -*/ - -// +k8s:deepcopy-gen=package -// +k8s:conversion-gen=volcano.sh/volcano/pkg/apis/scheduling - -package v1alpha2 diff --git a/pkg/apis/scheduling/v1alpha2/labels.go b/pkg/apis/scheduling/v1alpha2/labels.go deleted file mode 100644 index f962f1baf1..0000000000 --- a/pkg/apis/scheduling/v1alpha2/labels.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2018 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 v1alpha2 - -// GroupNameAnnotationKey is the annotation key of Pod to identify -// which PodGroup it belongs to. -const GroupNameAnnotationKey = "scheduling.k8s.io/group-name" diff --git a/pkg/apis/scheduling/v1alpha2/register.go b/pkg/apis/scheduling/v1alpha2/register.go deleted file mode 100644 index afaf754297..0000000000 --- a/pkg/apis/scheduling/v1alpha2/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -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 v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = SchemeBuilder.AddToScheme -) - -const ( - // GroupName is the group name used in this package. - GroupName = "scheduling.sigs.dev" - - // GroupVersion is the version of scheduling group - GroupVersion = "v1alpha2" -) - -// SchemeGroupVersion is the group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} - -// Resource takes an unqualified resource and returns a Group-qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PodGroup{}, - &PodGroupList{}, - &Queue{}, - &QueueList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/scheduling/v1alpha2/types.go b/pkg/apis/scheduling/v1alpha2/types.go deleted file mode 100644 index e78d636153..0000000000 --- a/pkg/apis/scheduling/v1alpha2/types.go +++ /dev/null @@ -1,259 +0,0 @@ -/* -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 v1alpha2 - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// PodGroupPhase is the phase of a pod group at the current time. -type PodGroupPhase string - -// QueueState is state type of queue -type QueueState string - -const ( - // QueueStateOpen indicate `Open` state of queue - QueueStateOpen QueueState = "Open" - // QueueStateClosed indicate `Closed` state of queue - QueueStateClosed QueueState = "Closed" - // QueueStateClosing indicate `Closing` state of queue - QueueStateClosing QueueState = "Closing" - // QueueStateUnknown indicate `Unknown` state of queue - QueueStateUnknown QueueState = "Unknown" -) - -// These are the valid phase of podGroups. -const ( - // PodPending means the pod group has been accepted by the system, but scheduler can not allocate - // enough resources to it. - PodGroupPending PodGroupPhase = "Pending" - - // PodRunning means `spec.minMember` pods of PodGroups has been in running phase. - PodGroupRunning PodGroupPhase = "Running" - - // PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not - // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it. - PodGroupUnknown PodGroupPhase = "Unknown" - - // PodGroupInqueue means controllers can start to create pods, - // is a new state between PodGroupPending and PodGroupRunning - PodGroupInqueue PodGroupPhase = "Inqueue" -) - -type PodGroupConditionType string - -const ( - // PodGroupUnschedulableType is Unschedulable event type - PodGroupUnschedulableType PodGroupConditionType = "Unschedulable" - - // PodGroupScheduled is scheduled event type - PodGroupScheduled PodGroupConditionType = "Scheduled" -) - -type PodGroupConditionDetail string - -const ( - // PodGroupReady is that PodGroup has reached scheduling restriction - PodGroupReady PodGroupConditionDetail = "pod group is ready" - // PodGroupNotReady is that PodGroup has not yet reached the scheduling restriction - PodGroupNotReady PodGroupConditionDetail = "pod group is not ready" -) - -// PodGroupCondition contains details for the current state of this pod group. -type PodGroupCondition struct { - // Type is the type of the condition - Type PodGroupConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` - - // Status is the status of the condition. - Status v1.ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` - - // The ID of condition transition. - TransitionID string `json:"transitionID,omitempty" protobuf:"bytes,3,opt,name=transitionID"` - - // Last time the phase transitioned from another to current phase. - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` - - // Unique, one-word, CamelCase reason for the phase's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` - - // Human-readable message indicating details about last transition. - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` -} - -const ( - // PodFailedReason is probed if pod of PodGroup failed - PodFailedReason string = "PodFailed" - - // PodDeletedReason is probed if pod of PodGroup deleted - PodDeletedReason string = "PodDeleted" - - // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods - NotEnoughResourcesReason string = "NotEnoughResources" - - // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember` - NotEnoughPodsReason string = "NotEnoughTasks" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodGroup is a collection of Pod; used for batch workload. -type PodGroup struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the pod group. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - // +optional - Spec PodGroupSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Status represents the current information about a pod group. - // This data may not be up to date. - // +optional - Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// PodGroupSpec represents the template of a pod group. -type PodGroupSpec struct { - // 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. - MinMember int32 `json:"minMember,omitempty" protobuf:"bytes,1,opt,name=minMember"` - - // Queue defines the queue to allocate resource for PodGroup; if queue does not exist, - // the PodGroup will not be scheduled. Defaults to `default` Queue with the lowest weight. - // +optional - Queue string `json:"queue,omitempty" protobuf:"bytes,2,opt,name=queue"` - - // 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. - // +optional - PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,3,opt,name=priorityClassName"` - - // 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. - MinResources *v1.ResourceList `json:"minResources,omitempty" protobuf:"bytes,4,opt,name=minResources"` -} - -// PodGroupStatus represents the current state of a pod group. -type PodGroupStatus struct { - // Current phase of PodGroup. - Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"` - - // The conditions of PodGroup. - // +optional - Conditions []PodGroupCondition `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` - - // The number of actively running pods. - // +optional - Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` - - // The number of pods which reached phase Succeeded. - // +optional - Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,4,opt,name=succeeded"` - - // The number of pods which reached phase Failed. - // +optional - Failed int32 `json:"failed,omitempty" protobuf:"bytes,5,opt,name=failed"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodGroupList is a collection of pod groups. -type PodGroupList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of PodGroup - Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Queue is a queue of PodGroup. -type Queue struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the queue. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - // +optional - Spec QueueSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // The status of queue. - // +optional - Status QueueStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// QueueStatus represents the status of Queue. -type QueueStatus struct { - // The number of 'Unknown' PodGroup in this queue. - Unknown int32 `json:"unknown,omitempty" protobuf:"bytes,1,opt,name=unknown"` - // The number of 'Pending' PodGroup in this queue. - Pending int32 `json:"pending,omitempty" protobuf:"bytes,2,opt,name=pending"` - // The number of 'Running' PodGroup in this queue. - Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` - // The number of `Inqueue` PodGroup in this queue. - Inqueue int32 `json:"inqueue,omitempty" protobuf:"bytes,4,opt,name=inqueue"` - // State is state of queue - State QueueState `json:"state,omitempty" protobuf:"bytes,5,opt,name=state"` -} - -// QueueSpec represents the template of Queue. -type QueueSpec struct { - Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` - Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` - // State controller the status of queue - State QueueState `json:"state,omitempty" protobuf:"bytes,3,opt,name=state"` - // Reclaimable indicate whether the queue can be reclaimed by other queue - Reclaimable *bool `json:"reclaimable,omitempty" protobuf:"bytes,4,opt,name=reclaimable"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// QueueList is a collection of queues. -type QueueList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of PodGroup - Items []Queue `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go b/pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go deleted file mode 100644 index 52083ac918..0000000000 --- a/pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go +++ /dev/null @@ -1,396 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - unsafe "unsafe" - - v1 "k8s.io/api/core/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - scheduling "volcano.sh/volcano/pkg/apis/scheduling" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*PodGroup)(nil), (*scheduling.PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_PodGroup_To_scheduling_PodGroup(a.(*PodGroup), b.(*scheduling.PodGroup), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroup)(nil), (*PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroup_To_v1alpha2_PodGroup(a.(*scheduling.PodGroup), b.(*PodGroup), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupCondition)(nil), (*scheduling.PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_PodGroupCondition_To_scheduling_PodGroupCondition(a.(*PodGroupCondition), b.(*scheduling.PodGroupCondition), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupCondition)(nil), (*PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupCondition_To_v1alpha2_PodGroupCondition(a.(*scheduling.PodGroupCondition), b.(*PodGroupCondition), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupList)(nil), (*scheduling.PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_PodGroupList_To_scheduling_PodGroupList(a.(*PodGroupList), b.(*scheduling.PodGroupList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupList)(nil), (*PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupList_To_v1alpha2_PodGroupList(a.(*scheduling.PodGroupList), b.(*PodGroupList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupSpec)(nil), (*scheduling.PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec(a.(*PodGroupSpec), b.(*scheduling.PodGroupSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupSpec)(nil), (*PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec(a.(*scheduling.PodGroupSpec), b.(*PodGroupSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PodGroupStatus)(nil), (*scheduling.PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus(a.(*PodGroupStatus), b.(*scheduling.PodGroupStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupStatus)(nil), (*PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus(a.(*scheduling.PodGroupStatus), b.(*PodGroupStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Queue)(nil), (*scheduling.Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_Queue_To_scheduling_Queue(a.(*Queue), b.(*scheduling.Queue), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.Queue)(nil), (*Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_Queue_To_v1alpha2_Queue(a.(*scheduling.Queue), b.(*Queue), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueList)(nil), (*scheduling.QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_QueueList_To_scheduling_QueueList(a.(*QueueList), b.(*scheduling.QueueList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueList)(nil), (*QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueList_To_v1alpha2_QueueList(a.(*scheduling.QueueList), b.(*QueueList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueSpec)(nil), (*scheduling.QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_QueueSpec_To_scheduling_QueueSpec(a.(*QueueSpec), b.(*scheduling.QueueSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueSpec)(nil), (*QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueSpec_To_v1alpha2_QueueSpec(a.(*scheduling.QueueSpec), b.(*QueueSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*QueueStatus)(nil), (*scheduling.QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_QueueStatus_To_scheduling_QueueStatus(a.(*QueueStatus), b.(*scheduling.QueueStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*scheduling.QueueStatus)(nil), (*QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_scheduling_QueueStatus_To_v1alpha2_QueueStatus(a.(*scheduling.QueueStatus), b.(*QueueStatus), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha2_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_PodGroup_To_scheduling_PodGroup is an autogenerated conversion function. -func Convert_v1alpha2_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { - return autoConvert_v1alpha2_PodGroup_To_scheduling_PodGroup(in, out, s) -} - -func autoConvert_scheduling_PodGroup_To_v1alpha2_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_scheduling_PodGroup_To_v1alpha2_PodGroup is an autogenerated conversion function. -func Convert_scheduling_PodGroup_To_v1alpha2_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { - return autoConvert_scheduling_PodGroup_To_v1alpha2_PodGroup(in, out, s) -} - -func autoConvert_v1alpha2_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { - out.Type = scheduling.PodGroupConditionType(in.Type) - out.Status = v1.ConditionStatus(in.Status) - out.TransitionID = in.TransitionID - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_v1alpha2_PodGroupCondition_To_scheduling_PodGroupCondition is an autogenerated conversion function. -func Convert_v1alpha2_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { - return autoConvert_v1alpha2_PodGroupCondition_To_scheduling_PodGroupCondition(in, out, s) -} - -func autoConvert_scheduling_PodGroupCondition_To_v1alpha2_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { - out.Type = PodGroupConditionType(in.Type) - out.Status = v1.ConditionStatus(in.Status) - out.TransitionID = in.TransitionID - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_scheduling_PodGroupCondition_To_v1alpha2_PodGroupCondition is an autogenerated conversion function. -func Convert_scheduling_PodGroupCondition_To_v1alpha2_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupCondition_To_v1alpha2_PodGroupCondition(in, out, s) -} - -func autoConvert_v1alpha2_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]scheduling.PodGroup)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha2_PodGroupList_To_scheduling_PodGroupList is an autogenerated conversion function. -func Convert_v1alpha2_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { - return autoConvert_v1alpha2_PodGroupList_To_scheduling_PodGroupList(in, out, s) -} - -func autoConvert_scheduling_PodGroupList_To_v1alpha2_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]PodGroup)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_scheduling_PodGroupList_To_v1alpha2_PodGroupList is an autogenerated conversion function. -func Convert_scheduling_PodGroupList_To_v1alpha2_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupList_To_v1alpha2_PodGroupList(in, out, s) -} - -func autoConvert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { - out.MinMember = in.MinMember - out.Queue = in.Queue - out.PriorityClassName = in.PriorityClassName - out.MinResources = (*v1.ResourceList)(unsafe.Pointer(in.MinResources)) - return nil -} - -// Convert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec is an autogenerated conversion function. -func Convert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_PodGroupSpec_To_scheduling_PodGroupSpec(in, out, s) -} - -func autoConvert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { - out.MinMember = in.MinMember - out.Queue = in.Queue - out.PriorityClassName = in.PriorityClassName - out.MinResources = (*v1.ResourceList)(unsafe.Pointer(in.MinResources)) - return nil -} - -// Convert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec is an autogenerated conversion function. -func Convert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupSpec_To_v1alpha2_PodGroupSpec(in, out, s) -} - -func autoConvert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { - out.Phase = scheduling.PodGroupPhase(in.Phase) - out.Conditions = *(*[]scheduling.PodGroupCondition)(unsafe.Pointer(&in.Conditions)) - out.Running = in.Running - out.Succeeded = in.Succeeded - out.Failed = in.Failed - return nil -} - -// Convert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus is an autogenerated conversion function. -func Convert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { - return autoConvert_v1alpha2_PodGroupStatus_To_scheduling_PodGroupStatus(in, out, s) -} - -func autoConvert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { - out.Phase = PodGroupPhase(in.Phase) - out.Conditions = *(*[]PodGroupCondition)(unsafe.Pointer(&in.Conditions)) - out.Running = in.Running - out.Succeeded = in.Succeeded - out.Failed = in.Failed - return nil -} - -// Convert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus is an autogenerated conversion function. -func Convert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { - return autoConvert_scheduling_PodGroupStatus_To_v1alpha2_PodGroupStatus(in, out, s) -} - -func autoConvert_v1alpha2_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_QueueSpec_To_scheduling_QueueSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_QueueStatus_To_scheduling_QueueStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_Queue_To_scheduling_Queue is an autogenerated conversion function. -func Convert_v1alpha2_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { - return autoConvert_v1alpha2_Queue_To_scheduling_Queue(in, out, s) -} - -func autoConvert_scheduling_Queue_To_v1alpha2_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_scheduling_QueueSpec_To_v1alpha2_QueueSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_scheduling_QueueStatus_To_v1alpha2_QueueStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_scheduling_Queue_To_v1alpha2_Queue is an autogenerated conversion function. -func Convert_scheduling_Queue_To_v1alpha2_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { - return autoConvert_scheduling_Queue_To_v1alpha2_Queue(in, out, s) -} - -func autoConvert_v1alpha2_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]scheduling.Queue, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_Queue_To_scheduling_Queue(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_QueueList_To_scheduling_QueueList is an autogenerated conversion function. -func Convert_v1alpha2_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { - return autoConvert_v1alpha2_QueueList_To_scheduling_QueueList(in, out, s) -} - -func autoConvert_scheduling_QueueList_To_v1alpha2_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Queue, len(*in)) - for i := range *in { - if err := Convert_scheduling_Queue_To_v1alpha2_Queue(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_scheduling_QueueList_To_v1alpha2_QueueList is an autogenerated conversion function. -func Convert_scheduling_QueueList_To_v1alpha2_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { - return autoConvert_scheduling_QueueList_To_v1alpha2_QueueList(in, out, s) -} - -func autoConvert_v1alpha2_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { - out.Weight = in.Weight - out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - out.State = scheduling.QueueState(in.State) - out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) - return nil -} - -// Convert_v1alpha2_QueueSpec_To_scheduling_QueueSpec is an autogenerated conversion function. -func Convert_v1alpha2_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_QueueSpec_To_scheduling_QueueSpec(in, out, s) -} - -func autoConvert_scheduling_QueueSpec_To_v1alpha2_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { - out.Weight = in.Weight - out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - out.State = QueueState(in.State) - out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) - return nil -} - -// Convert_scheduling_QueueSpec_To_v1alpha2_QueueSpec is an autogenerated conversion function. -func Convert_scheduling_QueueSpec_To_v1alpha2_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { - return autoConvert_scheduling_QueueSpec_To_v1alpha2_QueueSpec(in, out, s) -} - -func autoConvert_v1alpha2_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { - out.Unknown = in.Unknown - out.Pending = in.Pending - out.Running = in.Running - out.Inqueue = in.Inqueue - out.State = scheduling.QueueState(in.State) - return nil -} - -// Convert_v1alpha2_QueueStatus_To_scheduling_QueueStatus is an autogenerated conversion function. -func Convert_v1alpha2_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { - return autoConvert_v1alpha2_QueueStatus_To_scheduling_QueueStatus(in, out, s) -} - -func autoConvert_scheduling_QueueStatus_To_v1alpha2_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { - out.State = QueueState(in.State) - out.Unknown = in.Unknown - out.Pending = in.Pending - out.Running = in.Running - out.Inqueue = in.Inqueue - return nil -} - -// Convert_scheduling_QueueStatus_To_v1alpha2_QueueStatus is an autogenerated conversion function. -func Convert_scheduling_QueueStatus_To_v1alpha2_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { - return autoConvert_scheduling_QueueStatus_To_v1alpha2_QueueStatus(in, out, s) -} diff --git a/pkg/apis/scheduling/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/scheduling/v1alpha2/zz_generated.deepcopy.go deleted file mode 100644 index 4aefca1e06..0000000000 --- a/pkg/apis/scheduling/v1alpha2/zz_generated.deepcopy.go +++ /dev/null @@ -1,260 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroup) DeepCopyInto(out *PodGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. -func (in *PodGroup) DeepCopy() *PodGroup { - if in == nil { - return nil - } - out := new(PodGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroup) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupCondition) DeepCopyInto(out *PodGroupCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupCondition. -func (in *PodGroupCondition) DeepCopy() *PodGroupCondition { - if in == nil { - return nil - } - out := new(PodGroupCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PodGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. -func (in *PodGroupList) DeepCopy() *PodGroupList { - if in == nil { - return nil - } - out := new(PodGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { - *out = *in - if in.MinResources != nil { - in, out := &in.MinResources, &out.MinResources - *out = new(v1.ResourceList) - if **in != nil { - in, out := *in, *out - *out = make(map[v1.ResourceName]resource.Quantity, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. -func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { - if in == nil { - return nil - } - out := new(PodGroupSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]PodGroupCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. -func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { - if in == nil { - return nil - } - out := new(PodGroupStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Queue) DeepCopyInto(out *Queue) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Queue. -func (in *Queue) DeepCopy() *Queue { - if in == nil { - return nil - } - out := new(Queue) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Queue) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueList) DeepCopyInto(out *QueueList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Queue, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueList. -func (in *QueueList) DeepCopy() *QueueList { - if in == nil { - return nil - } - out := new(QueueList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *QueueList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueSpec) DeepCopyInto(out *QueueSpec) { - *out = *in - if in.Capability != nil { - in, out := &in.Capability, &out.Capability - *out = make(v1.ResourceList, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - if in.Reclaimable != nil { - in, out := &in.Reclaimable, &out.Reclaimable - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueSpec. -func (in *QueueSpec) DeepCopy() *QueueSpec { - if in == nil { - return nil - } - out := new(QueueSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueStatus) DeepCopyInto(out *QueueStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueStatus. -func (in *QueueStatus) DeepCopy() *QueueStatus { - if in == nil { - return nil - } - out := new(QueueStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/scheduling/v1beta1/types.go b/pkg/apis/scheduling/v1beta1/types.go index 9cb0def4df..67e12e5a6e 100644 --- a/pkg/apis/scheduling/v1beta1/types.go +++ b/pkg/apis/scheduling/v1beta1/types.go @@ -262,6 +262,9 @@ type QueueSpec struct { Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` + // State controller the status of queue + State QueueState `json:"state,omitempty" protobuf:"bytes,3,opt,name=state"` + // Reclaimable indicate whether the queue can be reclaimed by other queue Reclaimable *bool `json:"reclaimable,omitempty" protobuf:"bytes,3,opt,name=reclaimable"` } diff --git a/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go b/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go index caa68bea17..9f5c29b2fd 100644 --- a/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go +++ b/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go @@ -349,6 +349,7 @@ func Convert_scheduling_QueueList_To_v1beta1_QueueList(in *scheduling.QueueList, func autoConvert_v1beta1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { out.Weight = in.Weight out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) + out.State = scheduling.QueueState(in.State) out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) return nil } @@ -361,7 +362,7 @@ func Convert_v1beta1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *sched func autoConvert_scheduling_QueueSpec_To_v1beta1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { out.Weight = in.Weight out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) - // WARNING: in.State requires manual conversion: does not exist in peer-type + out.State = QueueState(in.State) out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) return nil } diff --git a/pkg/cli/queue/create.go b/pkg/cli/queue/create.go index 68bac301d9..cea436fd1b 100644 --- a/pkg/cli/queue/create.go +++ b/pkg/cli/queue/create.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - schedulingV1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/client/clientset/versioned" ) @@ -53,18 +53,18 @@ func CreateQueue() error { return err } - queue := &schedulingV1alpha2.Queue{ + queue := &schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: createQueueFlags.Name, }, - Spec: schedulingV1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: int32(createQueueFlags.Weight), - State: schedulingV1alpha2.QueueState(createQueueFlags.State), + State: schedulingv1beta1.QueueState(createQueueFlags.State), }, } queueClient := versioned.NewForConfigOrDie(config) - if _, err := queueClient.SchedulingV1alpha2().Queues().Create(queue); err != nil { + if _, err := queueClient.SchedulingV1beta1().Queues().Create(queue); err != nil { return err } diff --git a/pkg/cli/queue/delete.go b/pkg/cli/queue/delete.go index 1ec9366325..7c7a52cb19 100644 --- a/pkg/cli/queue/delete.go +++ b/pkg/cli/queue/delete.go @@ -54,5 +54,5 @@ func DeleteQueue() error { } queueClient := versioned.NewForConfigOrDie(config) - return queueClient.SchedulingV1alpha2().Queues().Delete(deleteQueueFlags.Name, &metav1.DeleteOptions{}) + return queueClient.SchedulingV1beta1().Queues().Delete(deleteQueueFlags.Name, &metav1.DeleteOptions{}) } diff --git a/pkg/cli/queue/delete_test.go b/pkg/cli/queue/delete_test.go index 5a37394310..411dd0fdd1 100644 --- a/pkg/cli/queue/delete_test.go +++ b/pkg/cli/queue/delete_test.go @@ -24,7 +24,7 @@ import ( "reflect" "testing" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "github.com/spf13/cobra" @@ -32,7 +32,7 @@ import ( ) func TestDeleteQueue(t *testing.T) { - response := v1alpha2.Queue{ + response := v1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "test-queue", }, diff --git a/pkg/cli/queue/get.go b/pkg/cli/queue/get.go index da46d1909d..011b3df04f 100644 --- a/pkg/cli/queue/get.go +++ b/pkg/cli/queue/get.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/client/clientset/versioned" ) @@ -58,7 +58,7 @@ func GetQueue() error { } queueClient := versioned.NewForConfigOrDie(config) - queue, err := queueClient.SchedulingV1alpha2().Queues().Get(getQueueFlags.Name, metav1.GetOptions{}) + queue, err := queueClient.SchedulingV1beta1().Queues().Get(getQueueFlags.Name, metav1.GetOptions{}) if err != nil { return err } @@ -69,7 +69,7 @@ func GetQueue() error { } // PrintQueue prints queue information -func PrintQueue(queue *v1alpha2.Queue, writer io.Writer) { +func PrintQueue(queue *v1beta1.Queue, writer io.Writer) { _, err := fmt.Fprintf(writer, "%-25s%-8s%-8s%-8s%-8s%-8s%-8s\n", Name, Weight, State, Inqueue, Pending, Running, Unknown) if err != nil { diff --git a/pkg/cli/queue/list.go b/pkg/cli/queue/list.go index b961320d2b..8807cad00a 100644 --- a/pkg/cli/queue/list.go +++ b/pkg/cli/queue/list.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/client/clientset/versioned" ) @@ -71,7 +71,7 @@ func ListQueue() error { } jobClient := versioned.NewForConfigOrDie(config) - queues, err := jobClient.SchedulingV1alpha2().Queues().List(metav1.ListOptions{}) + queues, err := jobClient.SchedulingV1beta1().Queues().List(metav1.ListOptions{}) if err != nil { return err } @@ -86,7 +86,7 @@ func ListQueue() error { } // PrintQueues prints queue information -func PrintQueues(queues *v1alpha2.QueueList, writer io.Writer) { +func PrintQueues(queues *v1beta1.QueueList, writer io.Writer) { _, err := fmt.Fprintf(writer, "%-25s%-8s%-8s%-8s%-8s%-8s%-8s\n", Name, Weight, State, Inqueue, Pending, Running, Unknown) if err != nil { diff --git a/pkg/cli/queue/operate.go b/pkg/cli/queue/operate.go index a079e301fb..27c8f7bc02 100644 --- a/pkg/cli/queue/operate.go +++ b/pkg/cli/queue/operate.go @@ -85,7 +85,7 @@ func OperateQueue() error { queueClient := versioned.NewForConfigOrDie(config) patchBytes := []byte(fmt.Sprintf(`{"spec":{"weight":%d}}`, operateQueueFlags.Weight)) - _, err := queueClient.SchedulingV1alpha2().Queues().Patch(operateQueueFlags.Name, types.MergePatchType, patchBytes) + _, err := queueClient.SchedulingV1beta1().Queues().Patch(operateQueueFlags.Name, types.MergePatchType, patchBytes) return err case "": diff --git a/pkg/cli/queue/operate_test.go b/pkg/cli/queue/operate_test.go index a3265ce7be..4f31c8fd64 100644 --- a/pkg/cli/queue/operate_test.go +++ b/pkg/cli/queue/operate_test.go @@ -24,7 +24,7 @@ import ( "reflect" "testing" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "github.com/spf13/cobra" @@ -32,7 +32,7 @@ import ( ) func TestOperateQueue(t *testing.T) { - response := v1alpha2.Queue{ + response := v1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "test-queue", }, diff --git a/pkg/cli/queue/queue_test.go b/pkg/cli/queue/queue_test.go index c49e3ad48d..bdf7302ca3 100644 --- a/pkg/cli/queue/queue_test.go +++ b/pkg/cli/queue/queue_test.go @@ -27,13 +27,12 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) func getTestQueueHTTPServer(t *testing.T) *httptest.Server { - response := v1alpha2.Queue{} + response := v1beta1.Queue{} response.Name = "testQueue" response.Spec.Weight = int32(2) @@ -50,14 +49,14 @@ func getTestQueueHTTPServer(t *testing.T) *httptest.Server { func getTestQueueListHTTPServer(t *testing.T) *httptest.Server { - response := v1alpha1.QueueList{} + response := v1beta1.QueueList{} - response.Items = []v1alpha1.Queue{ + response.Items = []v1beta1.Queue{ { ObjectMeta: v1.ObjectMeta{ Name: "testQueue", }, - Spec: v1alpha1.QueueSpec{ + Spec: v1beta1.QueueSpec{ Weight: int32(2), }, }, diff --git a/pkg/cli/queue/util.go b/pkg/cli/queue/util.go index 1d007f9d35..719c328f5e 100644 --- a/pkg/cli/queue/util.go +++ b/pkg/cli/queue/util.go @@ -45,12 +45,12 @@ func buildConfig(master, kubeconfig string) (*rest.Config, error) { func createQueueCommand(config *rest.Config, action busv1alpha1.Action) error { queueClient := versioned.NewForConfigOrDie(config) - queue, err := queueClient.SchedulingV1alpha2().Queues().Get(operateQueueFlags.Name, metav1.GetOptions{}) + queue, err := queueClient.SchedulingV1beta1().Queues().Get(operateQueueFlags.Name, metav1.GetOptions{}) if err != nil { return err } - ctrlRef := metav1.NewControllerRef(queue, helpers.V1alpha2QueueKind) + ctrlRef := metav1.NewControllerRef(queue, helpers.V1beta1QueueKind) cmd := &busv1alpha1.Command{ ObjectMeta: metav1.ObjectMeta{ GenerateName: fmt.Sprintf("%s-%s-", diff --git a/pkg/cli/vqueues/get.go b/pkg/cli/vqueues/get.go index 6262de965a..2f9cc0b12e 100644 --- a/pkg/cli/vqueues/get.go +++ b/pkg/cli/vqueues/get.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/cli/util" "volcano.sh/volcano/pkg/client/clientset/versioned" ) @@ -77,7 +77,7 @@ func ListQueue() error { } jobClient := versioned.NewForConfigOrDie(config) - queues, err := jobClient.SchedulingV1alpha2().Queues().List(metav1.ListOptions{}) + queues, err := jobClient.SchedulingV1beta1().Queues().List(metav1.ListOptions{}) if err != nil { return err } @@ -92,7 +92,7 @@ func ListQueue() error { } // PrintQueues prints queue information -func PrintQueues(queues *v1alpha2.QueueList, writer io.Writer) { +func PrintQueues(queues *v1beta1.QueueList, writer io.Writer) { _, err := fmt.Fprintf(writer, "%-25s%-8s%-8s%-8s%-8s%-8s%-8s\n", Name, Weight, State, Inqueue, Pending, Running, Unknown) if err != nil { @@ -122,7 +122,7 @@ func GetQueue() error { } queueClient := versioned.NewForConfigOrDie(config) - queue, err := queueClient.SchedulingV1alpha2().Queues().Get(getQueueFlags.Name, metav1.GetOptions{}) + queue, err := queueClient.SchedulingV1beta1().Queues().Get(getQueueFlags.Name, metav1.GetOptions{}) if err != nil { return err } @@ -133,7 +133,7 @@ func GetQueue() error { } // PrintQueue prints queue information -func PrintQueue(queue *v1alpha2.Queue, writer io.Writer) { +func PrintQueue(queue *v1beta1.Queue, writer io.Writer) { _, err := fmt.Fprintf(writer, "%-25s%-8s%-8s%-8s%-8s%-8s%-8s\n", Name, Weight, State, Inqueue, Pending, Running, Unknown) if err != nil { diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index b2cd24d01c..fb0969b770 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -26,8 +26,6 @@ import ( flowcontrol "k8s.io/client-go/util/flowcontrol" batchv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/batch/v1alpha1" busv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/bus/v1alpha1" - schedulingv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha2" schedulingv1beta1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1beta1" ) @@ -35,8 +33,6 @@ type Interface interface { Discovery() discovery.DiscoveryInterface BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface BusV1alpha1() busv1alpha1.BusV1alpha1Interface - SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface - SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface } @@ -44,11 +40,9 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - batchV1alpha1 *batchv1alpha1.BatchV1alpha1Client - busV1alpha1 *busv1alpha1.BusV1alpha1Client - schedulingV1alpha1 *schedulingv1alpha1.SchedulingV1alpha1Client - schedulingV1alpha2 *schedulingv1alpha2.SchedulingV1alpha2Client - schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client + batchV1alpha1 *batchv1alpha1.BatchV1alpha1Client + busV1alpha1 *busv1alpha1.BusV1alpha1Client + schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client } // BatchV1alpha1 retrieves the BatchV1alpha1Client @@ -61,16 +55,6 @@ func (c *Clientset) BusV1alpha1() busv1alpha1.BusV1alpha1Interface { return c.busV1alpha1 } -// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client -func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { - return c.schedulingV1alpha1 -} - -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client -func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { - return c.schedulingV1alpha2 -} - // SchedulingV1beta1 retrieves the SchedulingV1beta1Client func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { return c.schedulingV1beta1 @@ -105,14 +89,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.schedulingV1alpha1, err = schedulingv1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - cs.schedulingV1alpha2, err = schedulingv1alpha2.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.schedulingV1beta1, err = schedulingv1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -131,8 +107,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.batchV1alpha1 = batchv1alpha1.NewForConfigOrDie(c) cs.busV1alpha1 = busv1alpha1.NewForConfigOrDie(c) - cs.schedulingV1alpha1 = schedulingv1alpha1.NewForConfigOrDie(c) - cs.schedulingV1alpha2 = schedulingv1alpha2.NewForConfigOrDie(c) cs.schedulingV1beta1 = schedulingv1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) @@ -144,8 +118,6 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.batchV1alpha1 = batchv1alpha1.New(c) cs.busV1alpha1 = busv1alpha1.New(c) - cs.schedulingV1alpha1 = schedulingv1alpha1.New(c) - cs.schedulingV1alpha2 = schedulingv1alpha2.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index a93dafc20d..04714503d5 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -29,10 +29,6 @@ import ( fakebatchv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake" busv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/bus/v1alpha1" fakebusv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake" - schedulingv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha1" - fakeschedulingv1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake" - schedulingv1alpha2 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha2" - fakeschedulingv1alpha2 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake" schedulingv1beta1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1beta1" fakeschedulingv1beta1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake" ) @@ -94,16 +90,6 @@ func (c *Clientset) BusV1alpha1() busv1alpha1.BusV1alpha1Interface { return &fakebusv1alpha1.FakeBusV1alpha1{Fake: &c.Fake} } -// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client -func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { - return &fakeschedulingv1alpha1.FakeSchedulingV1alpha1{Fake: &c.Fake} -} - -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client -func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { - return &fakeschedulingv1alpha2.FakeSchedulingV1alpha2{Fake: &c.Fake} -} - // SchedulingV1beta1 retrieves the SchedulingV1beta1Client func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { return &fakeschedulingv1beta1.FakeSchedulingV1beta1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 782a310420..07c3ad0a17 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -26,8 +26,6 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" batchv1alpha1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) @@ -37,8 +35,6 @@ var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ batchv1alpha1.AddToScheme, busv1alpha1.AddToScheme, - schedulingv1alpha1.AddToScheme, - schedulingv1alpha2.AddToScheme, schedulingv1beta1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index d7e2b92e8b..c326c6a044 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -26,8 +26,6 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" batchv1alpha1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) @@ -37,8 +35,6 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ batchv1alpha1.AddToScheme, busv1alpha1.AddToScheme, - schedulingv1alpha1.AddToScheme, - schedulingv1alpha2.AddToScheme, schedulingv1beta1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/doc.go deleted file mode 100644 index ca5a428be8..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/doc.go deleted file mode 100644 index 19a8e6cea3..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_podgroup.go deleted file mode 100644 index 8c2cb885c4..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_podgroup.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" -) - -// FakePodGroups implements PodGroupInterface -type FakePodGroups struct { - Fake *FakeSchedulingV1alpha1 - ns string -} - -var podgroupsResource = schema.GroupVersionResource{Group: "scheduling", Version: "v1alpha1", Resource: "podgroups"} - -var podgroupsKind = schema.GroupVersionKind{Group: "scheduling", Version: "v1alpha1", Kind: "PodGroup"} - -// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. -func (c *FakePodGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podgroupsResource, c.ns, name), &v1alpha1.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodGroup), err -} - -// List takes label and field selectors, and returns the list of PodGroups that match those selectors. -func (c *FakePodGroups) List(opts v1.ListOptions) (result *v1alpha1.PodGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podgroupsResource, podgroupsKind, c.ns, opts), &v1alpha1.PodGroupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.PodGroupList{ListMeta: obj.(*v1alpha1.PodGroupList).ListMeta} - for _, item := range obj.(*v1alpha1.PodGroupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested podGroups. -func (c *FakePodGroups) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podgroupsResource, c.ns, opts)) - -} - -// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *FakePodGroups) Create(podGroup *v1alpha1.PodGroup) (result *v1alpha1.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podgroupsResource, c.ns, podGroup), &v1alpha1.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodGroup), err -} - -// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *FakePodGroups) Update(podGroup *v1alpha1.PodGroup) (result *v1alpha1.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podgroupsResource, c.ns, podGroup), &v1alpha1.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodGroup), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePodGroups) UpdateStatus(podGroup *v1alpha1.PodGroup) (*v1alpha1.PodGroup, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podgroupsResource, "status", c.ns, podGroup), &v1alpha1.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodGroup), err -} - -// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. -func (c *FakePodGroups) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(podgroupsResource, c.ns, name), &v1alpha1.PodGroup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePodGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podgroupsResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.PodGroupList{}) - return err -} - -// Patch applies the patch and returns the patched podGroup. -func (c *FakePodGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podgroupsResource, c.ns, name, pt, data, subresources...), &v1alpha1.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodGroup), err -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_queue.go deleted file mode 100644 index 30c4c694a6..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_queue.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" -) - -// FakeQueues implements QueueInterface -type FakeQueues struct { - Fake *FakeSchedulingV1alpha1 -} - -var queuesResource = schema.GroupVersionResource{Group: "scheduling", Version: "v1alpha1", Resource: "queues"} - -var queuesKind = schema.GroupVersionKind{Group: "scheduling", Version: "v1alpha1", Kind: "Queue"} - -// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. -func (c *FakeQueues) Get(name string, options v1.GetOptions) (result *v1alpha1.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(queuesResource, name), &v1alpha1.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Queue), err -} - -// List takes label and field selectors, and returns the list of Queues that match those selectors. -func (c *FakeQueues) List(opts v1.ListOptions) (result *v1alpha1.QueueList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(queuesResource, queuesKind, opts), &v1alpha1.QueueList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.QueueList{ListMeta: obj.(*v1alpha1.QueueList).ListMeta} - for _, item := range obj.(*v1alpha1.QueueList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested queues. -func (c *FakeQueues) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(queuesResource, opts)) -} - -// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *FakeQueues) Create(queue *v1alpha1.Queue) (result *v1alpha1.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(queuesResource, queue), &v1alpha1.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Queue), err -} - -// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *FakeQueues) Update(queue *v1alpha1.Queue) (result *v1alpha1.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(queuesResource, queue), &v1alpha1.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Queue), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeQueues) UpdateStatus(queue *v1alpha1.Queue) (*v1alpha1.Queue, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(queuesResource, "status", queue), &v1alpha1.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Queue), err -} - -// Delete takes name of the queue and deletes it. Returns an error if one occurs. -func (c *FakeQueues) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(queuesResource, name), &v1alpha1.Queue{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeQueues) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(queuesResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.QueueList{}) - return err -} - -// Patch applies the patch and returns the patched queue. -func (c *FakeQueues) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(queuesResource, name, pt, data, subresources...), &v1alpha1.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Queue), err -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go deleted file mode 100644 index 42e7650d2e..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" - v1alpha1 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha1" -) - -type FakeSchedulingV1alpha1 struct { - *testing.Fake -} - -func (c *FakeSchedulingV1alpha1) PodGroups(namespace string) v1alpha1.PodGroupInterface { - return &FakePodGroups{c, namespace} -} - -func (c *FakeSchedulingV1alpha1) Queues() v1alpha1.QueueInterface { - return &FakeQueues{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeSchedulingV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/generated_expansion.go deleted file mode 100644 index 87649411cb..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -type PodGroupExpansion interface{} - -type QueueExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/podgroup.go deleted file mode 100644 index 835887e7ee..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/podgroup.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - scheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -// PodGroupsGetter has a method to return a PodGroupInterface. -// A group's client should implement this interface. -type PodGroupsGetter interface { - PodGroups(namespace string) PodGroupInterface -} - -// PodGroupInterface has methods to work with PodGroup resources. -type PodGroupInterface interface { - Create(*v1alpha1.PodGroup) (*v1alpha1.PodGroup, error) - Update(*v1alpha1.PodGroup) (*v1alpha1.PodGroup, error) - UpdateStatus(*v1alpha1.PodGroup) (*v1alpha1.PodGroup, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.PodGroup, error) - List(opts v1.ListOptions) (*v1alpha1.PodGroupList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodGroup, err error) - PodGroupExpansion -} - -// podGroups implements PodGroupInterface -type podGroups struct { - client rest.Interface - ns string -} - -// newPodGroups returns a PodGroups -func newPodGroups(c *SchedulingV1alpha1Client, namespace string) *podGroups { - return &podGroups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. -func (c *podGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.PodGroup, err error) { - result = &v1alpha1.PodGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PodGroups that match those selectors. -func (c *podGroups) List(opts v1.ListOptions) (result *v1alpha1.PodGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.PodGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested podGroups. -func (c *podGroups) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *podGroups) Create(podGroup *v1alpha1.PodGroup) (result *v1alpha1.PodGroup, err error) { - result = &v1alpha1.PodGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("podgroups"). - Body(podGroup). - Do(). - Into(result) - return -} - -// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *podGroups) Update(podGroup *v1alpha1.PodGroup) (result *v1alpha1.PodGroup, err error) { - result = &v1alpha1.PodGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podgroups"). - Name(podGroup.Name). - Body(podGroup). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *podGroups) UpdateStatus(podGroup *v1alpha1.PodGroup) (result *v1alpha1.PodGroup, err error) { - result = &v1alpha1.PodGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podgroups"). - Name(podGroup.Name). - SubResource("status"). - Body(podGroup). - Do(). - Into(result) - return -} - -// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. -func (c *podGroups) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("podgroups"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *podGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched podGroup. -func (c *podGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodGroup, err error) { - result = &v1alpha1.PodGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("podgroups"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/queue.go deleted file mode 100644 index de4e063b2c..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/queue.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - scheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -// QueuesGetter has a method to return a QueueInterface. -// A group's client should implement this interface. -type QueuesGetter interface { - Queues() QueueInterface -} - -// QueueInterface has methods to work with Queue resources. -type QueueInterface interface { - Create(*v1alpha1.Queue) (*v1alpha1.Queue, error) - Update(*v1alpha1.Queue) (*v1alpha1.Queue, error) - UpdateStatus(*v1alpha1.Queue) (*v1alpha1.Queue, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.Queue, error) - List(opts v1.ListOptions) (*v1alpha1.QueueList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Queue, err error) - QueueExpansion -} - -// queues implements QueueInterface -type queues struct { - client rest.Interface -} - -// newQueues returns a Queues -func newQueues(c *SchedulingV1alpha1Client) *queues { - return &queues{ - client: c.RESTClient(), - } -} - -// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. -func (c *queues) Get(name string, options v1.GetOptions) (result *v1alpha1.Queue, err error) { - result = &v1alpha1.Queue{} - err = c.client.Get(). - Resource("queues"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Queues that match those selectors. -func (c *queues) List(opts v1.ListOptions) (result *v1alpha1.QueueList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.QueueList{} - err = c.client.Get(). - Resource("queues"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested queues. -func (c *queues) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("queues"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *queues) Create(queue *v1alpha1.Queue) (result *v1alpha1.Queue, err error) { - result = &v1alpha1.Queue{} - err = c.client.Post(). - Resource("queues"). - Body(queue). - Do(). - Into(result) - return -} - -// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *queues) Update(queue *v1alpha1.Queue) (result *v1alpha1.Queue, err error) { - result = &v1alpha1.Queue{} - err = c.client.Put(). - Resource("queues"). - Name(queue.Name). - Body(queue). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *queues) UpdateStatus(queue *v1alpha1.Queue) (result *v1alpha1.Queue, err error) { - result = &v1alpha1.Queue{} - err = c.client.Put(). - Resource("queues"). - Name(queue.Name). - SubResource("status"). - Body(queue). - Do(). - Into(result) - return -} - -// Delete takes name of the queue and deletes it. Returns an error if one occurs. -func (c *queues) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("queues"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *queues) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("queues"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched queue. -func (c *queues) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Queue, err error) { - result = &v1alpha1.Queue{} - err = c.client.Patch(pt). - Resource("queues"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/scheduling_client.go deleted file mode 100644 index 51c3095181..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/scheduling_client.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - rest "k8s.io/client-go/rest" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -type SchedulingV1alpha1Interface interface { - RESTClient() rest.Interface - PodGroupsGetter - QueuesGetter -} - -// SchedulingV1alpha1Client is used to interact with features provided by the scheduling group. -type SchedulingV1alpha1Client struct { - restClient rest.Interface -} - -func (c *SchedulingV1alpha1Client) PodGroups(namespace string) PodGroupInterface { - return newPodGroups(c, namespace) -} - -func (c *SchedulingV1alpha1Client) Queues() QueueInterface { - return newQueues(c) -} - -// NewForConfig creates a new SchedulingV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*SchedulingV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &SchedulingV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new SchedulingV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new SchedulingV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *SchedulingV1alpha1Client { - return &SchedulingV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SchedulingV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/doc.go deleted file mode 100644 index 77b4534eb1..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1alpha2 diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/doc.go deleted file mode 100644 index 19a8e6cea3..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_podgroup.go deleted file mode 100644 index 885e251039..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_podgroup.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" -) - -// FakePodGroups implements PodGroupInterface -type FakePodGroups struct { - Fake *FakeSchedulingV1alpha2 - ns string -} - -var podgroupsResource = schema.GroupVersionResource{Group: "scheduling", Version: "v1alpha2", Resource: "podgroups"} - -var podgroupsKind = schema.GroupVersionKind{Group: "scheduling", Version: "v1alpha2", Kind: "PodGroup"} - -// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. -func (c *FakePodGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podgroupsResource, c.ns, name), &v1alpha2.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.PodGroup), err -} - -// List takes label and field selectors, and returns the list of PodGroups that match those selectors. -func (c *FakePodGroups) List(opts v1.ListOptions) (result *v1alpha2.PodGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podgroupsResource, podgroupsKind, c.ns, opts), &v1alpha2.PodGroupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.PodGroupList{ListMeta: obj.(*v1alpha2.PodGroupList).ListMeta} - for _, item := range obj.(*v1alpha2.PodGroupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested podGroups. -func (c *FakePodGroups) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podgroupsResource, c.ns, opts)) - -} - -// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *FakePodGroups) Create(podGroup *v1alpha2.PodGroup) (result *v1alpha2.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podgroupsResource, c.ns, podGroup), &v1alpha2.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.PodGroup), err -} - -// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *FakePodGroups) Update(podGroup *v1alpha2.PodGroup) (result *v1alpha2.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podgroupsResource, c.ns, podGroup), &v1alpha2.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.PodGroup), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePodGroups) UpdateStatus(podGroup *v1alpha2.PodGroup) (*v1alpha2.PodGroup, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podgroupsResource, "status", c.ns, podGroup), &v1alpha2.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.PodGroup), err -} - -// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. -func (c *FakePodGroups) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(podgroupsResource, c.ns, name), &v1alpha2.PodGroup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePodGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podgroupsResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha2.PodGroupList{}) - return err -} - -// Patch applies the patch and returns the patched podGroup. -func (c *FakePodGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PodGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podgroupsResource, c.ns, name, pt, data, subresources...), &v1alpha2.PodGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.PodGroup), err -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_queue.go deleted file mode 100644 index 833ec3c28a..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_queue.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" -) - -// FakeQueues implements QueueInterface -type FakeQueues struct { - Fake *FakeSchedulingV1alpha2 -} - -var queuesResource = schema.GroupVersionResource{Group: "scheduling", Version: "v1alpha2", Resource: "queues"} - -var queuesKind = schema.GroupVersionKind{Group: "scheduling", Version: "v1alpha2", Kind: "Queue"} - -// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. -func (c *FakeQueues) Get(name string, options v1.GetOptions) (result *v1alpha2.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(queuesResource, name), &v1alpha2.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Queue), err -} - -// List takes label and field selectors, and returns the list of Queues that match those selectors. -func (c *FakeQueues) List(opts v1.ListOptions) (result *v1alpha2.QueueList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(queuesResource, queuesKind, opts), &v1alpha2.QueueList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.QueueList{ListMeta: obj.(*v1alpha2.QueueList).ListMeta} - for _, item := range obj.(*v1alpha2.QueueList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested queues. -func (c *FakeQueues) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(queuesResource, opts)) -} - -// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *FakeQueues) Create(queue *v1alpha2.Queue) (result *v1alpha2.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(queuesResource, queue), &v1alpha2.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Queue), err -} - -// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *FakeQueues) Update(queue *v1alpha2.Queue) (result *v1alpha2.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(queuesResource, queue), &v1alpha2.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Queue), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeQueues) UpdateStatus(queue *v1alpha2.Queue) (*v1alpha2.Queue, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(queuesResource, "status", queue), &v1alpha2.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Queue), err -} - -// Delete takes name of the queue and deletes it. Returns an error if one occurs. -func (c *FakeQueues) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(queuesResource, name), &v1alpha2.Queue{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeQueues) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(queuesResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha2.QueueList{}) - return err -} - -// Patch applies the patch and returns the patched queue. -func (c *FakeQueues) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Queue, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(queuesResource, name, pt, data, subresources...), &v1alpha2.Queue{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Queue), err -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go deleted file mode 100644 index a1be21a205..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" - v1alpha2 "volcano.sh/volcano/pkg/client/clientset/versioned/typed/scheduling/v1alpha2" -) - -type FakeSchedulingV1alpha2 struct { - *testing.Fake -} - -func (c *FakeSchedulingV1alpha2) PodGroups(namespace string) v1alpha2.PodGroupInterface { - return &FakePodGroups{c, namespace} -} - -func (c *FakeSchedulingV1alpha2) Queues() v1alpha2.QueueInterface { - return &FakeQueues{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeSchedulingV1alpha2) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/generated_expansion.go deleted file mode 100644 index 20c983c7ba..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -type PodGroupExpansion interface{} - -type QueueExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/podgroup.go deleted file mode 100644 index bb8e5693e8..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/podgroup.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - scheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -// PodGroupsGetter has a method to return a PodGroupInterface. -// A group's client should implement this interface. -type PodGroupsGetter interface { - PodGroups(namespace string) PodGroupInterface -} - -// PodGroupInterface has methods to work with PodGroup resources. -type PodGroupInterface interface { - Create(*v1alpha2.PodGroup) (*v1alpha2.PodGroup, error) - Update(*v1alpha2.PodGroup) (*v1alpha2.PodGroup, error) - UpdateStatus(*v1alpha2.PodGroup) (*v1alpha2.PodGroup, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.PodGroup, error) - List(opts v1.ListOptions) (*v1alpha2.PodGroupList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PodGroup, err error) - PodGroupExpansion -} - -// podGroups implements PodGroupInterface -type podGroups struct { - client rest.Interface - ns string -} - -// newPodGroups returns a PodGroups -func newPodGroups(c *SchedulingV1alpha2Client, namespace string) *podGroups { - return &podGroups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. -func (c *podGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.PodGroup, err error) { - result = &v1alpha2.PodGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PodGroups that match those selectors. -func (c *podGroups) List(opts v1.ListOptions) (result *v1alpha2.PodGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.PodGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested podGroups. -func (c *podGroups) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *podGroups) Create(podGroup *v1alpha2.PodGroup) (result *v1alpha2.PodGroup, err error) { - result = &v1alpha2.PodGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("podgroups"). - Body(podGroup). - Do(). - Into(result) - return -} - -// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. -func (c *podGroups) Update(podGroup *v1alpha2.PodGroup) (result *v1alpha2.PodGroup, err error) { - result = &v1alpha2.PodGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podgroups"). - Name(podGroup.Name). - Body(podGroup). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *podGroups) UpdateStatus(podGroup *v1alpha2.PodGroup) (result *v1alpha2.PodGroup, err error) { - result = &v1alpha2.PodGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podgroups"). - Name(podGroup.Name). - SubResource("status"). - Body(podGroup). - Do(). - Into(result) - return -} - -// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. -func (c *podGroups) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("podgroups"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *podGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("podgroups"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched podGroup. -func (c *podGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PodGroup, err error) { - result = &v1alpha2.PodGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("podgroups"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/queue.go deleted file mode 100644 index dab33e5252..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/queue.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - scheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -// QueuesGetter has a method to return a QueueInterface. -// A group's client should implement this interface. -type QueuesGetter interface { - Queues() QueueInterface -} - -// QueueInterface has methods to work with Queue resources. -type QueueInterface interface { - Create(*v1alpha2.Queue) (*v1alpha2.Queue, error) - Update(*v1alpha2.Queue) (*v1alpha2.Queue, error) - UpdateStatus(*v1alpha2.Queue) (*v1alpha2.Queue, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.Queue, error) - List(opts v1.ListOptions) (*v1alpha2.QueueList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Queue, err error) - QueueExpansion -} - -// queues implements QueueInterface -type queues struct { - client rest.Interface -} - -// newQueues returns a Queues -func newQueues(c *SchedulingV1alpha2Client) *queues { - return &queues{ - client: c.RESTClient(), - } -} - -// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. -func (c *queues) Get(name string, options v1.GetOptions) (result *v1alpha2.Queue, err error) { - result = &v1alpha2.Queue{} - err = c.client.Get(). - Resource("queues"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Queues that match those selectors. -func (c *queues) List(opts v1.ListOptions) (result *v1alpha2.QueueList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.QueueList{} - err = c.client.Get(). - Resource("queues"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested queues. -func (c *queues) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("queues"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *queues) Create(queue *v1alpha2.Queue) (result *v1alpha2.Queue, err error) { - result = &v1alpha2.Queue{} - err = c.client.Post(). - Resource("queues"). - Body(queue). - Do(). - Into(result) - return -} - -// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. -func (c *queues) Update(queue *v1alpha2.Queue) (result *v1alpha2.Queue, err error) { - result = &v1alpha2.Queue{} - err = c.client.Put(). - Resource("queues"). - Name(queue.Name). - Body(queue). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *queues) UpdateStatus(queue *v1alpha2.Queue) (result *v1alpha2.Queue, err error) { - result = &v1alpha2.Queue{} - err = c.client.Put(). - Resource("queues"). - Name(queue.Name). - SubResource("status"). - Body(queue). - Do(). - Into(result) - return -} - -// Delete takes name of the queue and deletes it. Returns an error if one occurs. -func (c *queues) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("queues"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *queues) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("queues"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched queue. -func (c *queues) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Queue, err error) { - result = &v1alpha2.Queue{} - err = c.client.Patch(pt). - Resource("queues"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/scheduling_client.go deleted file mode 100644 index ef5a898057..0000000000 --- a/pkg/client/clientset/versioned/typed/scheduling/v1alpha2/scheduling_client.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - rest "k8s.io/client-go/rest" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" -) - -type SchedulingV1alpha2Interface interface { - RESTClient() rest.Interface - PodGroupsGetter - QueuesGetter -} - -// SchedulingV1alpha2Client is used to interact with features provided by the scheduling group. -type SchedulingV1alpha2Client struct { - restClient rest.Interface -} - -func (c *SchedulingV1alpha2Client) PodGroups(namespace string) PodGroupInterface { - return newPodGroups(c, namespace) -} - -func (c *SchedulingV1alpha2Client) Queues() QueueInterface { - return newQueues(c) -} - -// NewForConfig creates a new SchedulingV1alpha2Client for the given config. -func NewForConfig(c *rest.Config) (*SchedulingV1alpha2Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &SchedulingV1alpha2Client{client}, nil -} - -// NewForConfigOrDie creates a new SchedulingV1alpha2Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new SchedulingV1alpha2Client for the given RESTClient. -func New(c rest.Interface) *SchedulingV1alpha2Client { - return &SchedulingV1alpha2Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha2.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SchedulingV1alpha2Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index c0d6aabcd7..a2ee6f6d82 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -25,8 +25,6 @@ import ( cache "k8s.io/client-go/tools/cache" v1alpha1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" v1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) @@ -64,18 +62,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case busv1alpha1.SchemeGroupVersion.WithResource("commands"): return &genericInformer{resource: resource.GroupResource(), informer: f.Bus().V1alpha1().Commands().Informer()}, nil - // Group=scheduling, Version=v1alpha1 - case schedulingv1alpha1.SchemeGroupVersion.WithResource("podgroups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PodGroups().Informer()}, nil - case schedulingv1alpha1.SchemeGroupVersion.WithResource("queues"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().Queues().Informer()}, nil - - // Group=scheduling, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("podgroups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().PodGroups().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("queues"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().Queues().Informer()}, nil - // Group=scheduling, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("podgroups"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PodGroups().Informer()}, nil diff --git a/pkg/client/informers/externalversions/scheduling/interface.go b/pkg/client/informers/externalversions/scheduling/interface.go index 4461fd51de..787a5cb31d 100644 --- a/pkg/client/informers/externalversions/scheduling/interface.go +++ b/pkg/client/informers/externalversions/scheduling/interface.go @@ -20,17 +20,11 @@ package scheduling import ( internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha1" - v1alpha2 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha2" v1beta1 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() v1alpha2.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -46,16 +40,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1alpha2 returns a new v1alpha2.Interface. -func (g *group) V1alpha2() v1alpha2.Interface { - return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha1/interface.go b/pkg/client/informers/externalversions/scheduling/v1alpha1/interface.go deleted file mode 100644 index 98204e576c..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha1/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // PodGroups returns a PodGroupInformer. - PodGroups() PodGroupInformer - // Queues returns a QueueInformer. - Queues() QueueInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// PodGroups returns a PodGroupInformer. -func (v *version) PodGroups() PodGroupInformer { - return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Queues returns a QueueInformer. -func (v *version) Queues() QueueInformer { - return &queueInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha1/podgroup.go b/pkg/client/informers/externalversions/scheduling/v1alpha1/podgroup.go deleted file mode 100644 index 8263e1c2e1..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha1/podgroup.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - schedulingv1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - versioned "volcano.sh/volcano/pkg/client/clientset/versioned" - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha1" -) - -// PodGroupInformer provides access to a shared informer and lister for -// PodGroups. -type PodGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.PodGroupLister -} - -type podGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodGroupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PodGroups(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PodGroups(namespace).Watch(options) - }, - }, - &schedulingv1alpha1.PodGroup{}, - resyncPeriod, - indexers, - ) -} - -func (f *podGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *podGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&schedulingv1alpha1.PodGroup{}, f.defaultInformer) -} - -func (f *podGroupInformer) Lister() v1alpha1.PodGroupLister { - return v1alpha1.NewPodGroupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha1/queue.go b/pkg/client/informers/externalversions/scheduling/v1alpha1/queue.go deleted file mode 100644 index de1ce79274..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha1/queue.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - schedulingv1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - versioned "volcano.sh/volcano/pkg/client/clientset/versioned" - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha1" -) - -// QueueInformer provides access to a shared informer and lister for -// Queues. -type QueueInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.QueueLister -} - -type queueInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewQueueInformer constructs a new informer for Queue type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredQueueInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredQueueInformer constructs a new informer for Queue type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Queues().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Queues().Watch(options) - }, - }, - &schedulingv1alpha1.Queue{}, - resyncPeriod, - indexers, - ) -} - -func (f *queueInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredQueueInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *queueInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&schedulingv1alpha1.Queue{}, f.defaultInformer) -} - -func (f *queueInformer) Lister() v1alpha1.QueueLister { - return v1alpha1.NewQueueLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha2/interface.go b/pkg/client/informers/externalversions/scheduling/v1alpha2/interface.go deleted file mode 100644 index 37d99782d1..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha2/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // PodGroups returns a PodGroupInformer. - PodGroups() PodGroupInformer - // Queues returns a QueueInformer. - Queues() QueueInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// PodGroups returns a PodGroupInformer. -func (v *version) PodGroups() PodGroupInformer { - return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Queues returns a QueueInformer. -func (v *version) Queues() QueueInformer { - return &queueInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha2/podgroup.go b/pkg/client/informers/externalversions/scheduling/v1alpha2/podgroup.go deleted file mode 100644 index d6aea0c8b0..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha2/podgroup.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - versioned "volcano.sh/volcano/pkg/client/clientset/versioned" - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha2" -) - -// PodGroupInformer provides access to a shared informer and lister for -// PodGroups. -type PodGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.PodGroupLister -} - -type podGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodGroupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha2().PodGroups(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha2().PodGroups(namespace).Watch(options) - }, - }, - &schedulingv1alpha2.PodGroup{}, - resyncPeriod, - indexers, - ) -} - -func (f *podGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *podGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&schedulingv1alpha2.PodGroup{}, f.defaultInformer) -} - -func (f *podGroupInformer) Lister() v1alpha2.PodGroupLister { - return v1alpha2.NewPodGroupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/scheduling/v1alpha2/queue.go b/pkg/client/informers/externalversions/scheduling/v1alpha2/queue.go deleted file mode 100644 index 6e1933b56f..0000000000 --- a/pkg/client/informers/externalversions/scheduling/v1alpha2/queue.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - versioned "volcano.sh/volcano/pkg/client/clientset/versioned" - internalinterfaces "volcano.sh/volcano/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha2" -) - -// QueueInformer provides access to a shared informer and lister for -// Queues. -type QueueInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.QueueLister -} - -type queueInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewQueueInformer constructs a new informer for Queue type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredQueueInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredQueueInformer constructs a new informer for Queue type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha2().Queues().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha2().Queues().Watch(options) - }, - }, - &schedulingv1alpha2.Queue{}, - resyncPeriod, - indexers, - ) -} - -func (f *queueInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredQueueInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *queueInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&schedulingv1alpha2.Queue{}, f.defaultInformer) -} - -func (f *queueInformer) Lister() v1alpha2.QueueLister { - return v1alpha2.NewQueueLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/scheduling/v1alpha1/expansion_generated.go b/pkg/client/listers/scheduling/v1alpha1/expansion_generated.go deleted file mode 100644 index 1885228949..0000000000 --- a/pkg/client/listers/scheduling/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -// PodGroupListerExpansion allows custom methods to be added to -// PodGroupLister. -type PodGroupListerExpansion interface{} - -// PodGroupNamespaceListerExpansion allows custom methods to be added to -// PodGroupNamespaceLister. -type PodGroupNamespaceListerExpansion interface{} - -// QueueListerExpansion allows custom methods to be added to -// QueueLister. -type QueueListerExpansion interface{} diff --git a/pkg/client/listers/scheduling/v1alpha1/podgroup.go b/pkg/client/listers/scheduling/v1alpha1/podgroup.go deleted file mode 100644 index 372b390a35..0000000000 --- a/pkg/client/listers/scheduling/v1alpha1/podgroup.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" -) - -// PodGroupLister helps list PodGroups. -type PodGroupLister interface { - // List lists all PodGroups in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.PodGroup, err error) - // PodGroups returns an object that can list and get PodGroups. - PodGroups(namespace string) PodGroupNamespaceLister - PodGroupListerExpansion -} - -// podGroupLister implements the PodGroupLister interface. -type podGroupLister struct { - indexer cache.Indexer -} - -// NewPodGroupLister returns a new PodGroupLister. -func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { - return &podGroupLister{indexer: indexer} -} - -// List lists all PodGroups in the indexer. -func (s *podGroupLister) List(selector labels.Selector) (ret []*v1alpha1.PodGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.PodGroup)) - }) - return ret, err -} - -// PodGroups returns an object that can list and get PodGroups. -func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { - return podGroupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PodGroupNamespaceLister helps list and get PodGroups. -type PodGroupNamespaceLister interface { - // List lists all PodGroups in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha1.PodGroup, err error) - // Get retrieves the PodGroup from the indexer for a given namespace and name. - Get(name string) (*v1alpha1.PodGroup, error) - PodGroupNamespaceListerExpansion -} - -// podGroupNamespaceLister implements the PodGroupNamespaceLister -// interface. -type podGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PodGroups in the indexer for a given namespace. -func (s podGroupNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PodGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.PodGroup)) - }) - return ret, err -} - -// Get retrieves the PodGroup from the indexer for a given namespace and name. -func (s podGroupNamespaceLister) Get(name string) (*v1alpha1.PodGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("podgroup"), name) - } - return obj.(*v1alpha1.PodGroup), nil -} diff --git a/pkg/client/listers/scheduling/v1alpha1/queue.go b/pkg/client/listers/scheduling/v1alpha1/queue.go deleted file mode 100644 index 091041f642..0000000000 --- a/pkg/client/listers/scheduling/v1alpha1/queue.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" -) - -// QueueLister helps list Queues. -type QueueLister interface { - // List lists all Queues in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.Queue, err error) - // Get retrieves the Queue from the index for a given name. - Get(name string) (*v1alpha1.Queue, error) - QueueListerExpansion -} - -// queueLister implements the QueueLister interface. -type queueLister struct { - indexer cache.Indexer -} - -// NewQueueLister returns a new QueueLister. -func NewQueueLister(indexer cache.Indexer) QueueLister { - return &queueLister{indexer: indexer} -} - -// List lists all Queues in the indexer. -func (s *queueLister) List(selector labels.Selector) (ret []*v1alpha1.Queue, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Queue)) - }) - return ret, err -} - -// Get retrieves the Queue from the index for a given name. -func (s *queueLister) Get(name string) (*v1alpha1.Queue, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("queue"), name) - } - return obj.(*v1alpha1.Queue), nil -} diff --git a/pkg/client/listers/scheduling/v1alpha2/expansion_generated.go b/pkg/client/listers/scheduling/v1alpha2/expansion_generated.go deleted file mode 100644 index f7086d2e65..0000000000 --- a/pkg/client/listers/scheduling/v1alpha2/expansion_generated.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha2 - -// PodGroupListerExpansion allows custom methods to be added to -// PodGroupLister. -type PodGroupListerExpansion interface{} - -// PodGroupNamespaceListerExpansion allows custom methods to be added to -// PodGroupNamespaceLister. -type PodGroupNamespaceListerExpansion interface{} - -// QueueListerExpansion allows custom methods to be added to -// QueueLister. -type QueueListerExpansion interface{} diff --git a/pkg/client/listers/scheduling/v1alpha2/podgroup.go b/pkg/client/listers/scheduling/v1alpha2/podgroup.go deleted file mode 100644 index 4dff6285e5..0000000000 --- a/pkg/client/listers/scheduling/v1alpha2/podgroup.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" -) - -// PodGroupLister helps list PodGroups. -type PodGroupLister interface { - // List lists all PodGroups in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.PodGroup, err error) - // PodGroups returns an object that can list and get PodGroups. - PodGroups(namespace string) PodGroupNamespaceLister - PodGroupListerExpansion -} - -// podGroupLister implements the PodGroupLister interface. -type podGroupLister struct { - indexer cache.Indexer -} - -// NewPodGroupLister returns a new PodGroupLister. -func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { - return &podGroupLister{indexer: indexer} -} - -// List lists all PodGroups in the indexer. -func (s *podGroupLister) List(selector labels.Selector) (ret []*v1alpha2.PodGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PodGroup)) - }) - return ret, err -} - -// PodGroups returns an object that can list and get PodGroups. -func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { - return podGroupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PodGroupNamespaceLister helps list and get PodGroups. -type PodGroupNamespaceLister interface { - // List lists all PodGroups in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.PodGroup, err error) - // Get retrieves the PodGroup from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.PodGroup, error) - PodGroupNamespaceListerExpansion -} - -// podGroupNamespaceLister implements the PodGroupNamespaceLister -// interface. -type podGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PodGroups in the indexer for a given namespace. -func (s podGroupNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.PodGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PodGroup)) - }) - return ret, err -} - -// Get retrieves the PodGroup from the indexer for a given namespace and name. -func (s podGroupNamespaceLister) Get(name string) (*v1alpha2.PodGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("podgroup"), name) - } - return obj.(*v1alpha2.PodGroup), nil -} diff --git a/pkg/client/listers/scheduling/v1alpha2/queue.go b/pkg/client/listers/scheduling/v1alpha2/queue.go deleted file mode 100644 index 6a335a5882..0000000000 --- a/pkg/client/listers/scheduling/v1alpha2/queue.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The Volcano 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" -) - -// QueueLister helps list Queues. -type QueueLister interface { - // List lists all Queues in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.Queue, err error) - // Get retrieves the Queue from the index for a given name. - Get(name string) (*v1alpha2.Queue, error) - QueueListerExpansion -} - -// queueLister implements the QueueLister interface. -type queueLister struct { - indexer cache.Indexer -} - -// NewQueueLister returns a new QueueLister. -func NewQueueLister(indexer cache.Indexer) QueueLister { - return &queueLister{indexer: indexer} -} - -// List lists all Queues in the indexer. -func (s *queueLister) List(selector labels.Selector) (ret []*v1alpha2.Queue, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Queue)) - }) - return ret, err -} - -// Get retrieves the Queue from the index for a given name. -func (s *queueLister) Get(name string) (*v1alpha2.Queue, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("queue"), name) - } - return obj.(*v1alpha2.Queue), nil -} diff --git a/pkg/controllers/job/job_controller.go b/pkg/controllers/job/job_controller.go index 4e7919a0ee..4dae70bf35 100644 --- a/pkg/controllers/job/job_controller.go +++ b/pkg/controllers/job/job_controller.go @@ -44,10 +44,10 @@ import ( informerfactory "volcano.sh/volcano/pkg/client/informers/externalversions" batchinformer "volcano.sh/volcano/pkg/client/informers/externalversions/batch/v1alpha1" businformer "volcano.sh/volcano/pkg/client/informers/externalversions/bus/v1alpha1" - schedulinginformers "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha2" + schedulinginformers "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1beta1" batchlister "volcano.sh/volcano/pkg/client/listers/batch/v1alpha1" buslister "volcano.sh/volcano/pkg/client/listers/bus/v1alpha1" - schedulinglisters "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha2" + schedulinglisters "volcano.sh/volcano/pkg/client/listers/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" jobcache "volcano.sh/volcano/pkg/controllers/cache" "volcano.sh/volcano/pkg/controllers/job/state" @@ -197,7 +197,7 @@ func NewJobController( cc.svcLister = cc.svcInformer.Lister() cc.svcSynced = cc.svcInformer.Informer().HasSynced - cc.pgInformer = informerfactory.NewSharedInformerFactory(cc.vcClient, 0).Scheduling().V1alpha2().PodGroups() + cc.pgInformer = informerfactory.NewSharedInformerFactory(cc.vcClient, 0).Scheduling().V1beta1().PodGroups() cc.pgInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ UpdateFunc: cc.updatePodGroup, }) diff --git a/pkg/controllers/job/job_controller_actions.go b/pkg/controllers/job/job_controller_actions.go index 59494a5f0e..3329d4a273 100644 --- a/pkg/controllers/job/job_controller_actions.go +++ b/pkg/controllers/job/job_controller_actions.go @@ -30,7 +30,7 @@ import ( batch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" jobhelpers "volcano.sh/volcano/pkg/controllers/job/helpers" "volcano.sh/volcano/pkg/controllers/job/state" @@ -125,7 +125,7 @@ func (cc *Controller) killJob(jobInfo *apis.JobInfo, podRetainPhase state.PhaseM } // Delete PodGroup - if err := cc.vcClient.SchedulingV1alpha2().PodGroups(job.Namespace).Delete(job.Name, nil); err != nil { + if err := cc.vcClient.SchedulingV1beta1().PodGroups(job.Namespace).Delete(job.Name, nil); err != nil { if !apierrors.IsNotFound(err) { klog.Errorf("Failed to delete PodGroup of Job %v/%v: %v", job.Namespace, job.Name, err) @@ -478,7 +478,7 @@ func (cc *Controller) createPodGroupIfNotExist(job *batch.Job) error { }, } - if _, err = cc.vcClient.SchedulingV1alpha2().PodGroups(job.Namespace).Create(pg); err != nil { + if _, err = cc.vcClient.SchedulingV1beta1().PodGroups(job.Namespace).Create(pg); err != nil { if !apierrors.IsAlreadyExists(err) { klog.V(3).Infof("Failed to create PodGroup for Job <%s/%s>: %v", job.Namespace, job.Name, err) diff --git a/pkg/controllers/job/job_controller_actions_test.go b/pkg/controllers/job/job_controller_actions_test.go index 25b6dfa77a..506f912f61 100644 --- a/pkg/controllers/job/job_controller_actions_test.go +++ b/pkg/controllers/job/job_controller_actions_test.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" "volcano.sh/volcano/pkg/controllers/job/state" ) @@ -414,7 +414,7 @@ func TestCreatePodGroupIfNotExistFunc(t *testing.T) { t.Errorf("Expected return value to be equal to expected: %s, but got: %s", testcase.ExpextVal, err) } - _, err = fakeController.vcClient.SchedulingV1alpha2().PodGroups(namespace).Get(testcase.Job.Name, metav1.GetOptions{}) + _, err = fakeController.vcClient.SchedulingV1beta1().PodGroups(namespace).Get(testcase.Job.Name, metav1.GetOptions{}) if err != nil { t.Error("Expected PodGroup to get created, but not created") } diff --git a/pkg/controllers/job/job_controller_handler.go b/pkg/controllers/job/job_controller_handler.go index 088829d5d1..ffd92e3e18 100644 --- a/pkg/controllers/job/job_controller_handler.go +++ b/pkg/controllers/job/job_controller_handler.go @@ -29,7 +29,7 @@ import ( batch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" bus "volcano.sh/volcano/pkg/apis/bus/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" jobcache "volcano.sh/volcano/pkg/controllers/cache" jobhelpers "volcano.sh/volcano/pkg/controllers/job/helpers" diff --git a/pkg/controllers/job/job_controller_handler_test.go b/pkg/controllers/job/job_controller_handler_test.go index 2c1d70476b..f48d86322c 100644 --- a/pkg/controllers/job/job_controller_handler_test.go +++ b/pkg/controllers/job/job_controller_handler_test.go @@ -31,7 +31,7 @@ import ( batch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" bus "volcano.sh/volcano/pkg/apis/bus/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclientset "volcano.sh/volcano/pkg/client/clientset/versioned" ) diff --git a/pkg/controllers/job/job_controller_util.go b/pkg/controllers/job/job_controller_util.go index eac50e871c..502f4a8175 100644 --- a/pkg/controllers/job/job_controller_util.go +++ b/pkg/controllers/job/job_controller_util.go @@ -27,7 +27,7 @@ import ( batch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" jobhelpers "volcano.sh/volcano/pkg/controllers/job/helpers" ) @@ -97,7 +97,7 @@ func createJobPod(job *batch.Job, template *v1.PodTemplateSpec, ix int) *v1.Pod } pod.Annotations[batch.TaskSpecKey] = tsKey - pod.Annotations[schedulingv2.GroupNameAnnotationKey] = job.Name + pod.Annotations[schedulingv2.KubeGroupNameAnnotationKey] = job.Name pod.Annotations[batch.JobNameKey] = job.Name pod.Annotations[batch.JobVersion] = fmt.Sprintf("%d", job.Status.Version) diff --git a/pkg/controllers/podgroup/pg_controller.go b/pkg/controllers/podgroup/pg_controller.go index dc5a031031..501cf976d6 100644 --- a/pkg/controllers/podgroup/pg_controller.go +++ b/pkg/controllers/podgroup/pg_controller.go @@ -27,11 +27,11 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclientset "volcano.sh/volcano/pkg/client/clientset/versioned" informerfactory "volcano.sh/volcano/pkg/client/informers/externalversions" - schedulinginformer "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha2" - schedulinglister "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha2" + schedulinginformer "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1beta1" + schedulinglister "volcano.sh/volcano/pkg/client/listers/scheduling/v1beta1" ) // Controller the Podgroup Controller type @@ -77,7 +77,7 @@ func NewPodgroupController( case *v1.Pod: pod := obj.(*v1.Pod) if pod.Spec.SchedulerName == schedulerName && - (pod.Annotations == nil || pod.Annotations[scheduling.GroupNameAnnotationKey] == "") { + (pod.Annotations == nil || pod.Annotations[scheduling.KubeGroupNameAnnotationKey] == "") { return true } return false @@ -90,7 +90,7 @@ func NewPodgroupController( }, }) - cc.pgInformer = informerfactory.NewSharedInformerFactory(cc.vcClient, 0).Scheduling().V1alpha2().PodGroups() + cc.pgInformer = informerfactory.NewSharedInformerFactory(cc.vcClient, 0).Scheduling().V1beta1().PodGroups() cc.pgLister = cc.pgInformer.Lister() cc.pgSynced = cc.pgInformer.Informer().HasSynced diff --git a/pkg/controllers/podgroup/pg_controller_handler.go b/pkg/controllers/podgroup/pg_controller_handler.go index 781559f4b3..f3c3b0c478 100644 --- a/pkg/controllers/podgroup/pg_controller_handler.go +++ b/pkg/controllers/podgroup/pg_controller_handler.go @@ -23,7 +23,7 @@ import ( "k8s.io/klog" "volcano.sh/volcano/pkg/apis/helpers" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) type podRequest struct { @@ -50,12 +50,12 @@ func (cc *Controller) updatePodAnnotations(pod *v1.Pod, pgName string) error { if pod.Annotations == nil { pod.Annotations = make(map[string]string) } - if pod.Annotations[scheduling.GroupNameAnnotationKey] == "" { - pod.Annotations[scheduling.GroupNameAnnotationKey] = pgName + if pod.Annotations[scheduling.KubeGroupNameAnnotationKey] == "" { + pod.Annotations[scheduling.KubeGroupNameAnnotationKey] = pgName } else { - if pod.Annotations[scheduling.GroupNameAnnotationKey] != pgName { + if pod.Annotations[scheduling.KubeGroupNameAnnotationKey] != pgName { klog.Errorf("normal pod %s/%s annotations %s value is not %s, but %s", pod.Namespace, pod.Name, - scheduling.GroupNameAnnotationKey, pgName, pod.Annotations[scheduling.GroupNameAnnotationKey]) + scheduling.KubeGroupNameAnnotationKey, pgName, pod.Annotations[scheduling.KubeGroupNameAnnotationKey]) } return nil } @@ -90,7 +90,7 @@ func (cc *Controller) createNormalPodPGIfNotExist(pod *v1.Pod) error { }, } - if _, err := cc.vcClient.SchedulingV1alpha2().PodGroups(pod.Namespace).Create(pg); err != nil { + if _, err := cc.vcClient.SchedulingV1beta1().PodGroups(pod.Namespace).Create(pg); err != nil { klog.Errorf("Failed to create normal PodGroup for Pod <%s/%s>: %v", pod.Namespace, pod.Name, err) return err diff --git a/pkg/controllers/podgroup/pg_controller_test.go b/pkg/controllers/podgroup/pg_controller_test.go index 644b53e896..860c75336e 100644 --- a/pkg/controllers/podgroup/pg_controller_test.go +++ b/pkg/controllers/podgroup/pg_controller_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/client-go/informers" kubeclient "k8s.io/client-go/kubernetes/fake" - scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + scheduling "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" ) @@ -74,7 +74,7 @@ func TestAddPodGroup(t *testing.T) { }, expectedPodGroup: &scheduling.PodGroup{ TypeMeta: metav1.TypeMeta{ - APIVersion: "scheduling.sigs.dev/v1alpha2", + APIVersion: "scheduling.volcano.sh/v1beta1", Kind: "PodGroup", }, ObjectMeta: metav1.ObjectMeta{ @@ -111,7 +111,7 @@ func TestAddPodGroup(t *testing.T) { }, expectedPodGroup: &scheduling.PodGroup{ TypeMeta: metav1.TypeMeta{ - APIVersion: "scheduling.sigs.dev/v1alpha2", + APIVersion: "scheduling.volcano.sh/v1beta1", Kind: "PodGroup", }, ObjectMeta: metav1.ObjectMeta{ @@ -145,7 +145,7 @@ func TestAddPodGroup(t *testing.T) { c.addPod(pod) c.createNormalPodPGIfNotExist(pod) - pg, err := c.vcClient.SchedulingV1alpha2().PodGroups(pod.Namespace).Get( + pg, err := c.vcClient.SchedulingV1beta1().PodGroups(pod.Namespace).Get( testCase.expectedPodGroup.Name, metav1.GetOptions{}, ) @@ -157,7 +157,7 @@ func TestAddPodGroup(t *testing.T) { t.Errorf("Case %s failed, expect %v, got %v", testCase.name, testCase.expectedPodGroup, pg) } - podAnnotation := pod.Annotations[scheduling.GroupNameAnnotationKey] + podAnnotation := pod.Annotations[scheduling.KubeGroupNameAnnotationKey] if testCase.expectedPodGroup.Name != podAnnotation { t.Errorf("Case %s failed, expect %v, got %v", testCase.name, testCase.expectedPodGroup.Name, podAnnotation) diff --git a/pkg/controllers/queue/queue_controller.go b/pkg/controllers/queue/queue_controller.go index 93d73eb154..381fbef0fe 100644 --- a/pkg/controllers/queue/queue_controller.go +++ b/pkg/controllers/queue/queue_controller.go @@ -37,9 +37,9 @@ import ( versionedscheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" informerfactory "volcano.sh/volcano/pkg/client/informers/externalversions" busv1alpha1informer "volcano.sh/volcano/pkg/client/informers/externalversions/bus/v1alpha1" - schedulinginformer "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha2" + schedulinginformer "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1beta1" busv1alpha1lister "volcano.sh/volcano/pkg/client/listers/bus/v1alpha1" - schedulinglister "volcano.sh/volcano/pkg/client/listers/scheduling/v1alpha2" + schedulinglister "volcano.sh/volcano/pkg/client/listers/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" queuestate "volcano.sh/volcano/pkg/controllers/queue/state" ) @@ -95,8 +95,8 @@ func NewQueueController( vcClient vcclientset.Interface, ) *Controller { factory := informerfactory.NewSharedInformerFactory(vcClient, 0) - queueInformer := factory.Scheduling().V1alpha2().Queues() - pgInformer := factory.Scheduling().V1alpha2().PodGroups() + queueInformer := factory.Scheduling().V1beta1().Queues() + pgInformer := factory.Scheduling().V1beta1().PodGroups() eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(klog.Infof) diff --git a/pkg/controllers/queue/queue_controller_action.go b/pkg/controllers/queue/queue_controller_action.go index e211335e7b..664294cc7d 100644 --- a/pkg/controllers/queue/queue_controller_action.go +++ b/pkg/controllers/queue/queue_controller_action.go @@ -20,7 +20,7 @@ import ( "fmt" "reflect" "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/queue/state" "k8s.io/api/core/v1" @@ -30,11 +30,11 @@ import ( "k8s.io/klog" ) -func (c *Controller) syncQueue(queue *schedulingv1alpha2.Queue, updateStateFn state.UpdateQueueStatusFn) error { +func (c *Controller) syncQueue(queue *schedulingv1beta1.Queue, updateStateFn state.UpdateQueueStatusFn) error { klog.V(4).Infof("Begin to sync queue %s.", queue.Name) podGroups := c.getPodGroups(queue.Name) - queueStatus := schedulingv1alpha2.QueueStatus{} + queueStatus := schedulingv1beta1.QueueStatus{} for _, pgKey := range podGroups { // Ignore error here, tt can not occur. @@ -47,13 +47,13 @@ func (c *Controller) syncQueue(queue *schedulingv1alpha2.Queue, updateStateFn st } switch pg.Status.Phase { - case schedulingv1alpha2.PodGroupPending: + case schedulingv1beta1.PodGroupPending: queueStatus.Pending++ - case schedulingv1alpha2.PodGroupRunning: + case schedulingv1beta1.PodGroupRunning: queueStatus.Running++ - case schedulingv1alpha2.PodGroupUnknown: + case schedulingv1beta1.PodGroupUnknown: queueStatus.Unknown++ - case schedulingv1alpha2.PodGroupInqueue: + case schedulingv1beta1.PodGroupInqueue: queueStatus.Inqueue++ } } @@ -71,7 +71,7 @@ func (c *Controller) syncQueue(queue *schedulingv1alpha2.Queue, updateStateFn st newQueue := queue.DeepCopy() newQueue.Status = queueStatus - if _, err := c.vcClient.SchedulingV1alpha2().Queues().UpdateStatus(newQueue); err != nil { + if _, err := c.vcClient.SchedulingV1beta1().Queues().UpdateStatus(newQueue); err != nil { klog.Errorf("Failed to update status of Queue %s: %v.", newQueue.Name, err) return err } @@ -79,14 +79,14 @@ func (c *Controller) syncQueue(queue *schedulingv1alpha2.Queue, updateStateFn st return nil } -func (c *Controller) openQueue(queue *schedulingv1alpha2.Queue, updateStateFn state.UpdateQueueStatusFn) error { +func (c *Controller) openQueue(queue *schedulingv1beta1.Queue, updateStateFn state.UpdateQueueStatusFn) error { klog.V(4).Infof("Begin to open queue %s.", queue.Name) newQueue := queue.DeepCopy() - newQueue.Spec.State = schedulingv1alpha2.QueueStateOpen + newQueue.Spec.State = schedulingv1beta1.QueueStateOpen if queue.Spec.State != newQueue.Spec.State { - if _, err := c.vcClient.SchedulingV1alpha2().Queues().Update(newQueue); err != nil { + if _, err := c.vcClient.SchedulingV1beta1().Queues().Update(newQueue); err != nil { c.recorder.Event(newQueue, v1.EventTypeWarning, string(v1alpha1.OpenQueueAction), fmt.Sprintf("Open queue failed for %v", err)) return err @@ -98,7 +98,7 @@ func (c *Controller) openQueue(queue *schedulingv1alpha2.Queue, updateStateFn st return nil } - q, err := c.vcClient.SchedulingV1alpha2().Queues().Get(newQueue.Name, metav1.GetOptions{}) + q, err := c.vcClient.SchedulingV1beta1().Queues().Get(newQueue.Name, metav1.GetOptions{}) if err != nil { return err } @@ -111,7 +111,7 @@ func (c *Controller) openQueue(queue *schedulingv1alpha2.Queue, updateStateFn st } if queue.Status.State != newQueue.Status.State { - if _, err := c.vcClient.SchedulingV1alpha2().Queues().UpdateStatus(newQueue); err != nil { + if _, err := c.vcClient.SchedulingV1beta1().Queues().UpdateStatus(newQueue); err != nil { c.recorder.Event(newQueue, v1.EventTypeWarning, string(v1alpha1.OpenQueueAction), fmt.Sprintf("Update queue status from %s to %s failed for %v", queue.Status.State, newQueue.Status.State, err)) @@ -122,14 +122,14 @@ func (c *Controller) openQueue(queue *schedulingv1alpha2.Queue, updateStateFn st return nil } -func (c *Controller) closeQueue(queue *schedulingv1alpha2.Queue, updateStateFn state.UpdateQueueStatusFn) error { +func (c *Controller) closeQueue(queue *schedulingv1beta1.Queue, updateStateFn state.UpdateQueueStatusFn) error { klog.V(4).Infof("Begin to close queue %s.", queue.Name) newQueue := queue.DeepCopy() - newQueue.Spec.State = schedulingv1alpha2.QueueStateClosed + newQueue.Spec.State = schedulingv1beta1.QueueStateClosed if queue.Spec.State != newQueue.Spec.State { - if _, err := c.vcClient.SchedulingV1alpha2().Queues().Update(newQueue); err != nil { + if _, err := c.vcClient.SchedulingV1beta1().Queues().Update(newQueue); err != nil { c.recorder.Event(newQueue, v1.EventTypeWarning, string(v1alpha1.CloseQueueAction), fmt.Sprintf("Close queue failed for %v", err)) return err @@ -141,7 +141,7 @@ func (c *Controller) closeQueue(queue *schedulingv1alpha2.Queue, updateStateFn s return nil } - q, err := c.vcClient.SchedulingV1alpha2().Queues().Get(newQueue.Name, metav1.GetOptions{}) + q, err := c.vcClient.SchedulingV1beta1().Queues().Get(newQueue.Name, metav1.GetOptions{}) if err != nil { return err } @@ -155,7 +155,7 @@ func (c *Controller) closeQueue(queue *schedulingv1alpha2.Queue, updateStateFn s } if queue.Status.State != newQueue.Status.State { - if _, err := c.vcClient.SchedulingV1alpha2().Queues().UpdateStatus(newQueue); err != nil { + if _, err := c.vcClient.SchedulingV1beta1().Queues().UpdateStatus(newQueue); err != nil { c.recorder.Event(newQueue, v1.EventTypeWarning, string(v1alpha1.CloseQueueAction), fmt.Sprintf("Update queue status from %s to %s failed for %v", queue.Status.State, newQueue.Status.State, err)) diff --git a/pkg/controllers/queue/queue_controller_handler.go b/pkg/controllers/queue/queue_controller_handler.go index 009c73cfb8..537489fd52 100644 --- a/pkg/controllers/queue/queue_controller_handler.go +++ b/pkg/controllers/queue/queue_controller_handler.go @@ -21,7 +21,7 @@ import ( "k8s.io/klog" busv1alpha1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/apis" ) @@ -30,7 +30,7 @@ func (c *Controller) enqueue(req *apis.Request) { } func (c *Controller) addQueue(obj interface{}) { - queue := obj.(*schedulingv1alpha2.Queue) + queue := obj.(*schedulingv1beta1.Queue) req := &apis.Request{ QueueName: queue.Name, @@ -43,14 +43,14 @@ func (c *Controller) addQueue(obj interface{}) { } func (c *Controller) deleteQueue(obj interface{}) { - queue, ok := obj.(*schedulingv1alpha2.Queue) + queue, ok := obj.(*schedulingv1beta1.Queue) if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { klog.Errorf("Couldn't get object from tombstone %#v.", obj) return } - queue, ok = tombstone.Obj.(*schedulingv1alpha2.Queue) + queue, ok = tombstone.Obj.(*schedulingv1beta1.Queue) if !ok { klog.Errorf("Tombstone contained object that is not a Queue: %#v.", obj) return @@ -63,15 +63,15 @@ func (c *Controller) deleteQueue(obj interface{}) { } func (c *Controller) updateQueue(old, new interface{}) { - oldQueue, ok := old.(*schedulingv1alpha2.Queue) + oldQueue, ok := old.(*schedulingv1beta1.Queue) if !ok { - klog.Errorf("Can not covert old object %v to queues.scheduling.sigs.dev.", old) + klog.Errorf("Can not covert old object %v to queues.scheduling.volcano.sh.", old) return } - newQueue, ok := new.(*schedulingv1alpha2.Queue) + newQueue, ok := new.(*schedulingv1beta1.Queue) if !ok { - klog.Errorf("Can not covert new object %v to queues.scheduling.sigs.dev.", old) + klog.Errorf("Can not covert new object %v to queues.scheduling.volcano.sh.", old) return } @@ -85,7 +85,7 @@ func (c *Controller) updateQueue(old, new interface{}) { } func (c *Controller) addPodGroup(obj interface{}) { - pg := obj.(*schedulingv1alpha2.PodGroup) + pg := obj.(*schedulingv1beta1.PodGroup) key, _ := cache.MetaNamespaceKeyFunc(obj) c.pgMutex.Lock() @@ -107,8 +107,8 @@ func (c *Controller) addPodGroup(obj interface{}) { } func (c *Controller) updatePodGroup(old, new interface{}) { - oldPG := old.(*schedulingv1alpha2.PodGroup) - newPG := new.(*schedulingv1alpha2.PodGroup) + oldPG := old.(*schedulingv1beta1.PodGroup) + newPG := new.(*schedulingv1beta1.PodGroup) // Note: we have no use case update PodGroup.Spec.Queue // So do not consider it here. @@ -118,14 +118,14 @@ func (c *Controller) updatePodGroup(old, new interface{}) { } func (c *Controller) deletePodGroup(obj interface{}) { - pg, ok := obj.(*schedulingv1alpha2.PodGroup) + pg, ok := obj.(*schedulingv1beta1.PodGroup) if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { klog.Errorf("Couldn't get object from tombstone %#v.", obj) return } - pg, ok = tombstone.Obj.(*schedulingv1alpha2.PodGroup) + pg, ok = tombstone.Obj.(*schedulingv1beta1.PodGroup) if !ok { klog.Errorf("Tombstone contained object that is not a PodGroup: %#v.", obj) return diff --git a/pkg/controllers/queue/queue_controller_test.go b/pkg/controllers/queue/queue_controller_test.go index 9c4a068456..cfd882256e 100644 --- a/pkg/controllers/queue/queue_controller_test.go +++ b/pkg/controllers/queue/queue_controller_test.go @@ -24,7 +24,7 @@ import ( kubeclient "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/cache" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" ) @@ -39,16 +39,16 @@ func newFakeController() *Controller { func TestAddQueue(t *testing.T) { testCases := []struct { Name string - queue *schedulingv1alpha2.Queue + queue *schedulingv1beta1.Queue ExpectValue int }{ { Name: "AddQueue", - queue: &schedulingv1alpha2.Queue{ + queue: &schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "c1", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, }, @@ -70,16 +70,16 @@ func TestAddQueue(t *testing.T) { func TestDeleteQueue(t *testing.T) { testCases := []struct { Name string - queue *schedulingv1alpha2.Queue + queue *schedulingv1beta1.Queue ExpectValue bool }{ { Name: "DeleteQueue", - queue: &schedulingv1alpha2.Queue{ + queue: &schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "c1", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, }, @@ -105,17 +105,17 @@ func TestAddPodGroup(t *testing.T) { testCases := []struct { Name string - podGroup *schedulingv1alpha2.PodGroup + podGroup *schedulingv1beta1.PodGroup ExpectValue int }{ { Name: "addpodgroup", - podGroup: &schedulingv1alpha2.PodGroup{ + podGroup: &schedulingv1beta1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: namespace, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ Queue: "c1", }, }, @@ -143,17 +143,17 @@ func TestDeletePodGroup(t *testing.T) { testCases := []struct { Name string - podGroup *schedulingv1alpha2.PodGroup + podGroup *schedulingv1beta1.PodGroup ExpectValue bool }{ { Name: "deletepodgroup", - podGroup: &schedulingv1alpha2.PodGroup{ + podGroup: &schedulingv1beta1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: namespace, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ Queue: "c1", }, }, @@ -180,34 +180,34 @@ func TestUpdatePodGroup(t *testing.T) { testCases := []struct { Name string - podGroupold *schedulingv1alpha2.PodGroup - podGroupnew *schedulingv1alpha2.PodGroup + podGroupold *schedulingv1beta1.PodGroup + podGroupnew *schedulingv1beta1.PodGroup ExpectValue int }{ { Name: "updatepodgroup", - podGroupold: &schedulingv1alpha2.PodGroup{ + podGroupold: &schedulingv1beta1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: namespace, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ Queue: "c1", }, - Status: schedulingv1alpha2.PodGroupStatus{ - Phase: schedulingv1alpha2.PodGroupPending, + Status: schedulingv1beta1.PodGroupStatus{ + Phase: schedulingv1beta1.PodGroupPending, }, }, - podGroupnew: &schedulingv1alpha2.PodGroup{ + podGroupnew: &schedulingv1beta1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: namespace, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ Queue: "c1", }, - Status: schedulingv1alpha2.PodGroupStatus{ - Phase: schedulingv1alpha2.PodGroupRunning, + Status: schedulingv1beta1.PodGroupStatus{ + Phase: schedulingv1beta1.PodGroupRunning, }, }, ExpectValue: 1, @@ -230,29 +230,29 @@ func TestSyncQueue(t *testing.T) { testCases := []struct { Name string - podGroup *schedulingv1alpha2.PodGroup - queue *schedulingv1alpha2.Queue + podGroup *schedulingv1beta1.PodGroup + queue *schedulingv1beta1.Queue ExpectValue int32 }{ { Name: "syncQueue", - podGroup: &schedulingv1alpha2.PodGroup{ + podGroup: &schedulingv1beta1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: namespace, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ Queue: "c1", }, - Status: schedulingv1alpha2.PodGroupStatus{ - Phase: schedulingv1alpha2.PodGroupPending, + Status: schedulingv1beta1.PodGroupStatus{ + Phase: schedulingv1beta1.PodGroupPending, }, }, - queue: &schedulingv1alpha2.Queue{ + queue: &schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "c1", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, }, @@ -269,10 +269,10 @@ func TestSyncQueue(t *testing.T) { c.pgInformer.Informer().GetIndexer().Add(testcase.podGroup) c.queueInformer.Informer().GetIndexer().Add(testcase.queue) - c.vcClient.SchedulingV1alpha2().Queues().Create(testcase.queue) + c.vcClient.SchedulingV1beta1().Queues().Create(testcase.queue) err := c.syncQueue(testcase.queue, nil) - item, _ := c.vcClient.SchedulingV1alpha2().Queues().Get(testcase.queue.Name, metav1.GetOptions{}) + item, _ := c.vcClient.SchedulingV1beta1().Queues().Get(testcase.queue.Name, metav1.GetOptions{}) if err != nil && testcase.ExpectValue != item.Status.Pending { t.Errorf("case %d (%s): expected: %v, got %v ", i, testcase.Name, testcase.ExpectValue, c.queue.Len()) } diff --git a/pkg/controllers/queue/queue_controller_util.go b/pkg/controllers/queue/queue_controller_util.go index 28ce7a261b..17140f6bfd 100644 --- a/pkg/controllers/queue/queue_controller_util.go +++ b/pkg/controllers/queue/queue_controller_util.go @@ -17,7 +17,7 @@ limitations under the License. package queue import ( - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -28,7 +28,7 @@ func IsQueueReference(ref *metav1.OwnerReference) bool { return false } - if ref.APIVersion != schedulingv1alpha2.SchemeGroupVersion.String() { + if ref.APIVersion != schedulingv1beta1.SchemeGroupVersion.String() { return false } diff --git a/pkg/controllers/queue/state/closed.go b/pkg/controllers/queue/state/closed.go index 485770471d..9bfecc4a84 100644 --- a/pkg/controllers/queue/state/closed.go +++ b/pkg/controllers/queue/state/closed.go @@ -18,39 +18,39 @@ package state import ( "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) type closedState struct { - queue *v1alpha2.Queue + queue *v1beta1.Queue } func (cs *closedState) Execute(action v1alpha1.Action) error { switch action { case v1alpha1.OpenQueueAction: - return OpenQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { - status.State = v1alpha2.QueueStateOpen + return OpenQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { + status.State = v1beta1.QueueStateOpen return }) case v1alpha1.CloseQueueAction: - return SyncQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { - status.State = v1alpha2.QueueStateClosed + return SyncQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { + status.State = v1beta1.QueueStateClosed return }) default: - return SyncQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return SyncQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { specState := cs.queue.Spec.State - if specState == v1alpha2.QueueStateOpen { - status.State = v1alpha2.QueueStateOpen + if specState == v1beta1.QueueStateOpen { + status.State = v1beta1.QueueStateOpen return } - if specState == v1alpha2.QueueStateClosed { - status.State = v1alpha2.QueueStateClosed + if specState == v1beta1.QueueStateClosed { + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateUnknown + status.State = v1beta1.QueueStateUnknown return }) } diff --git a/pkg/controllers/queue/state/closing.go b/pkg/controllers/queue/state/closing.go index a5ec55100f..0faa5b623f 100644 --- a/pkg/controllers/queue/state/closing.go +++ b/pkg/controllers/queue/state/closing.go @@ -18,49 +18,49 @@ package state import ( "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) type closingState struct { - queue *v1alpha2.Queue + queue *v1beta1.Queue } func (cs *closingState) Execute(action v1alpha1.Action) error { switch action { case v1alpha1.OpenQueueAction: - return OpenQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { - status.State = v1alpha2.QueueStateOpen + return OpenQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { + status.State = v1beta1.QueueStateOpen return }) case v1alpha1.CloseQueueAction: - return SyncQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return SyncQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return }) default: - return SyncQueue(cs.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return SyncQueue(cs.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { specState := cs.queue.Spec.State - if specState == v1alpha2.QueueStateOpen { - status.State = v1alpha2.QueueStateOpen + if specState == v1beta1.QueueStateOpen { + status.State = v1beta1.QueueStateOpen return } - if specState == v1alpha2.QueueStateClosed { + if specState == v1beta1.QueueStateClosed { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return } - status.State = v1alpha2.QueueStateUnknown + status.State = v1beta1.QueueStateUnknown return }) } diff --git a/pkg/controllers/queue/state/factory.go b/pkg/controllers/queue/state/factory.go index 236f8a20ff..fdf03bedc3 100644 --- a/pkg/controllers/queue/state/factory.go +++ b/pkg/controllers/queue/state/factory.go @@ -18,7 +18,7 @@ package state import ( "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) // State interface @@ -28,10 +28,10 @@ type State interface { } // UpdateQueueStatusFn updates the queue status -type UpdateQueueStatusFn func(status *v1alpha2.QueueStatus, podGroupList []string) +type UpdateQueueStatusFn func(status *v1beta1.QueueStatus, podGroupList []string) // QueueActionFn will open, close or sync queue. -type QueueActionFn func(queue *v1alpha2.Queue, fn UpdateQueueStatusFn) error +type QueueActionFn func(queue *v1beta1.Queue, fn UpdateQueueStatusFn) error var ( // SyncQueue will sync queue status. @@ -43,15 +43,15 @@ var ( ) // NewState gets the state from queue status -func NewState(queue *v1alpha2.Queue) State { +func NewState(queue *v1beta1.Queue) State { switch queue.Status.State { - case "", v1alpha2.QueueStateOpen: + case "", v1beta1.QueueStateOpen: return &openState{queue: queue} - case v1alpha2.QueueStateClosed: + case v1beta1.QueueStateClosed: return &closedState{queue: queue} - case v1alpha2.QueueStateClosing: + case v1beta1.QueueStateClosing: return &closingState{queue: queue} - case v1alpha2.QueueStateUnknown: + case v1beta1.QueueStateUnknown: return &unknownState{queue: queue} } diff --git a/pkg/controllers/queue/state/open.go b/pkg/controllers/queue/state/open.go index 156e541df1..0defe1d744 100644 --- a/pkg/controllers/queue/state/open.go +++ b/pkg/controllers/queue/state/open.go @@ -18,49 +18,49 @@ package state import ( "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) type openState struct { - queue *v1alpha2.Queue + queue *v1beta1.Queue } func (os *openState) Execute(action v1alpha1.Action) error { switch action { case v1alpha1.OpenQueueAction: - return SyncQueue(os.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { - status.State = v1alpha2.QueueStateOpen + return SyncQueue(os.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { + status.State = v1beta1.QueueStateOpen return }) case v1alpha1.CloseQueueAction: - return CloseQueue(os.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return CloseQueue(os.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return }) default: - return SyncQueue(os.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return SyncQueue(os.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { specState := os.queue.Spec.State - if len(specState) == 0 || specState == v1alpha2.QueueStateOpen { - status.State = v1alpha2.QueueStateOpen + if len(specState) == 0 || specState == v1beta1.QueueStateOpen { + status.State = v1beta1.QueueStateOpen return } - if specState == v1alpha2.QueueStateClosed { + if specState == v1beta1.QueueStateClosed { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return } - status.State = v1alpha2.QueueStateUnknown + status.State = v1beta1.QueueStateUnknown return }) } diff --git a/pkg/controllers/queue/state/unknown.go b/pkg/controllers/queue/state/unknown.go index 52b3230d6f..e176fd84c6 100644 --- a/pkg/controllers/queue/state/unknown.go +++ b/pkg/controllers/queue/state/unknown.go @@ -18,49 +18,49 @@ package state import ( "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) type unknownState struct { - queue *v1alpha2.Queue + queue *v1beta1.Queue } func (us *unknownState) Execute(action v1alpha1.Action) error { switch action { case v1alpha1.OpenQueueAction: - return OpenQueue(us.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { - status.State = v1alpha2.QueueStateOpen + return OpenQueue(us.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { + status.State = v1beta1.QueueStateOpen return }) case v1alpha1.CloseQueueAction: - return CloseQueue(us.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return CloseQueue(us.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return }) default: - return SyncQueue(us.queue, func(status *v1alpha2.QueueStatus, podGroupList []string) { + return SyncQueue(us.queue, func(status *v1beta1.QueueStatus, podGroupList []string) { specState := us.queue.Spec.State - if specState == v1alpha2.QueueStateOpen { - status.State = v1alpha2.QueueStateOpen + if specState == v1beta1.QueueStateOpen { + status.State = v1beta1.QueueStateOpen return } - if specState == v1alpha2.QueueStateClosed { + if specState == v1beta1.QueueStateClosed { if len(podGroupList) == 0 { - status.State = v1alpha2.QueueStateClosed + status.State = v1beta1.QueueStateClosed return } - status.State = v1alpha2.QueueStateClosing + status.State = v1beta1.QueueStateClosing return } - status.State = v1alpha2.QueueStateUnknown + status.State = v1beta1.QueueStateUnknown return }) } diff --git a/pkg/scheduler/actions/allocate/allocate_test.go b/pkg/scheduler/actions/allocate/allocate_test.go index 0a74be5e5e..8073fe5fd2 100644 --- a/pkg/scheduler/actions/allocate/allocate_test.go +++ b/pkg/scheduler/actions/allocate/allocate_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/client-go/tools/record" "volcano.sh/volcano/cmd/scheduler/app/options" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" "volcano.sh/volcano/pkg/scheduler/cache" "volcano.sh/volcano/pkg/scheduler/conf" @@ -50,21 +50,21 @@ func TestAllocate(t *testing.T) { tests := []struct { name string - podGroups []*schedulingv2.PodGroup + podGroups []*schedulingv1.PodGroup pods []*v1.Pod nodes []*v1.Node - queues []*schedulingv2.Queue + queues []*schedulingv1.Queue expected map[string]string }{ { name: "one Job with two Pods on one node", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ Queue: "c1", }, }, @@ -76,12 +76,12 @@ func TestAllocate(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("2", "4Gi"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "c1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -93,13 +93,13 @@ func TestAllocate(t *testing.T) { }, { name: "two Jobs on one node", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ Queue: "c1", }, }, @@ -108,7 +108,7 @@ func TestAllocate(t *testing.T) { Name: "pg2", Namespace: "c2", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ Queue: "c2", }, }, @@ -127,12 +127,12 @@ func TestAllocate(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("2", "4G"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "c1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -140,7 +140,7 @@ func TestAllocate(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "c2", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -178,11 +178,11 @@ func TestAllocate(t *testing.T) { } for _, ss := range test.podGroups { - schedulerCache.AddPodGroupV1alpha2(ss) + schedulerCache.AddPodGroupV1beta1(ss) } for _, q := range test.queues { - schedulerCache.AddQueueV1alpha2(q) + schedulerCache.AddQueueV1beta1(q) } trueValue := true diff --git a/pkg/scheduler/actions/preempt/preempt_test.go b/pkg/scheduler/actions/preempt/preempt_test.go index f8be6703d8..91b7f1843b 100644 --- a/pkg/scheduler/actions/preempt/preempt_test.go +++ b/pkg/scheduler/actions/preempt/preempt_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/client-go/tools/record" "volcano.sh/volcano/cmd/scheduler/app/options" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" "volcano.sh/volcano/pkg/scheduler/cache" "volcano.sh/volcano/pkg/scheduler/conf" @@ -47,21 +47,21 @@ func TestPreempt(t *testing.T) { tests := []struct { name string - podGroups []*schedulingv2.PodGroup + podGroups []*schedulingv1.PodGroup pods []*v1.Pod nodes []*v1.Node - queues []*schedulingv2.Queue + queues []*schedulingv1.Queue expected int }{ { name: "do not preempt if there are enough idle resources", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 3, Queue: "q1", }, @@ -76,12 +76,12 @@ func TestPreempt(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("10", "10G"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "q1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -90,13 +90,13 @@ func TestPreempt(t *testing.T) { }, { name: "do not preempt if job is pipelined", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -106,7 +106,7 @@ func TestPreempt(t *testing.T) { Name: "pg2", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -123,12 +123,12 @@ func TestPreempt(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("3", "3G"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "q1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -137,13 +137,13 @@ func TestPreempt(t *testing.T) { }, { name: "preempt one task of different job to fit both jobs on one node", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -153,7 +153,7 @@ func TestPreempt(t *testing.T) { Name: "pg2", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -169,12 +169,12 @@ func TestPreempt(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("2", "2G"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "q1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -183,13 +183,13 @@ func TestPreempt(t *testing.T) { }, { name: "preempt enough tasks to fit large task of different job", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -199,7 +199,7 @@ func TestPreempt(t *testing.T) { Name: "pg2", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ MinMember: 1, Queue: "q1", }, @@ -216,12 +216,12 @@ func TestPreempt(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("6", "6G"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "q1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -260,11 +260,11 @@ func TestPreempt(t *testing.T) { } for _, ss := range test.podGroups { - schedulerCache.AddPodGroupV1alpha2(ss) + schedulerCache.AddPodGroupV1beta1(ss) } for _, q := range test.queues { - schedulerCache.AddQueueV1alpha2(q) + schedulerCache.AddQueueV1beta1(q) } trueValue := true diff --git a/pkg/scheduler/actions/reclaim/reclaim_test.go b/pkg/scheduler/actions/reclaim/reclaim_test.go index 1d32721f05..93893bc15b 100644 --- a/pkg/scheduler/actions/reclaim/reclaim_test.go +++ b/pkg/scheduler/actions/reclaim/reclaim_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" "volcano.sh/volcano/pkg/scheduler/cache" "volcano.sh/volcano/pkg/scheduler/conf" @@ -41,21 +41,21 @@ func TestReclaim(t *testing.T) { tests := []struct { name string - podGroups []*schedulingv2.PodGroup + podGroups []*schedulingv1.PodGroup pods []*v1.Pod nodes []*v1.Node - queues []*schedulingv2.Queue + queues []*schedulingv1.Queue expected int }{ { name: "Two Queue with one Queue overusing resource, should reclaim", - podGroups: []*schedulingv2.PodGroup{ + podGroups: []*schedulingv1.PodGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: "pg1", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ Queue: "q1", }, }, @@ -64,7 +64,7 @@ func TestReclaim(t *testing.T) { Name: "pg2", Namespace: "c1", }, - Spec: schedulingv2.PodGroupSpec{ + Spec: schedulingv1.PodGroupSpec{ Queue: "q2", }, }, @@ -78,12 +78,12 @@ func TestReclaim(t *testing.T) { nodes: []*v1.Node{ util.BuildNode("n1", util.BuildResourceList("3", "3Gi"), make(map[string]string)), }, - queues: []*schedulingv2.Queue{ + queues: []*schedulingv1.Queue{ { ObjectMeta: metav1.ObjectMeta{ Name: "q1", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -91,7 +91,7 @@ func TestReclaim(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "q2", }, - Spec: schedulingv2.QueueSpec{ + Spec: schedulingv1.QueueSpec{ Weight: 1, }, }, @@ -129,11 +129,11 @@ func TestReclaim(t *testing.T) { } for _, ss := range test.podGroups { - schedulerCache.AddPodGroupV1alpha2(ss) + schedulerCache.AddPodGroupV1beta1(ss) } for _, q := range test.queues { - schedulerCache.AddQueueV1alpha2(q) + schedulerCache.AddQueueV1beta1(q) } trueValue := true diff --git a/pkg/scheduler/api/job_info.go b/pkg/scheduler/api/job_info.go index d15384c7d5..f387d70804 100644 --- a/pkg/scheduler/api/job_info.go +++ b/pkg/scheduler/api/job_info.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/types" "volcano.sh/volcano/pkg/apis/scheduling" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) // TaskID is UID type for Task @@ -54,7 +54,7 @@ type TaskInfo struct { } func getJobID(pod *v1.Pod) JobID { - if gn, found := pod.Annotations[v1alpha2.GroupNameAnnotationKey]; found && len(gn) != 0 { + if gn, found := pod.Annotations[v1beta1.KubeGroupNameAnnotationKey]; found && len(gn) != 0 { // Make sure Pod and PodGroup belong to the same namespace. jobID := fmt.Sprintf("%s/%s", pod.Namespace, gn) return JobID(jobID) diff --git a/pkg/scheduler/api/pod_group_info.go b/pkg/scheduler/api/pod_group_info.go index 6de7a2833d..0bee93bdeb 100644 --- a/pkg/scheduler/api/pod_group_info.go +++ b/pkg/scheduler/api/pod_group_info.go @@ -26,10 +26,7 @@ type PodGroupPhase string // These are the valid phase of podGroups. const ( //PodGroupVersionV1Alpha1 represents PodGroupVersion of V1Alpha1 - PodGroupVersionV1Alpha1 string = "v1alpha1" - - //PodGroupVersionV1Alpha2 represents PodGroupVersion of V1Alpha2 - PodGroupVersionV1Alpha2 string = "v1alpha2" + PodGroupVersionV1Beta1 string = "v1beta1" ) // PodGroup is a collection of Pod; used for batch workload. diff --git a/pkg/scheduler/cache/cache.go b/pkg/scheduler/cache/cache.go index 938e351f97..27694cdc99 100644 --- a/pkg/scheduler/cache/cache.go +++ b/pkg/scheduler/cache/cache.go @@ -18,9 +18,6 @@ package cache import ( "fmt" - "sync" - "time" - "k8s.io/api/core/v1" "k8s.io/api/scheduling/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -41,17 +38,17 @@ import ( "k8s.io/klog" podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/scheduler/volumebinder" + "sync" + "time" + vcv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/cmd/scheduler/app/options" "volcano.sh/volcano/pkg/apis/scheduling" schedulingscheme "volcano.sh/volcano/pkg/apis/scheduling/scheme" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" vcclient "volcano.sh/volcano/pkg/client/clientset/versioned" "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" vcinformer "volcano.sh/volcano/pkg/client/informers/externalversions" - vcinformerv1 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha1" - vcinformerv2 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1alpha2" + vcinformerv1 "volcano.sh/volcano/pkg/client/informers/externalversions/scheduling/v1beta1" schedulingapi "volcano.sh/volcano/pkg/scheduler/api" ) @@ -79,18 +76,16 @@ type SchedulerCache struct { // schedulerName is the name for kube batch scheduler schedulerName string - podInformer infov1.PodInformer - nodeInformer infov1.NodeInformer - nsInformer infov1.NamespaceInformer - podGroupInformerV1alpha1 vcinformerv1.PodGroupInformer - podGroupInformerV1alpha2 vcinformerv2.PodGroupInformer - queueInformerV1alpha1 vcinformerv1.QueueInformer - queueInformerV1alpha2 vcinformerv2.QueueInformer - pvInformer infov1.PersistentVolumeInformer - pvcInformer infov1.PersistentVolumeClaimInformer - scInformer storagev1.StorageClassInformer - pcInformer schedv1.PriorityClassInformer - quotaInformer infov1.ResourceQuotaInformer + podInformer infov1.PodInformer + nodeInformer infov1.NodeInformer + nsInformer infov1.NamespaceInformer + podGroupInformerV1beta1 vcinformerv1.PodGroupInformer + queueInformerV1beta1 vcinformerv1.QueueInformer + pvInformer infov1.PersistentVolumeInformer + pvcInformer infov1.PersistentVolumeClaimInformer + scInformer storagev1.StorageClassInformer + pcInformer schedv1.PriorityClassInformer + quotaInformer infov1.ResourceQuotaInformer Binder Binder Evictor Evictor @@ -188,49 +183,26 @@ func (su *defaultStatusUpdater) UpdatePodCondition(pod *v1.Pod, condition *v1.Po // UpdatePodGroup will Update pod with podCondition func (su *defaultStatusUpdater) UpdatePodGroup(pg *schedulingapi.PodGroup) (*schedulingapi.PodGroup, error) { - if pg.Version == schedulingapi.PodGroupVersionV1Alpha1 { - podgroup := &v1alpha1.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&pg.PodGroup, podgroup, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) - return nil, err - } - - updated, err := su.vcclient.SchedulingV1alpha1().PodGroups(podgroup.Namespace).Update(podgroup) - if err != nil { - klog.Errorf("Error while updating PodGroup with error: %v", err) - return nil, err - } - - podGroupInfo := &schedulingapi.PodGroup{Version: schedulingapi.PodGroupVersionV1Alpha1} - if err := schedulingscheme.Scheme.Convert(updated, &podGroupInfo.PodGroup, nil); err != nil { - klog.Errorf("Error while converting v1alpha.PodGroup to api.PodGroup with error: %v", err) - return nil, err - } - - return podGroupInfo, nil + podgroup := &vcv1beta1.PodGroup{} + if err := schedulingscheme.Scheme.Convert(&pg.PodGroup, podgroup, nil); err != nil { + klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) + return nil, err } - if pg.Version == schedulingapi.PodGroupVersionV1Alpha2 { - podgroup := &v1alpha2.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&pg.PodGroup, podgroup, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha2.PodGroup with error: %v", err) - return nil, err - } - - updated, err := su.vcclient.SchedulingV1alpha2().PodGroups(podgroup.Namespace).Update(podgroup) - if err != nil { - klog.Errorf("Error while updating PodGroup with error: %v", err) - } - - podGroupInfo := &schedulingapi.PodGroup{Version: schedulingapi.PodGroupVersionV1Alpha2} - if err := schedulingscheme.Scheme.Convert(updated, &podGroupInfo.PodGroup, nil); err != nil { - klog.Errorf("Error While converting v2alpha.PodGroup to api.PodGroup with error: %v", err) - return nil, err - } + updated, err := su.vcclient.SchedulingV1beta1().PodGroups(podgroup.Namespace).Update(podgroup) + if err != nil { + klog.Errorf("Error while updating PodGroup with error: %v", err) + return nil, err + } - return podGroupInfo, nil + podGroupInfo := &schedulingapi.PodGroup{Version: schedulingapi.PodGroupVersionV1Beta1} + if err := schedulingscheme.Scheme.Convert(updated, &podGroupInfo.PodGroup, nil); err != nil { + klog.Errorf("Error while converting v1alpha.PodGroup to api.PodGroup with error: %v", err) + return nil, err } + return podGroupInfo, nil + return nil, fmt.Errorf("invalid PodGroup version: %s", pg.Version) } @@ -271,15 +243,15 @@ func newSchedulerCache(config *rest.Config, schedulerName string, defaultQueue s } // create default queue - defaultQue := v1alpha2.Queue{ + defaultQue := vcv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: defaultQueue, }, - Spec: v1alpha2.QueueSpec{ + Spec: vcv1beta1.QueueSpec{ Weight: 1, }, } - if _, err := vcClient.SchedulingV1alpha2().Queues().Create(&defaultQue); err != nil && !apierrors.IsAlreadyExists(err) { + if _, err := vcClient.SchedulingV1beta1().Queues().Create(&defaultQue); err != nil && !apierrors.IsAlreadyExists(err) { panic(fmt.Sprintf("failed init default queue, with err: %v", err)) } @@ -383,36 +355,21 @@ func newSchedulerCache(config *rest.Config, schedulerName string, defaultQueue s }) vcinformers := vcinformer.NewSharedInformerFactory(sc.vcclient, 0) - // create informer for PodGroup(v1alpha1) information - sc.podGroupInformerV1alpha1 = vcinformers.Scheduling().V1alpha1().PodGroups() - sc.podGroupInformerV1alpha1.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: sc.AddPodGroupV1alpha1, - UpdateFunc: sc.UpdatePodGroupV1alpha1, - DeleteFunc: sc.DeletePodGroupV1alpha1, - }) - - // create informer for PodGroup(v1alpha2) information - sc.podGroupInformerV1alpha2 = vcinformers.Scheduling().V1alpha2().PodGroups() - sc.podGroupInformerV1alpha2.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: sc.AddPodGroupV1alpha2, - UpdateFunc: sc.UpdatePodGroupV1alpha2, - DeleteFunc: sc.DeletePodGroupV1alpha2, - }) - // create informer(v1alpha1) for Queue information - sc.queueInformerV1alpha1 = vcinformers.Scheduling().V1alpha1().Queues() - sc.queueInformerV1alpha1.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: sc.AddQueueV1alpha1, - UpdateFunc: sc.UpdateQueueV1alpha1, - DeleteFunc: sc.DeleteQueueV1alpha1, + // create informer for PodGroup(v1beta1) information + sc.podGroupInformerV1beta1 = vcinformers.Scheduling().V1beta1().PodGroups() + sc.podGroupInformerV1beta1.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: sc.AddPodGroupV1beta1, + UpdateFunc: sc.UpdatePodGroupV1beta1, + DeleteFunc: sc.DeletePodGroupV1beta1, }) - // create informer(v1alpha2) for Queue information - sc.queueInformerV1alpha2 = vcinformers.Scheduling().V1alpha2().Queues() - sc.queueInformerV1alpha2.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: sc.AddQueueV1alpha2, - UpdateFunc: sc.UpdateQueueV1alpha2, - DeleteFunc: sc.DeleteQueueV1alpha2, + // create informer(v1beta1) for Queue information + sc.queueInformerV1beta1 = vcinformers.Scheduling().V1beta1().Queues() + sc.queueInformerV1beta1.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: sc.AddQueueV1beta1, + UpdateFunc: sc.UpdateQueueV1beta1, + DeleteFunc: sc.DeleteQueueV1beta1, }) return sc @@ -422,13 +379,11 @@ func newSchedulerCache(config *rest.Config, schedulerName string, defaultQueue s func (sc *SchedulerCache) Run(stopCh <-chan struct{}) { go sc.podInformer.Informer().Run(stopCh) go sc.nodeInformer.Informer().Run(stopCh) - go sc.podGroupInformerV1alpha1.Informer().Run(stopCh) - go sc.podGroupInformerV1alpha2.Informer().Run(stopCh) + go sc.podGroupInformerV1beta1.Informer().Run(stopCh) go sc.pvInformer.Informer().Run(stopCh) go sc.pvcInformer.Informer().Run(stopCh) go sc.scInformer.Informer().Run(stopCh) - go sc.queueInformerV1alpha1.Informer().Run(stopCh) - go sc.queueInformerV1alpha2.Informer().Run(stopCh) + go sc.queueInformerV1beta1.Informer().Run(stopCh) go sc.quotaInformer.Informer().Run(stopCh) if options.ServerOpts.EnablePriorityClass { @@ -449,14 +404,12 @@ func (sc *SchedulerCache) WaitForCacheSync(stopCh <-chan struct{}) bool { func() []cache.InformerSynced { informerSynced := []cache.InformerSynced{ sc.podInformer.Informer().HasSynced, - sc.podGroupInformerV1alpha1.Informer().HasSynced, - sc.podGroupInformerV1alpha2.Informer().HasSynced, + sc.podGroupInformerV1beta1.Informer().HasSynced, sc.nodeInformer.Informer().HasSynced, sc.pvInformer.Informer().HasSynced, sc.pvcInformer.Informer().HasSynced, sc.scInformer.Informer().HasSynced, - sc.queueInformerV1alpha1.Informer().HasSynced, - sc.queueInformerV1alpha2.Informer().HasSynced, + sc.queueInformerV1beta1.Informer().HasSynced, sc.quotaInformer.Informer().HasSynced, } if options.ServerOpts.EnablePriorityClass { @@ -520,25 +473,13 @@ func (sc *SchedulerCache) Evict(taskInfo *schedulingapi.TaskInfo, reason string) } }() - if job.PodGroup.Version == schedulingapi.PodGroupVersionV1Alpha1 { - podgroup := &v1alpha1.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&job.PodGroup.PodGroup, podgroup, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) - return err - } - sc.Recorder.Eventf(podgroup, v1.EventTypeNormal, "Evict", reason) - return nil - } - - if job.PodGroup.Version == schedulingapi.PodGroupVersionV1Alpha2 { - podgroup := &v1alpha2.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&job.PodGroup.PodGroup, podgroup, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha2.PodGroup with error: %v", err) - return err - } - sc.Recorder.Eventf(podgroup, v1.EventTypeNormal, "Evict", reason) - return nil + podgroup := &vcv1beta1.PodGroup{} + if err := schedulingscheme.Scheme.Convert(&job.PodGroup.PodGroup, podgroup, nil); err != nil { + klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) + return err } + sc.Recorder.Eventf(podgroup, v1.EventTypeNormal, "Evict", reason) + return nil return fmt.Errorf("Invalid PodGroup Version: %s", job.PodGroup.Version) } @@ -876,25 +817,13 @@ func (sc *SchedulerCache) recordPodGroupEvent(podGroup *schedulingapi.PodGroup, return } - if podGroup.Version == schedulingapi.PodGroupVersionV1Alpha1 { - pg := &v1alpha1.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&podGroup.PodGroup, pg, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) - return - } - - sc.Recorder.Eventf(pg, eventType, reason, msg) + pg := &vcv1beta1.PodGroup{} + if err := schedulingscheme.Scheme.Convert(&podGroup.PodGroup, pg, nil); err != nil { + klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err) + return } - if podGroup.Version == schedulingapi.PodGroupVersionV1Alpha2 { - pg := &v1alpha2.PodGroup{} - if err := schedulingscheme.Scheme.Convert(&podGroup.PodGroup, pg, nil); err != nil { - klog.Errorf("Error while converting PodGroup to v1alpha2.PodGroup with error: %v", err) - return - } - - sc.Recorder.Eventf(pg, eventType, reason, msg) - } + sc.Recorder.Eventf(pg, eventType, reason, msg) return } diff --git a/pkg/scheduler/cache/event_handlers.go b/pkg/scheduler/cache/event_handlers.go index 3880b56fcd..924b3cabd4 100644 --- a/pkg/scheduler/cache/event_handlers.go +++ b/pkg/scheduler/cache/event_handlers.go @@ -28,8 +28,7 @@ import ( "volcano.sh/volcano/pkg/apis/scheduling" "volcano.sh/volcano/pkg/apis/scheduling/scheme" - schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/apis/utils" schedulingapi "volcano.sh/volcano/pkg/scheduler/api" ) @@ -393,8 +392,8 @@ func (sc *SchedulerCache) deletePodGroup(id schedulingapi.JobID) error { return nil } -// AddPodGroupV1alpha1 add podgroup to scheduler cache -func (sc *SchedulerCache) AddPodGroupV1alpha1(obj interface{}) { +// AddPodGroupV1beta1 add podgroup to scheduler cache +func (sc *SchedulerCache) AddPodGroupV1beta1(obj interface{}) { ss, ok := obj.(*schedulingv1.PodGroup) if !ok { klog.Errorf("Cannot convert to *schedulingv1.PodGroup: %v", obj) @@ -407,7 +406,7 @@ func (sc *SchedulerCache) AddPodGroupV1alpha1(obj interface{}) { return } - pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Alpha1} + pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Beta1} klog.V(4).Infof("Add PodGroup(%s) into cache, spec(%#v)", ss.Name, ss.Spec) sc.Mutex.Lock() @@ -421,35 +420,8 @@ func (sc *SchedulerCache) AddPodGroupV1alpha1(obj interface{}) { return } -// AddPodGroupV1alpha2 add podgroup to scheduler cache -func (sc *SchedulerCache) AddPodGroupV1alpha2(obj interface{}) { - ss, ok := obj.(*schedulingv2.PodGroup) - if !ok { - klog.Errorf("Cannot convert to *schedulingv2.PodGroup: %v", obj) - return - } - - podgroup := scheduling.PodGroup{} - if err := scheme.Scheme.Convert(ss, &podgroup, nil); err != nil { - klog.Errorf("Failed to convert podgroup from %T to %T", ss, podgroup) - return - } - - pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Alpha2} - klog.V(4).Infof("Add PodGroup(%s) into cache, spec(%#v)", ss.Name, ss.Spec) - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - - if err := sc.setPodGroup(pg); err != nil { - klog.Errorf("Failed to add PodGroup %s into cache: %v", ss.Name, err) - return - } - return -} - -// UpdatePodGroupV1alpha1 add podgroup to scheduler cache -func (sc *SchedulerCache) UpdatePodGroupV1alpha1(oldObj, newObj interface{}) { +// UpdatePodGroupV1beta1 add podgroup to scheduler cache +func (sc *SchedulerCache) UpdatePodGroupV1beta1(oldObj, newObj interface{}) { oldSS, ok := oldObj.(*schedulingv1.PodGroup) if !ok { klog.Errorf("Cannot convert oldObj to *schedulingv1.SchedulingSpec: %v", oldObj) @@ -471,7 +443,7 @@ func (sc *SchedulerCache) UpdatePodGroupV1alpha1(oldObj, newObj interface{}) { return } - pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Alpha1} + pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Beta1} sc.Mutex.Lock() defer sc.Mutex.Unlock() @@ -483,42 +455,8 @@ func (sc *SchedulerCache) UpdatePodGroupV1alpha1(oldObj, newObj interface{}) { return } -// UpdatePodGroupV1alpha2 add podgroup to scheduler cache -func (sc *SchedulerCache) UpdatePodGroupV1alpha2(oldObj, newObj interface{}) { - oldSS, ok := oldObj.(*schedulingv2.PodGroup) - if !ok { - klog.Errorf("Cannot convert oldObj to *schedulingv2.SchedulingSpec: %v", oldObj) - return - } - newSS, ok := newObj.(*schedulingv2.PodGroup) - if !ok { - klog.Errorf("Cannot convert newObj to *schedulingv2.SchedulingSpec: %v", newObj) - return - } - - if oldSS.ResourceVersion == newSS.ResourceVersion { - return - } - - podgroup := scheduling.PodGroup{} - if err := scheme.Scheme.Convert(newSS, &podgroup, nil); err != nil { - klog.Errorf("Failed to convert podgroup from %T to %T", newSS, podgroup) - return - } - - pg := &schedulingapi.PodGroup{podgroup, schedulingapi.PodGroupVersionV1Alpha2} - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - - if err := sc.updatePodGroup(pg); err != nil { - klog.Errorf("Failed to update podgroup %s into cache: %v", pg.Name, err) - return - } -} - -// DeletePodGroupV1alpha1 delete podgroup from scheduler cache -func (sc *SchedulerCache) DeletePodGroupV1alpha1(obj interface{}) { +// DeletePodGroupV1beta1 delete podgroup from scheduler cache +func (sc *SchedulerCache) DeletePodGroupV1beta1(obj interface{}) { var ss *schedulingv1.PodGroup switch t := obj.(type) { case *schedulingv1.PodGroup: @@ -547,39 +485,8 @@ func (sc *SchedulerCache) DeletePodGroupV1alpha1(obj interface{}) { return } -// DeletePodGroupV1alpha2 delete podgroup from scheduler cache -func (sc *SchedulerCache) DeletePodGroupV1alpha2(obj interface{}) { - var ss *schedulingv2.PodGroup - switch t := obj.(type) { - case *schedulingv2.PodGroup: - ss = t - case cache.DeletedFinalStateUnknown: - var ok bool - ss, ok = t.Obj.(*schedulingv2.PodGroup) - if !ok { - klog.Errorf("Cannot convert to *schedulingv2.PodGroup: %v", t.Obj) - return - } - default: - klog.Errorf("Cannot convert to *schedulingv2.PodGroup: %v", t) - return - } - - jobID := schedulingapi.JobID(fmt.Sprintf("%s/%s", ss.Namespace, ss.Name)) - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - - if err := sc.deletePodGroup(jobID); err != nil { - klog.Errorf("Failed to delete podgroup %s from cache: %v", ss.Name, err) - return - } - - return -} - -// AddQueueV1alpha1 add queue to scheduler cache -func (sc *SchedulerCache) AddQueueV1alpha1(obj interface{}) { +// AddQueueV1beta1 add queue to scheduler cache +func (sc *SchedulerCache) AddQueueV1beta1(obj interface{}) { ss, ok := obj.(*schedulingv1.Queue) if !ok { klog.Errorf("Cannot convert to *schedulingv1.Queue: %v", obj) @@ -601,31 +508,8 @@ func (sc *SchedulerCache) AddQueueV1alpha1(obj interface{}) { return } -// AddQueueV1alpha2 add queue to scheduler cache -func (sc *SchedulerCache) AddQueueV1alpha2(obj interface{}) { - ss, ok := obj.(*schedulingv2.Queue) - if !ok { - klog.Errorf("Cannot convert to *schedulingv2.Queue: %v", obj) - return - } - - queue := &scheduling.Queue{} - if err := scheme.Scheme.Convert(ss, queue, nil); err != nil { - klog.Errorf("Failed to convert queue from %T to %T", ss, queue) - return - } - - klog.V(4).Infof("Add Queue(%s) into cache, spec(%#v)", ss.Name, ss.Spec) - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - sc.addQueue(queue) - - return -} - -// UpdateQueueV1alpha1 update queue to scheduler cache -func (sc *SchedulerCache) UpdateQueueV1alpha1(oldObj, newObj interface{}) { +// UpdateQueueV1beta1 update queue to scheduler cache +func (sc *SchedulerCache) UpdateQueueV1beta1(oldObj, newObj interface{}) { oldSS, ok := oldObj.(*schedulingv1.Queue) if !ok { klog.Errorf("Cannot convert oldObj to *schedulingv1.Queue: %v", oldObj) @@ -654,38 +538,8 @@ func (sc *SchedulerCache) UpdateQueueV1alpha1(oldObj, newObj interface{}) { return } -// UpdateQueueV1alpha2 update queue to scheduler cache -func (sc *SchedulerCache) UpdateQueueV1alpha2(oldObj, newObj interface{}) { - oldSS, ok := oldObj.(*schedulingv2.Queue) - if !ok { - klog.Errorf("Cannot convert oldObj to *schedulingv2.Queue: %v", oldObj) - return - } - newSS, ok := newObj.(*schedulingv2.Queue) - if !ok { - klog.Errorf("Cannot convert newObj to *schedulingv2.Queue: %v", newObj) - return - } - - if oldSS.ResourceVersion == newSS.ResourceVersion { - return - } - - newQueue := &scheduling.Queue{} - if err := scheme.Scheme.Convert(newSS, newQueue, nil); err != nil { - klog.Errorf("Failed to convert queue from %T to %T", newSS, newQueue) - return - } - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - sc.updateQueue(newQueue) - - return -} - -// DeleteQueueV1alpha1 delete queue from the scheduler cache -func (sc *SchedulerCache) DeleteQueueV1alpha1(obj interface{}) { +// DeleteQueueV1beta1 delete queue from the scheduler cache +func (sc *SchedulerCache) DeleteQueueV1beta1(obj interface{}) { var ss *schedulingv1.Queue switch t := obj.(type) { case *schedulingv1.Queue: @@ -709,31 +563,6 @@ func (sc *SchedulerCache) DeleteQueueV1alpha1(obj interface{}) { return } -// DeleteQueueV1alpha2 delete queue from the scheduler cache -func (sc *SchedulerCache) DeleteQueueV1alpha2(obj interface{}) { - var ss *schedulingv2.Queue - switch t := obj.(type) { - case *schedulingv2.Queue: - ss = t - case cache.DeletedFinalStateUnknown: - var ok bool - ss, ok = t.Obj.(*schedulingv2.Queue) - if !ok { - klog.Errorf("Cannot convert to *schedulingv2.Queue: %v", t.Obj) - return - } - default: - klog.Errorf("Cannot convert to *schedulingv1.Queue: %v", t) - return - } - - sc.Mutex.Lock() - defer sc.Mutex.Unlock() - sc.deleteQueue(schedulingapi.QueueID(ss.Name)) - - return -} - func (sc *SchedulerCache) addQueue(queue *scheduling.Queue) { qi := schedulingapi.NewQueueInfo(queue) sc.Queues[qi.UID] = qi diff --git a/pkg/scheduler/cache/event_handlers_test.go b/pkg/scheduler/cache/event_handlers_test.go index a50c29c682..6901c3f33a 100644 --- a/pkg/scheduler/cache/event_handlers_test.go +++ b/pkg/scheduler/cache/event_handlers_test.go @@ -26,8 +26,7 @@ import ( "k8s.io/client-go/util/workqueue" "volcano.sh/volcano/pkg/apis/scheduling" - schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" ) @@ -181,7 +180,7 @@ func TestSchedulerCache_AddPodGroupV1alpha1(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ + PodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -218,7 +217,7 @@ func TestSchedulerCache_AddPodGroupV1alpha1(t *testing.T) { } cache.AddPod(test.Pod) - cache.AddPodGroupV1alpha1(test.PodGroup) + cache.AddPodGroupV1beta1(test.PodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -247,7 +246,7 @@ func TestSchedulerCache_AddPodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ + PodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -282,8 +281,8 @@ func TestSchedulerCache_AddPodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ - Status: schedulingv2.PodGroupStatus{ + PodGroup: &schedulingv1.PodGroup{ + Status: schedulingv1.PodGroupStatus{ Running: int32(1), }, }, @@ -305,7 +304,7 @@ func TestSchedulerCache_AddPodGroupAlpha2(t *testing.T) { } cache.AddPod(test.Pod) - cache.AddPodGroupV1alpha2(test.PodGroup) + cache.AddPodGroupV1beta1(test.PodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -362,7 +361,7 @@ func TestSchedulerCache_UpdatePodGroupV1alpha1(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - OldPodGroup: &schedulingv2.PodGroup{ + OldPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -407,7 +406,7 @@ func TestSchedulerCache_UpdatePodGroupV1alpha1(t *testing.T) { Namespace: namespace, }, }, - NewPodGroup: &schedulingv2.PodGroup{ + NewPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1-updated", Namespace: namespace, @@ -431,7 +430,7 @@ func TestSchedulerCache_UpdatePodGroupV1alpha1(t *testing.T) { } cache.AddPod(test.Pod) - cache.UpdatePodGroupV1alpha1(test.OldPodGroup, test.NewPodGroup) + cache.UpdateQueueV1beta1(test.OldPodGroup, test.NewPodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -461,13 +460,13 @@ func TestSchedulerCache_UpdatePodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - OldPodGroup: &schedulingv2.PodGroup{ + OldPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, }, }, - NewPodGroup: &schedulingv2.PodGroup{ + NewPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1-updated", Namespace: namespace, @@ -494,7 +493,7 @@ func TestSchedulerCache_UpdatePodGroupAlpha2(t *testing.T) { Namespace: namespace, }, }, - NewPodGroup: &schedulingv2.PodGroup{ + NewPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1-updated", Namespace: namespace, @@ -508,12 +507,12 @@ func TestSchedulerCache_UpdatePodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - NewPodGroup: &schedulingv2.PodGroup{ - Status: schedulingv2.PodGroupStatus{ + NewPodGroup: &schedulingv1.PodGroup{ + Status: schedulingv1.PodGroupStatus{ Running: int32(1), }, }, - OldPodGroup: &schedulingv2.PodGroup{ + OldPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1-updated", Namespace: namespace, @@ -527,7 +526,7 @@ func TestSchedulerCache_UpdatePodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - OldPodGroup: &schedulingv2.PodGroup{ + OldPodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -557,7 +556,7 @@ func TestSchedulerCache_UpdatePodGroupAlpha2(t *testing.T) { } cache.AddPod(test.Pod) - cache.UpdatePodGroupV1alpha2(test.OldPodGroup, test.NewPodGroup) + cache.UpdatePodGroupV1beta1(test.OldPodGroup, test.NewPodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -600,7 +599,7 @@ func TestSchedulerCache_DeletePodGroupAlpha1(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ + PodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -652,9 +651,9 @@ func TestSchedulerCache_DeletePodGroupAlpha1(t *testing.T) { } cache.AddPod(test.Pod) - cache.AddPodGroupV1alpha1(test.PodGroup) + cache.AddPodGroupV1beta1(test.PodGroup) - cache.DeletePodGroupV1alpha1(test.PodGroup) + cache.DeletePodGroupV1beta1(test.PodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -682,7 +681,7 @@ func TestSchedulerCache_DeletePodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ + PodGroup: &schedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "j1", Namespace: namespace, @@ -717,8 +716,8 @@ func TestSchedulerCache_DeletePodGroupAlpha2(t *testing.T) { Nodes: []*v1.Node{ buildNode("n1", buildResourceList("2000m", "10G")), }, - PodGroup: &schedulingv2.PodGroup{ - Status: schedulingv2.PodGroupStatus{ + PodGroup: &schedulingv1.PodGroup{ + Status: schedulingv1.PodGroupStatus{ Running: int32(1), }, }, @@ -748,9 +747,9 @@ func TestSchedulerCache_DeletePodGroupAlpha2(t *testing.T) { } cache.AddPod(test.Pod) - cache.AddPodGroupV1alpha2(test.PodGroup) + cache.AddPodGroupV1beta1(test.PodGroup) - cache.DeletePodGroupV1alpha2(test.PodGroup) + cache.DeletePodGroupV1beta1(test.PodGroup) jobID := api.JobID("test/j1") job := cache.Jobs[jobID] @@ -786,7 +785,7 @@ func TestSchedulerCache_AddQueueV1alpha1(t *testing.T) { }, { Name: "Error Case: 1 - Wrong Type", - Queue: &schedulingv2.Queue{ + Queue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -802,7 +801,7 @@ func TestSchedulerCache_AddQueueV1alpha1(t *testing.T) { Nodes: make(map[string]*api.NodeInfo), Queues: make(map[api.QueueID]*api.QueueInfo)} - cache.AddQueueV1alpha1(test.Queue) + cache.AddQueueV1beta1(test.Queue) queue := cache.Queues["q1"] @@ -822,7 +821,7 @@ func TestSchedulerCache_AddQueueV1alpha2(t *testing.T) { }{ { Name: "Success Case", - Queue: &schedulingv2.Queue{ + Queue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -854,7 +853,7 @@ func TestSchedulerCache_AddQueueV1alpha2(t *testing.T) { Queues: make(map[api.QueueID]*api.QueueInfo), } - cache.AddQueueV1alpha2(test.Queue) + cache.AddQueueV1beta1(test.Queue) queue := cache.Queues["q1"] @@ -896,7 +895,7 @@ func TestSchedulerCache_UpdateQueueV1alpha1(t *testing.T) { }, { Name: "Error Case: 1 - Wrong Type(OldQueue)", - OldQueue: &schedulingv2.Queue{ + OldQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -918,7 +917,7 @@ func TestSchedulerCache_UpdateQueueV1alpha1(t *testing.T) { Namespace: namespace, }, }, - NewQueue: &schedulingv2.Queue{ + NewQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1-updated", Namespace: namespace, @@ -935,7 +934,7 @@ func TestSchedulerCache_UpdateQueueV1alpha1(t *testing.T) { Queues: make(map[api.QueueID]*api.QueueInfo), } - cache.UpdateQueueV1alpha1(test.OldQueue, test.NewQueue) + cache.UpdateQueueV1beta1(test.OldQueue, test.NewQueue) queue := cache.Queues["q1-updated"] @@ -956,13 +955,13 @@ func TestSchedulerCache_UpdateQueueV1alpha2(t *testing.T) { }{ { Name: "Success Case", - OldQueue: &schedulingv2.Queue{ + OldQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, }, }, - NewQueue: &schedulingv2.Queue{ + NewQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1-updated", Namespace: namespace, @@ -983,7 +982,7 @@ func TestSchedulerCache_UpdateQueueV1alpha2(t *testing.T) { Namespace: namespace, }, }, - NewQueue: &schedulingv2.Queue{ + NewQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1-updated", Namespace: namespace, @@ -993,7 +992,7 @@ func TestSchedulerCache_UpdateQueueV1alpha2(t *testing.T) { }, { Name: "Error Case: 2 - Wrong Type(NewQueue)", - OldQueue: &schedulingv2.Queue{ + OldQueue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -1016,7 +1015,7 @@ func TestSchedulerCache_UpdateQueueV1alpha2(t *testing.T) { Queues: make(map[api.QueueID]*api.QueueInfo), } - cache.UpdateQueueV1alpha2(test.OldQueue, test.NewQueue) + cache.UpdateQueueV1beta1(test.OldQueue, test.NewQueue) queue := cache.Queues["q1-updated"] @@ -1051,7 +1050,7 @@ func TestSchedulerCache_DeleteQueueV1alpha1(t *testing.T) { }, { Name: "Error Case: 1 - Wrong Type", - Queue: &schedulingv2.Queue{ + Queue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -1068,8 +1067,8 @@ func TestSchedulerCache_DeleteQueueV1alpha1(t *testing.T) { Queues: make(map[api.QueueID]*api.QueueInfo), } - cache.AddQueueV1alpha1(test.Queue) - cache.DeleteQueueV1alpha1(test.Queue) + cache.AddQueueV1beta1(test.Queue) + cache.DeleteQueueV1beta1(test.Queue) queue := cache.Queues["q1"] @@ -1093,7 +1092,7 @@ func TestSchedulerCache_DeleteQueueV1alpha2(t *testing.T) { }{ { Name: "Success Case", - Queue: &schedulingv2.Queue{ + Queue: &schedulingv1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "q1", Namespace: namespace, @@ -1125,8 +1124,8 @@ func TestSchedulerCache_DeleteQueueV1alpha2(t *testing.T) { Queues: make(map[api.QueueID]*api.QueueInfo), } - cache.AddQueueV1alpha2(test.Queue) - cache.DeleteQueueV1alpha2(test.Queue) + cache.AddQueueV1beta1(test.Queue) + cache.DeleteQueueV1beta1(test.Queue) queue := cache.Queues["q1"] diff --git a/pkg/scheduler/plugins/binpack/binpack_test.go b/pkg/scheduler/plugins/binpack/binpack_test.go index bcc80767ba..5bd9b4e8db 100644 --- a/pkg/scheduler/plugins/binpack/binpack_test.go +++ b/pkg/scheduler/plugins/binpack/binpack_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" - schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" + schedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" "volcano.sh/volcano/pkg/scheduler/cache" "volcano.sh/volcano/pkg/scheduler/conf" @@ -252,10 +252,10 @@ func TestNode(t *testing.T) { schedulerCache.AddPod(pod) } for _, ss := range test.podGroups { - schedulerCache.AddPodGroupV1alpha1(ss) + schedulerCache.AddPodGroupV1beta1(ss) } for _, q := range test.queues { - schedulerCache.AddQueueV1alpha1(q) + schedulerCache.AddQueueV1beta1(q) } trueValue := true diff --git a/pkg/scheduler/plugins/gang/gang.go b/pkg/scheduler/plugins/gang/gang.go index 9dda466ed5..d3e7071471 100644 --- a/pkg/scheduler/plugins/gang/gang.go +++ b/pkg/scheduler/plugins/gang/gang.go @@ -24,8 +24,7 @@ import ( "k8s.io/klog" "volcano.sh/volcano/pkg/apis/scheduling" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" "volcano.sh/volcano/pkg/scheduler/framework" "volcano.sh/volcano/pkg/scheduler/metrics" @@ -62,7 +61,7 @@ func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) { if vtn < job.MinAvailable { return &api.ValidateResult{ Pass: false, - Reason: v1alpha1.NotEnoughPodsReason, + Reason: v1beta1.NotEnoughPodsReason, Message: fmt.Sprintf("Not enough valid tasks for gang-scheduling, valid: %d, min: %d", vtn, job.MinAvailable), } @@ -152,7 +151,7 @@ func (gp *gangPlugin) OnSessionClose(ssn *framework.Session) { Status: v1.ConditionTrue, LastTransitionTime: metav1.Now(), TransitionID: string(ssn.UID), - Reason: v1alpha2.NotEnoughResourcesReason, + Reason: v1beta1.NotEnoughResourcesReason, Message: msg, } diff --git a/pkg/scheduler/util/test_utils.go b/pkg/scheduler/util/test_utils.go index 6a14189d77..b393010f64 100644 --- a/pkg/scheduler/util/test_utils.go +++ b/pkg/scheduler/util/test_utils.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/scheduler/api" ) @@ -71,7 +71,7 @@ func BuildPod(namespace, name, nodename string, p v1.PodPhase, req v1.ResourceLi Namespace: namespace, Labels: labels, Annotations: map[string]string{ - schedulingv2.GroupNameAnnotationKey: groupName, + schedulingv2.KubeGroupNameAnnotationKey: groupName, }, }, Status: v1.PodStatus{ diff --git a/pkg/webhooks/admission/jobs/validate/admit_job.go b/pkg/webhooks/admission/jobs/validate/admit_job.go index 7291efd6e7..b9f38baa2a 100644 --- a/pkg/webhooks/admission/jobs/validate/admit_job.go +++ b/pkg/webhooks/admission/jobs/validate/admit_job.go @@ -32,7 +32,7 @@ import ( k8scorevalid "k8s.io/kubernetes/pkg/apis/core/validation" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/controllers/job/plugins" "volcano.sh/volcano/pkg/webhooks/router" "volcano.sh/volcano/pkg/webhooks/schema" @@ -178,14 +178,14 @@ func validateJob(job *v1alpha1.Job, reviewResponse *v1beta1.AdmissionResponse) s } // Check whether Queue already present or not - queue, err := config.VolcanoClient.SchedulingV1alpha2().Queues().Get(job.Spec.Queue, metav1.GetOptions{}) + queue, err := config.VolcanoClient.SchedulingV1beta1().Queues().Get(job.Spec.Queue, metav1.GetOptions{}) if err != nil { // TODO: deprecate v1alpha1 - if _, err := config.VolcanoClient.SchedulingV1alpha1().Queues().Get(job.Spec.Queue, metav1.GetOptions{}); err != nil { + if _, err := config.VolcanoClient.SchedulingV1beta1().Queues().Get(job.Spec.Queue, metav1.GetOptions{}); err != nil { msg = msg + fmt.Sprintf(" unable to find job queue: %v", err) } } else { - if queue.Status.State != schedulingv1alpha2.QueueStateOpen { + if queue.Status.State != schedulingv1beta1.QueueStateOpen { msg = msg + fmt.Sprintf("can only submit job to queue with state `Open`, "+ "queue `%s` status is `%s`", queue.Name, queue.Spec.State) } diff --git a/pkg/webhooks/admission/jobs/validate/admit_job_test.go b/pkg/webhooks/admission/jobs/validate/admit_job_test.go index 19dab14d1c..90679ff606 100644 --- a/pkg/webhooks/admission/jobs/validate/admit_job_test.go +++ b/pkg/webhooks/admission/jobs/validate/admit_job_test.go @@ -26,7 +26,7 @@ import ( "volcano.sh/volcano/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - schedulingv1aplha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta2 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" fakeclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" ) @@ -1038,22 +1038,22 @@ func TestValidateExecution(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.Name, func(t *testing.T) { - defaultqueue := schedulingv1aplha2.Queue{ + defaultqueue := schedulingv1beta2.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "default", }, - Spec: schedulingv1aplha2.QueueSpec{ + Spec: schedulingv1beta2.QueueSpec{ Weight: 1, }, - Status: schedulingv1aplha2.QueueStatus{ - State: schedulingv1aplha2.QueueStateOpen, + Status: schedulingv1beta2.QueueStatus{ + State: schedulingv1beta2.QueueStateOpen, }, } // create fake volcano clientset config.VolcanoClient = fakeclient.NewSimpleClientset() //create default queue - _, err := config.VolcanoClient.SchedulingV1alpha2().Queues().Create(&defaultqueue) + _, err := config.VolcanoClient.SchedulingV1beta1().Queues().Create(&defaultqueue) if err != nil { t.Error("Queue Creation Failed") } diff --git a/pkg/webhooks/admission/pods/admit_pod.go b/pkg/webhooks/admission/pods/admit_pod.go index de3e14535a..c2120c211a 100644 --- a/pkg/webhooks/admission/pods/admit_pod.go +++ b/pkg/webhooks/admission/pods/admit_pod.go @@ -28,8 +28,7 @@ import ( "k8s.io/klog" "volcano.sh/volcano/pkg/apis/helpers" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + vcv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/webhooks/router" "volcano.sh/volcano/pkg/webhooks/schema" "volcano.sh/volcano/pkg/webhooks/util" @@ -107,7 +106,7 @@ func validatePod(pod *v1.Pod, reviewResponse *v1beta1.AdmissionResponse) string // vc-job, SN == volcano if pod.Annotations != nil { - pgName = pod.Annotations[v1alpha2.GroupNameAnnotationKey] + pgName = pod.Annotations[vcv1beta1.KubeGroupNameAnnotationKey] } if pgName != "" { if err := checkPGPhase(pod, pgName, true); err != nil { @@ -128,20 +127,20 @@ func validatePod(pod *v1.Pod, reviewResponse *v1beta1.AdmissionResponse) string } func checkPGPhase(pod *v1.Pod, pgName string, isVCJob bool) error { - pg, err := config.VolcanoClient.SchedulingV1alpha2().PodGroups(pod.Namespace).Get(pgName, metav1.GetOptions{}) + pg, err := config.VolcanoClient.SchedulingV1beta1().PodGroups(pod.Namespace).Get(pgName, metav1.GetOptions{}) if err != nil { - pg, err := config.VolcanoClient.SchedulingV1alpha1().PodGroups(pod.Namespace).Get(pgName, metav1.GetOptions{}) + pg, err := config.VolcanoClient.SchedulingV1beta1().PodGroups(pod.Namespace).Get(pgName, metav1.GetOptions{}) if err != nil { if isVCJob || (!isVCJob && !apierrors.IsNotFound(err)) { return fmt.Errorf("failed to get PodGroup for pod <%s/%s>: %v", pod.Namespace, pod.Name, err) } return nil } - if pg.Status.Phase != v1alpha1.PodGroupPending { + if pg.Status.Phase != vcv1beta1.PodGroupPending { return nil } } - if pg.Status.Phase != v1alpha2.PodGroupPending { + if pg.Status.Phase != vcv1beta1.PodGroupPending { return nil } return fmt.Errorf("failed to create pod <%s/%s> as the podgroup phase is Pending", diff --git a/pkg/webhooks/admission/pods/admit_pod_test.go b/pkg/webhooks/admission/pods/admit_pod_test.go index f71f0cf30f..ff8b49feb1 100644 --- a/pkg/webhooks/admission/pods/admit_pod_test.go +++ b/pkg/webhooks/admission/pods/admit_pod_test.go @@ -24,7 +24,7 @@ import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + vcschedulingv1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" ) @@ -98,7 +98,7 @@ func TestValidatePod(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, Name: "volcano-pod-1", - Annotations: map[string]string{v1alpha2.GroupNameAnnotationKey: pgName}, + Annotations: map[string]string{vcschedulingv1.KubeGroupNameAnnotationKey: pgName}, }, Spec: v1.PodSpec{ SchedulerName: "volcano", @@ -120,7 +120,7 @@ func TestValidatePod(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, Name: "volcano-pod-2", - Annotations: map[string]string{v1alpha2.GroupNameAnnotationKey: pgName}, + Annotations: map[string]string{vcschedulingv1.KubeGroupNameAnnotationKey: pgName}, }, Spec: v1.PodSpec{ SchedulerName: "volcano", @@ -136,16 +136,16 @@ func TestValidatePod(t *testing.T) { for _, testCase := range testCases { - pg := &v1alpha2.PodGroup{ + pg := &vcschedulingv1.PodGroup{ ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, Name: "podgroup-p1", }, - Spec: v1alpha2.PodGroupSpec{ + Spec: vcschedulingv1.PodGroupSpec{ MinMember: 1, }, - Status: v1alpha2.PodGroupStatus{ - Phase: v1alpha2.PodGroupPending, + Status: vcschedulingv1.PodGroupStatus{ + Phase: vcschedulingv1.PodGroupPending, }, } @@ -154,7 +154,7 @@ func TestValidatePod(t *testing.T) { config.SchedulerName = "volcano" if !testCase.disabledPG { - _, err := config.VolcanoClient.SchedulingV1alpha2().PodGroups(namespace).Create(pg) + _, err := config.VolcanoClient.SchedulingV1beta1().PodGroups(namespace).Create(pg) if err != nil { t.Error("PG Creation Failed") } diff --git a/pkg/webhooks/admission/queues/mutate/mutate_queue.go b/pkg/webhooks/admission/queues/mutate/mutate_queue.go index aa0ad8343e..f396018409 100644 --- a/pkg/webhooks/admission/queues/mutate/mutate_queue.go +++ b/pkg/webhooks/admission/queues/mutate/mutate_queue.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/webhooks/router" "volcano.sh/volcano/pkg/webhooks/schema" "volcano.sh/volcano/pkg/webhooks/util" @@ -46,8 +46,8 @@ var service = &router.AdmissionService{ { Operations: []whv1beta1.OperationType{whv1beta1.Create}, Rule: whv1beta1.Rule{ - APIGroups: []string{schedulingv1alpha2.SchemeGroupVersion.Group}, - APIVersions: []string{schedulingv1alpha2.SchemeGroupVersion.Version}, + APIGroups: []string{schedulingv1beta1.SchemeGroupVersion.Group}, + APIVersions: []string{schedulingv1beta1.SchemeGroupVersion.Version}, Resources: []string{"queues"}, }, }, @@ -97,13 +97,13 @@ func MutateQueues(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { } } -func createQueuePatch(queue *schedulingv1alpha2.Queue) ([]byte, error) { +func createQueuePatch(queue *schedulingv1beta1.Queue) ([]byte, error) { var patch []patchOperation patch = append(patch, patchOperation{ Op: "add", Path: "/spec/state", - Value: schedulingv1alpha2.QueueStateOpen, + Value: schedulingv1beta1.QueueStateOpen, }) trueValue := true diff --git a/pkg/webhooks/admission/queues/mutate/mutate_queue_test.go b/pkg/webhooks/admission/queues/mutate/mutate_queue_test.go index d158d809ac..42ba8cb82d 100644 --- a/pkg/webhooks/admission/queues/mutate/mutate_queue_test.go +++ b/pkg/webhooks/admission/queues/mutate/mutate_queue_test.go @@ -22,21 +22,21 @@ import ( "reflect" "testing" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - "volcano.sh/volcano/pkg/webhooks/util" - "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" + "volcano.sh/volcano/pkg/webhooks/util" ) func TestMutateQueues(t *testing.T) { trueValue := true - stateNotSetReclaimableNotSet := schedulingv1alpha2.Queue{ + stateNotSetReclaimableNotSet := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "normal-case-refresh-default-state", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, } @@ -46,13 +46,13 @@ func TestMutateQueues(t *testing.T) { t.Errorf("Marshal queue without state set failed for %v.", err) } - openStateReclaimableSet := schedulingv1alpha2.Queue{ + openStateReclaimableSet := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "normal-case-set-open", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, - State: schedulingv1alpha2.QueueStateOpen, + State: schedulingv1beta1.QueueStateOpen, Reclaimable: &trueValue, }, } @@ -68,7 +68,7 @@ func TestMutateQueues(t *testing.T) { refreshPatch = append(refreshPatch, patchOperation{ Op: "add", Path: "/spec/state", - Value: schedulingv1alpha2.QueueStateOpen, + Value: schedulingv1beta1.QueueStateOpen, }, patchOperation{ Op: "add", Path: "/spec/reclaimable", @@ -84,7 +84,7 @@ func TestMutateQueues(t *testing.T) { openStatePatch = append(openStatePatch, patchOperation{ Op: "add", Path: "/spec/state", - Value: schedulingv1alpha2.QueueStateOpen, + Value: schedulingv1beta1.QueueStateOpen, }) openStatePatchJSON, err := json.Marshal(openStatePatch) if err != nil { @@ -105,13 +105,13 @@ func TestMutateQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-refresh-default-state", @@ -136,13 +136,13 @@ func TestMutateQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-set-open", @@ -167,13 +167,13 @@ func TestMutateQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-set-open", diff --git a/pkg/webhooks/admission/queues/validate/validate_queue.go b/pkg/webhooks/admission/queues/validate/validate_queue.go index 44f4cdf47a..d775377dc8 100644 --- a/pkg/webhooks/admission/queues/validate/validate_queue.go +++ b/pkg/webhooks/admission/queues/validate/validate_queue.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/klog" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" "volcano.sh/volcano/pkg/webhooks/router" "volcano.sh/volcano/pkg/webhooks/schema" "volcano.sh/volcano/pkg/webhooks/util" @@ -48,8 +48,8 @@ var service = &router.AdmissionService{ { Operations: []whv1beta1.OperationType{whv1beta1.Create, whv1beta1.Update, whv1beta1.Delete}, Rule: whv1beta1.Rule{ - APIGroups: []string{schedulingv1alpha2.SchemeGroupVersion.Group}, - APIVersions: []string{schedulingv1alpha2.SchemeGroupVersion.Version}, + APIGroups: []string{schedulingv1beta1.SchemeGroupVersion.Group}, + APIVersions: []string{schedulingv1beta1.SchemeGroupVersion.Version}, Resources: []string{"queues"}, }, }, @@ -95,7 +95,7 @@ func AdmitQueues(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { } } -func validateQueue(queue *schedulingv1alpha2.Queue) error { +func validateQueue(queue *schedulingv1beta1.Queue) error { errs := field.ErrorList{} resourcePath := field.NewPath("requestBody") @@ -108,16 +108,16 @@ func validateQueue(queue *schedulingv1alpha2.Queue) error { return nil } -func validateStateOfQueue(value schedulingv1alpha2.QueueState, fldPath *field.Path) field.ErrorList { +func validateStateOfQueue(value schedulingv1beta1.QueueState, fldPath *field.Path) field.ErrorList { errs := field.ErrorList{} if len(value) == 0 { return errs } - validQueueStates := []schedulingv1alpha2.QueueState{ - schedulingv1alpha2.QueueStateOpen, - schedulingv1alpha2.QueueStateClosed, + validQueueStates := []schedulingv1beta1.QueueState{ + schedulingv1beta1.QueueStateOpen, + schedulingv1beta1.QueueStateClosed, } for _, validQueue := range validQueueStates { @@ -134,14 +134,14 @@ func validateQueueDeleting(queue string) error { return fmt.Errorf("`%s` queue can not be deleted", "default") } - q, err := config.VolcanoClient.SchedulingV1alpha2().Queues().Get(queue, metav1.GetOptions{}) + q, err := config.VolcanoClient.SchedulingV1beta1().Queues().Get(queue, metav1.GetOptions{}) if err != nil { return err } - if q.Status.State != schedulingv1alpha2.QueueStateClosed { + if q.Status.State != schedulingv1beta1.QueueStateClosed { return fmt.Errorf("only queue with state `%s` can be deleted, queue `%s` state is `%s`", - schedulingv1alpha2.QueueStateClosed, q.Name, q.Status.State) + schedulingv1beta1.QueueStateClosed, q.Name, q.Status.State) } return nil diff --git a/pkg/webhooks/admission/queues/validate/validate_queue_test.go b/pkg/webhooks/admission/queues/validate/validate_queue_test.go index a8b0fba79c..3d0eaad445 100644 --- a/pkg/webhooks/admission/queues/validate/validate_queue_test.go +++ b/pkg/webhooks/admission/queues/validate/validate_queue_test.go @@ -22,23 +22,23 @@ import ( "reflect" "testing" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" - fakeclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" - "volcano.sh/volcano/pkg/webhooks/util" - "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" + + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" + fakeclient "volcano.sh/volcano/pkg/client/clientset/versioned/fake" + "volcano.sh/volcano/pkg/webhooks/util" ) func TestAdmitQueues(t *testing.T) { - stateNotSet := schedulingv1alpha2.Queue{ + stateNotSet := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "normal-case-not-set", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, } @@ -48,13 +48,13 @@ func TestAdmitQueues(t *testing.T) { t.Errorf("Marshal queue without state set failed for %v.", err) } - openState := schedulingv1alpha2.Queue{ + openState := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "normal-case-set-open", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, - State: schedulingv1alpha2.QueueStateOpen, + State: schedulingv1beta1.QueueStateOpen, }, } @@ -63,13 +63,13 @@ func TestAdmitQueues(t *testing.T) { t.Errorf("Marshal queue with open state failed for %v.", err) } - closedState := schedulingv1alpha2.Queue{ + closedState := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "normal-case-set-closed", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, - State: schedulingv1alpha2.QueueStateClosed, + State: schedulingv1beta1.QueueStateClosed, }, } @@ -78,11 +78,11 @@ func TestAdmitQueues(t *testing.T) { t.Errorf("Marshal queue with closed state failed for %v.", err) } - wrongState := schedulingv1alpha2.Queue{ + wrongState := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "abnormal-case", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, State: "wrong", }, @@ -93,16 +93,16 @@ func TestAdmitQueues(t *testing.T) { t.Errorf("Marshal queue with wrong state failed for %v.", err) } - openStateForDelete := schedulingv1alpha2.Queue{ + openStateForDelete := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "open-state-for-delete", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, - State: schedulingv1alpha2.QueueStateOpen, + State: schedulingv1beta1.QueueStateOpen, }, - Status: schedulingv1alpha2.QueueStatus{ - State: schedulingv1alpha2.QueueStateOpen, + Status: schedulingv1beta1.QueueStatus{ + State: schedulingv1beta1.QueueStateOpen, }, } @@ -111,16 +111,16 @@ func TestAdmitQueues(t *testing.T) { t.Errorf("Marshal queue for delete with open state failed for %v.", err) } - closedStateForDelete := schedulingv1alpha2.Queue{ + closedStateForDelete := schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: "closed-state-for-delete", }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, - State: schedulingv1alpha2.QueueStateClosed, + State: schedulingv1beta1.QueueStateClosed, }, - Status: schedulingv1alpha2.QueueStatus{ - State: schedulingv1alpha2.QueueStateClosed, + Status: schedulingv1beta1.QueueStatus{ + State: schedulingv1beta1.QueueStateClosed, }, } @@ -130,21 +130,21 @@ func TestAdmitQueues(t *testing.T) { } config.VolcanoClient = fakeclient.NewSimpleClientset() - _, err = config.VolcanoClient.SchedulingV1alpha2().Queues().Create(&openStateForDelete) + _, err = config.VolcanoClient.SchedulingV1beta1().Queues().Create(&openStateForDelete) if err != nil { t.Errorf("Crate queue with open state failed for %v.", err) } - _, err = config.VolcanoClient.SchedulingV1alpha2().Queues().Create(&closedStateForDelete) + _, err = config.VolcanoClient.SchedulingV1beta1().Queues().Create(&closedStateForDelete) if err != nil { t.Errorf("Crate queue with closed state failed for %v.", err) } defer func() { - if err := config.VolcanoClient.SchedulingV1alpha2().Queues().Delete(openStateForDelete.Name, &v1.DeleteOptions{}); err != nil { + if err := config.VolcanoClient.SchedulingV1beta1().Queues().Delete(openStateForDelete.Name, &v1.DeleteOptions{}); err != nil { fmt.Println(fmt.Sprintf("Delete queue with open state failed for %v.", err)) } - if err := config.VolcanoClient.SchedulingV1alpha2().Queues().Delete(closedStateForDelete.Name, &v1.DeleteOptions{}); err != nil { + if err := config.VolcanoClient.SchedulingV1beta1().Queues().Delete(closedStateForDelete.Name, &v1.DeleteOptions{}); err != nil { fmt.Println(fmt.Sprintf("Delete queue with closed state failed for %v.", err)) } }() @@ -163,13 +163,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-not-set", @@ -192,13 +192,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-set-open", @@ -221,13 +221,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-set-closed", @@ -250,13 +250,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "abnormal-case", @@ -270,9 +270,9 @@ func TestAdmitQueues(t *testing.T) { Allowed: false, Result: &metav1.Status{ Message: field.Invalid(field.NewPath("requestBody").Child("spec").Child("state"), - "wrong", fmt.Sprintf("queue state must be in %v", []schedulingv1alpha2.QueueState{ - schedulingv1alpha2.QueueStateOpen, - schedulingv1alpha2.QueueStateClosed, + "wrong", fmt.Sprintf("queue state must be in %v", []schedulingv1beta1.QueueState{ + schedulingv1beta1.QueueStateOpen, + schedulingv1beta1.QueueStateClosed, })).Error(), }, }, @@ -286,13 +286,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-open-to-close-updating", @@ -318,13 +318,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "normal-case-closed-to-open-updating", @@ -350,13 +350,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "abnormal-case-open-to-wrong-state-updating", @@ -373,9 +373,9 @@ func TestAdmitQueues(t *testing.T) { Allowed: false, Result: &metav1.Status{ Message: field.Invalid(field.NewPath("requestBody").Child("spec").Child("state"), - "wrong", fmt.Sprintf("queue state must be in %v", []schedulingv1alpha2.QueueState{ - schedulingv1alpha2.QueueStateOpen, - schedulingv1alpha2.QueueStateClosed, + "wrong", fmt.Sprintf("queue state must be in %v", []schedulingv1beta1.QueueState{ + schedulingv1beta1.QueueStateOpen, + schedulingv1beta1.QueueStateClosed, })).Error(), }, }, @@ -389,13 +389,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "closed-state-for-delete", @@ -418,13 +418,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "open-state-for-delete", @@ -438,7 +438,7 @@ func TestAdmitQueues(t *testing.T) { Allowed: false, Result: &metav1.Status{ Message: fmt.Sprintf("only queue with state `%s` can be deleted, queue `%s` state is `%s`", - schedulingv1alpha2.QueueStateClosed, "open-state-for-delete", schedulingv1alpha2.QueueStateOpen), + schedulingv1beta1.QueueStateClosed, "open-state-for-delete", schedulingv1beta1.QueueStateOpen), }, }, }, @@ -451,13 +451,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "default", @@ -483,13 +483,13 @@ func TestAdmitQueues(t *testing.T) { }, Request: &v1beta1.AdmissionRequest{ Kind: metav1.GroupVersionKind{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Kind: "Queue", }, Resource: metav1.GroupVersionResource{ - Group: "scheduling.sigs.dev", - Version: "v1alpha2", + Group: "scheduling.volcano.sh", + Version: "v1beta1", Resource: "queues", }, Name: "default", diff --git a/pkg/webhooks/schema/schema.go b/pkg/webhooks/schema/schema.go index fac20113e8..2da938a760 100644 --- a/pkg/webhooks/schema/schema.go +++ b/pkg/webhooks/schema/schema.go @@ -28,7 +28,7 @@ import ( corev1 "k8s.io/kubernetes/pkg/apis/core/v1" batchv1alpha1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) func init() { @@ -86,10 +86,10 @@ func DecodePod(object runtime.RawExtension, resource metav1.GroupVersionResource } // DecodeQueue decodes the queue using deserializer from the raw object -func DecodeQueue(object runtime.RawExtension, resource metav1.GroupVersionResource) (*schedulingv1alpha2.Queue, error) { +func DecodeQueue(object runtime.RawExtension, resource metav1.GroupVersionResource) (*schedulingv1beta1.Queue, error) { queueResource := metav1.GroupVersionResource{ - Group: schedulingv1alpha2.SchemeGroupVersion.Group, - Version: schedulingv1alpha2.SchemeGroupVersion.Version, + Group: schedulingv1beta1.SchemeGroupVersion.Group, + Version: schedulingv1beta1.SchemeGroupVersion.Version, Resource: "queues", } @@ -97,7 +97,7 @@ func DecodeQueue(object runtime.RawExtension, resource metav1.GroupVersionResour return nil, fmt.Errorf("expect resource to be %s", queueResource) } - queue := schedulingv1alpha2.Queue{} + queue := schedulingv1beta1.Queue{} if _, _, err := Codecs.UniversalDeserializer().Decode(object.Raw, nil, &queue); err != nil { return nil, err } diff --git a/test/e2e/admission.go b/test/e2e/admission.go index 28ce91dfa0..de6fe327d3 100644 --- a/test/e2e/admission.go +++ b/test/e2e/admission.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" ) var _ = Describe("Job E2E Test: Test Admission service", func() { @@ -191,17 +191,17 @@ var _ = Describe("Job E2E Test: Test Admission service", func() { context := initTestContext(options{}) defer cleanupTestContext(context) - pg := &schedulingv1alpha2.PodGroup{ + pg := &schedulingv1beta1.PodGroup{ ObjectMeta: v1.ObjectMeta{ Namespace: namespace, Name: pgName, }, - Spec: schedulingv1alpha2.PodGroupSpec{ + Spec: schedulingv1beta1.PodGroupSpec{ MinMember: 1, MinResources: &thirtyCPU, }, - Status: schedulingv1alpha2.PodGroupStatus{ - Phase: schedulingv1alpha2.PodGroupPending, + Status: schedulingv1beta1.PodGroupStatus{ + Phase: schedulingv1beta1.PodGroupPending, }, } @@ -213,7 +213,7 @@ var _ = Describe("Job E2E Test: Test Admission service", func() { ObjectMeta: v1.ObjectMeta{ Namespace: namespace, Name: podName, - Annotations: map[string]string{schedulingv1alpha2.GroupNameAnnotationKey: pgName}, + Annotations: map[string]string{schedulingv1beta1.KubeGroupNameAnnotationKey: pgName}, }, Spec: corev1.PodSpec{ SchedulerName: "volcano", @@ -221,7 +221,7 @@ var _ = Describe("Job E2E Test: Test Admission service", func() { }, } - _, err := context.vcclient.SchedulingV1alpha2().PodGroups(namespace).Create(pg) + _, err := context.vcclient.SchedulingV1beta1().PodGroups(namespace).Create(pg) Expect(err).NotTo(HaveOccurred()) _, err = context.kubeclient.CoreV1().Pods(namespace).Create(pod) diff --git a/test/e2e/job_controlled_resource.go b/test/e2e/job_controlled_resource.go index 9f1d094eae..8c881cc338 100644 --- a/test/e2e/job_controlled_resource.go +++ b/test/e2e/job_controlled_resource.go @@ -177,7 +177,7 @@ var _ = Describe("Job E2E Test: Test Job PVCs", func() { err := waitJobStatePending(context, job) Expect(err).NotTo(HaveOccurred()) - pGroup, err := context.vcclient.SchedulingV1alpha2().PodGroups(namespace).Get(jobName, metav1.GetOptions{}) + pGroup, err := context.vcclient.SchedulingV1beta1().PodGroups(namespace).Get(jobName, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) for name, q := range *pGroup.Spec.MinResources { diff --git a/test/e2e/queue.go b/test/e2e/queue.go index dd7243b6e3..0c26ab0d4c 100644 --- a/test/e2e/queue.go +++ b/test/e2e/queue.go @@ -53,7 +53,7 @@ var _ = Describe("Queue E2E Test", func() { Expect(err).NotTo(HaveOccurred()) err = waitQueueStatus(func() (bool, error) { - queue, err := context.vcclient.SchedulingV1alpha2().Queues().Get(defaultQueue1, metav1.GetOptions{}) + queue, err := context.vcclient.SchedulingV1beta1().Queues().Get(defaultQueue1, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) return queue.Status.Running == 1, nil }) @@ -94,7 +94,7 @@ var _ = Describe("Queue E2E Test", func() { err = waitJobStatePending(context, job3) Expect(err).NotTo(HaveOccurred()) err = waitQueueStatus(func() (bool, error) { - queue, err := context.vcclient.SchedulingV1alpha2().Queues().Get(defaultQueue1, metav1.GetOptions{}) + queue, err := context.vcclient.SchedulingV1beta1().Queues().Get(defaultQueue1, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) return queue.Status.Pending == 1, nil }) diff --git a/test/e2e/util.go b/test/e2e/util.go index c9aa9313d3..ab1f7e816e 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -42,7 +42,7 @@ import ( api "k8s.io/kubernetes/pkg/apis/core" batchv1alpha1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - schedulingv1alpha2 "volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" + schedulingv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" vcclient "volcano.sh/volcano/pkg/client/clientset/versioned" schedulerapi "volcano.sh/volcano/pkg/scheduler/api" ) @@ -172,12 +172,12 @@ func namespaceNotExistWithName(ctx *context, name string) wait.ConditionFunc { func queueClosed(ctx *context, name string) wait.ConditionFunc { return func() (bool, error) { - queue, err := ctx.vcclient.SchedulingV1alpha2().Queues().Get(name, metav1.GetOptions{}) + queue, err := ctx.vcclient.SchedulingV1beta1().Queues().Get(name, metav1.GetOptions{}) if err != nil { return false, err } - if queue.Status.State != schedulingv1alpha2.QueueStateClosed { + if queue.Status.State != schedulingv1beta1.QueueStateClosed { return false, nil } @@ -212,11 +212,11 @@ func cleanupTestContext(ctx *context) { func createQueues(cxt *context) { for _, q := range cxt.queues { - _, err := cxt.vcclient.SchedulingV1alpha2().Queues().Create(&schedulingv1alpha2.Queue{ + _, err := cxt.vcclient.SchedulingV1beta1().Queues().Create(&schedulingv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: q, }, - Spec: schedulingv1alpha2.QueueSpec{ + Spec: schedulingv1beta1.QueueSpec{ Weight: 1, }, }) @@ -229,13 +229,13 @@ func deleteQueues(cxt *context) { foreground := metav1.DeletePropagationForeground for _, q := range cxt.queues { - patchBytes := []byte(fmt.Sprintf(`{"spec":{"state":"%s"}}`, schedulingv1alpha2.QueueStateClosed)) - _, err := cxt.vcclient.SchedulingV1alpha2().Queues().Patch(q, types.MergePatchType, patchBytes) + patchBytes := []byte(fmt.Sprintf(`{"spec":{"state":"%s"}}`, schedulingv1beta1.QueueStateClosed)) + _, err := cxt.vcclient.SchedulingV1beta1().Queues().Patch(q, types.MergePatchType, patchBytes) Expect(err).NotTo(HaveOccurred()) err = wait.Poll(100*time.Millisecond, oneMinute, queueClosed(cxt, q)) Expect(err).NotTo(HaveOccurred()) - err = cxt.vcclient.SchedulingV1alpha2().Queues().Delete(q, &metav1.DeleteOptions{ + err = cxt.vcclient.SchedulingV1beta1().Queues().Delete(q, &metav1.DeleteOptions{ PropagationPolicy: &foreground, }) @@ -460,7 +460,7 @@ func jobUnschedulable(ctx *context, job *batchv1alpha1.Job, now time.Time) error var additionalError error // TODO(k82cn): check Job's Condition instead of PodGroup's event. err := wait.Poll(10*time.Second, oneMinute, func() (bool, error) { - pg, err := ctx.vcclient.SchedulingV1alpha2().PodGroups(job.Namespace).Get(job.Name, metav1.GetOptions{}) + pg, err := ctx.vcclient.SchedulingV1beta1().PodGroups(job.Namespace).Get(job.Name, metav1.GetOptions{}) if err != nil { additionalError = fmt.Errorf("expected to have job's podgroup %s created, actual got error %s", job.Name, err.Error()) @@ -494,7 +494,7 @@ func jobUnschedulable(ctx *context, job *batchv1alpha1.Job, now time.Time) error func jobEvicted(ctx *context, job *batchv1alpha1.Job, time time.Time) wait.ConditionFunc { // TODO(k82cn): check Job's conditions instead of PodGroup's event. return func() (bool, error) { - pg, err := ctx.vcclient.SchedulingV1alpha2().PodGroups(job.Namespace).Get(job.Name, metav1.GetOptions{}) + pg, err := ctx.vcclient.SchedulingV1beta1().PodGroups(job.Namespace).Get(job.Name, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) events, err := ctx.kubeclient.CoreV1().Events(pg.Namespace).List(metav1.ListOptions{}) @@ -776,7 +776,7 @@ func waitJobCleanedUp(ctx *context, cleanupjob *batchv1alpha1.Job) error { return false, nil } - pg, err := ctx.vcclient.SchedulingV1alpha2().PodGroups(cleanupjob.Namespace).Get(cleanupjob.Name, metav1.GetOptions{}) + pg, err := ctx.vcclient.SchedulingV1beta1().PodGroups(cleanupjob.Namespace).Get(cleanupjob.Name, metav1.GetOptions{}) if err != nil && !errors.IsNotFound(err) { return false, nil } @@ -1165,7 +1165,7 @@ func waitPodPhase(ctx *context, pod *v1.Pod, phase []v1.PodPhase) error { } func pgIsReady(ctx *context, namespace string) (bool, error) { - pgs, err := ctx.vcclient.SchedulingV1alpha2().PodGroups(namespace).List(metav1.ListOptions{}) + pgs, err := ctx.vcclient.SchedulingV1beta1().PodGroups(namespace).List(metav1.ListOptions{}) if err != nil { return false, err } @@ -1174,7 +1174,7 @@ func pgIsReady(ctx *context, namespace string) (bool, error) { } for _, pg := range pgs.Items { - if pg.Status.Phase != schedulingv1alpha2.PodGroupPending { + if pg.Status.Phase != schedulingv1beta1.PodGroupPending { return true, nil } }