tolerate missing subjectaccessreview in e2e

pull/6/head
deads2k 2016-12-22 14:03:57 -05:00
parent 89a506a9b5
commit 2444e0f270
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package framework
import (
"time"
apierrors "k8s.io/kubernetes/pkg/api/errors"
authorizationv1beta1 "k8s.io/kubernetes/pkg/apis/authorization/v1beta1"
v1beta1authorization "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authorization/v1beta1"
"k8s.io/kubernetes/pkg/runtime/schema"
@ -46,6 +47,12 @@ func WaitForAuthorizationUpdate(c v1beta1authorization.SubjectAccessReviewsGette
}
err := wait.Poll(policyCachePollInterval, policyCachePollTimeout, func() (bool, error) {
response, err := c.SubjectAccessReviews().Create(review)
// GKE doesn't enable the SAR endpoint. Without this endpoint, we cannot determine if the policy engine
// has adjusted as expected. In this case, simply wait one second and hope it's up to date
if apierrors.IsNotFound(err) {
time.Sleep(1 * time.Second)
return true, nil
}
if err != nil {
return false, err
}