Skip to content

Commit

Permalink
feat(queue): fix bug that volcano queue namespace is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
D0m021ng committed Jun 25, 2024
1 parent 62d3a3c commit 4817698
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/common/schema/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package schema
const (
StatusQueueCreating = "creating"
StatusQueueOpen = "open"
StatusQueueUpdating = "updating"
StatusQueueClosing = "closing"
StatusQueueClosed = "closed"
StatusQueueUnavailable = "unavailable"
Expand Down
21 changes: 20 additions & 1 deletion pkg/job/runtime_v2/queue/vcqueue/kube_vc_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func (vcq *KubeVCQueue) Create(ctx context.Context, q *api.QueueInfo) error {
vcQueue := &v1beta1.Queue{
ObjectMeta: metav1.ObjectMeta{
Name: q.Name,
Annotations: map[string]string{
pfschema.QueueNamespaceAnnotation: q.Namespace,
},
},
Spec: v1beta1.QueueSpec{
Capability: k8s.NewResourceList(q.MaxResources),
Expand Down Expand Up @@ -98,7 +101,7 @@ func (vcq *KubeVCQueue) Update(ctx context.Context, q *api.QueueInfo) error {
return err
}
vcQueue.Spec.Capability = k8s.NewResourceList(q.MaxResources)
vcQueue.Status.State = v1beta1.QueueState(q.Status)
vcQueue.Status.State = statusToVCQueueState(q.Status)
if vcQueue.Spec.Weight < 1 {
vcQueue.Spec.Weight = 1
}
Expand Down Expand Up @@ -216,6 +219,22 @@ func getVCQueueStatus(state v1beta1.QueueState) string {
return status
}

// statusToVCQueueState converts vc queue status to volcano queue state
func statusToVCQueueState(status string) v1beta1.QueueState {
state := v1beta1.QueueStateOpen
switch status {
case pfschema.StatusQueueOpen:
state = v1beta1.QueueStateOpen
case pfschema.StatusQueueClosing:
state = v1beta1.QueueStateClosing
case pfschema.StatusQueueClosed:
state = v1beta1.QueueStateClosed
case pfschema.StatusQueueUnavailable:
state = v1beta1.QueueStateUnknown
}
return state
}

func (vcq *KubeVCQueue) delete(obj interface{}) {
kuberuntime.QueueDeleteFunc(obj, vcq.workQueue)
}

0 comments on commit 4817698

Please sign in to comment.