{"action":"opened","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37595","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37595/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37595/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37595/events","html_url":"https://github.com/kubernetes/kubernetes/issues/37595","id":192167498,"number":37595,"title":"Need to delete related rolebinding/clusterrolebinding when the role/clusterrole removed","user":{"login":"xilabao","id":22786043,"avatar_url":"https://avatars.githubusercontent.com/u/22786043?v=3","gravatar_id":"","url":"https://api.github.com/users/xilabao","html_url":"https://github.com/xilabao","followers_url":"https://api.github.com/users/xilabao/followers","following_url":"https://api.github.com/users/xilabao/following{/other_user}","gists_url":"https://api.github.com/users/xilabao/gists{/gist_id}","starred_url":"https://api.github.com/users/xilabao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilabao/subscriptions","organizations_url":"https://api.github.com/users/xilabao/orgs","repos_url":"https://api.github.com/users/xilabao/repos","events_url":"https://api.github.com/users/xilabao/events{/privacy}","received_events_url":"https://api.github.com/users/xilabao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-29T01:54:42Z","updated_at":"2016-11-29T01:54:42Z","closed_at":null,"body":"rbac.yaml\r\n```\r\nkind: Role\r\napiVersion: rbac.authorization.k8s.io/v1alpha1\r\nmetadata:\r\n  name: admin-resource-role\r\n  namespace: default\r\nrules:\r\n- apiGroups: [\"*\"]\r\n  verbs: [\"*\"]\r\n  resources: [\"*\"]\r\n---\r\nkind: RoleBinding\r\napiVersion: rbac.authorization.k8s.io/v1alpha1\r\nmetadata:\r\n  name:  admin-resource-binding\r\n  namespace: default\r\nsubjects:\r\n  - kind: Group # May be \"User\", \"Group\" or \"ServiceAccount\"\r\n    name: test\r\nroleRef:\r\n  kind: Role\r\n  name: admin-resource-role\r\n```\r\nStep 1:`kubectl create rbac.yaml`\r\nStep 2:`kubectl delete role admin-resource-role`\r\nStep 3:`kubectl get rolebinding admin-resource-binding -o yaml`\r\n```\r\napiVersion: rbac.authorization.k8s.io/v1alpha1\r\nkind: RoleBinding\r\nmetadata:\r\n  creationTimestamp: 2016-11-29T04:30:22Z\r\n  name: admin-resource-binding\r\n  namespace: default\r\n  resourceVersion: \"64332\"\r\n  selfLink: /apis/rbac.authorization.k8s.io/v1alpha1/namespaces/default/rolebindings/admin-resource-binding\r\n  uid: 8a7035bc-b5ec-11e6-8c3a-525400f84377\r\nroleRef:\r\n  apiGroup: rbac.authorization.k8s.io\r\n  kind: Role\r\n  name: admin-resource-role\r\nsubjects:\r\n- kind: Group\r\n  name: test\r\n```\r\nThe result is admin-resource-binding still relate to a invalid role. when use group(test) to authorize, will return a internel error. And if recreate the role (admin-resource-role) with different rules, will auto related to the rolebinding, It doesn't seem to make sense."}}
{"actor":{"display_login":"xilabao"}}