Bug 1510076
| Summary: | Unable to allow a service-account permissions to delete ANY project | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Will Gordon <wgordon> |
| Component: | apiserver-auth | Assignee: | Simo Sorce <ssorce> |
| Status: | CLOSED NOTABUG | QA Contact: | Chuan Yu <chuyu> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | unspecified | CC: | aos-bugs, mkhan |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-11-06 18:51:56 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Will Gordon
2017-11-06 16:31:18 UTC
please provide the output of oc get serviceaccounts -o json {
"apiVersion": "v1",
"imagePullSecrets": [
{
"name": "delete-admin-dockercfg-553lq"
}
],
"kind": "ServiceAccount",
"metadata": {
"creationTimestamp": "2017-11-06T16:05:33Z",
"name": "delete-admin",
"namespace": "default",
"resourceVersion": "1512",
"selfLink": "/api/v1/namespaces/default/serviceaccounts/delete-admin",
"uid": "516d04f9-c30c-11e7-a08a-6abe92e081f3"
},
"secrets": [
{
"name": "delete-admin-dockercfg-553lq"
},
{
"name": "delete-admin-token-l1b05"
}
]
}
also not that the proper command to add delete-admin to the cluster role is not: oc adm add-cluster-role-to-user system:service:accounts:default:delete-admin but it is: oc adm policy add-cluster-role-to-user delete-projects -z delete-admin This does not allow me to delete a project either though. WOW, when was -z added?! That's awesome! The docs still recommend system:serviceaccount:<project>:<sa-name>. [1] https://docs.openshift.com/container-platform/3.6/dev_guide/service_accounts.html#dev-sa-user-names-and-groups You are logging in as the SA incorrectly. The correct way is: > oc login --token=$(oc sa get-token SA_NAME -n SA_NAMESPACE) This is clear from the error message: > Error from server (Forbidden): User "other-admin" cannot ... If you were logged in as the SA it would say: > Error from server (Forbidden): User "system:serviceaccount:SA_NAMESPACE:SA_NAME" cannot ... You can use `oc whoami` to tell what user you are logged in as. Ok I have also reproduced and using:
> oc login --token=$(oc sa get-token delete-admin -n default)
> oc delete project myproject
worked.
Closing NOTABUG
Thanks! That did the trick! |