Created
June 17, 2018 14:52
-
-
Save feloy/8734a6336c22428cf23161dd97dd55af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (o *k8s) canICreateDeployments() (bool, error) { | |
ssar := &authorizationv1.SelfSubjectAccessReview{ | |
Spec: authorizationv1.SelfSubjectAccessReviewSpec{ | |
ResourceAttributes: &authorizationv1.ResourceAttributes{ | |
Verb: "create", | |
Resource: "deployments", | |
}, | |
}, | |
} | |
ssar, err := o.clientset.AuthorizationV1().SelfSubjectAccessReviews().Create(ssar) | |
if err != nil { | |
return false, err | |
} | |
return ssar.Status.Allowed, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment