Skip to content

Commit

Permalink
Fix for ClusterRoleBinding without a 'subjects' field
Browse files Browse the repository at this point in the history
ClusterRoleBindings should have the field `subjects`. 
But it is possible to create ClusterRoleBinding wihtout `subjects` field such as the default ClusterRoleBinding `system:node` from kubeadm installlation or by Minikube.
The code didn't verified it the `subjects` field exist and therefore throw an exception.
The fix now verify the this field exist before checking it.
  • Loading branch information
g3rzi committed Jan 24, 2019
1 parent ba5b59c commit 5349e97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/api_client_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def list_cluster_role_binding(self):
role_ref = V1RoleRef(api_group=i['roleRef']['apiGroup'], name=i['roleRef']['name'], kind=i['roleRef']['kind'])
subjects = []

if i['subjects'] is not None:
if 'subjects' in i and i['subjects'] is not None:
for s in i['subjects']:
namespace = None
if 'namespace' in s.keys():
Expand Down

0 comments on commit 5349e97

Please sign in to comment.