Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admission: Fall back to v1alpha1 podgroup when v1alpha2 doesnot exist #488

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/admission/admit_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"

"volcano.sh/volcano/pkg/apis/helpers"
"volcano.sh/volcano/pkg/apis/scheduling/v1alpha1"
"volcano.sh/volcano/pkg/apis/scheduling/v1alpha2"
)

Expand Down Expand Up @@ -123,10 +124,16 @@ func (c *Controller) validatePod(pod v1.Pod, reviewResponse *v1beta1.AdmissionRe
func (c *Controller) checkPGPhase(pod v1.Pod, pgName string, isVCJob bool) error {
pg, err := c.VcClients.SchedulingV1alpha2().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)
pg, err := c.VcClients.SchedulingV1alpha1().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 {
return nil
}
return nil
}
if pg.Status.Phase != v1alpha2.PodGroupPending {
return nil
Expand Down