summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/library
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-10-11 13:14:27 -0400
committerKenny Woodson <kwoodson@redhat.com>2017-10-11 21:00:19 -0400
commit4526f5457d012bc14c16b844bebc3eaeaa8ff191 (patch)
tree8543cf441d2eaba83ee52d749c741faf560f7647 /roles/lib_openshift/library
parent2fb41eea9aa4b328d7da1c5e4b7de2e717549ed7 (diff)
downloadopenshift-4526f5457d012bc14c16b844bebc3eaeaa8ff191.tar.gz
openshift-4526f5457d012bc14c16b844bebc3eaeaa8ff191.tar.bz2
openshift-4526f5457d012bc14c16b844bebc3eaeaa8ff191.tar.xz
openshift-4526f5457d012bc14c16b844bebc3eaeaa8ff191.zip
Adding support for cluster-autoscaler role
Diffstat (limited to 'roles/lib_openshift/library')
-rw-r--r--roles/lib_openshift/library/oc_adm_policy_user.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/roles/lib_openshift/library/oc_adm_policy_user.py b/roles/lib_openshift/library/oc_adm_policy_user.py
index 1ceaf5d0d..92515889b 100644
--- a/roles/lib_openshift/library/oc_adm_policy_user.py
+++ b/roles/lib_openshift/library/oc_adm_policy_user.py
@@ -71,6 +71,12 @@ options:
required: false
default: None
aliases: []
+ role_namespace:
+ description:
+ - The namespace where to find the role
+ required: false
+ default: None
+ aliases: []
debug:
description:
- Turn on debug output.
@@ -122,6 +128,14 @@ EXAMPLES = '''
resource_kind: cluster-role
resource_name: system:build-strategy-docker
state: present
+
+- name: oc adm policy add-role-to-user system:build-strategy-docker ausername --role-namespace foo
+ oc_adm_policy_user:
+ user: ausername
+ resource_kind: cluster-role
+ resource_name: system:build-strategy-docker
+ state: present
+ role_namespace: foo
'''
# -*- -*- -*- End included fragment: doc/policy_user -*- -*- -*-
@@ -2065,6 +2079,9 @@ class PolicyUser(OpenShiftCLI):
self.config.config_options['name']['value'],
self.config.config_options['user']['value']]
+ if self.config.config_options['role_namespace']['value'] is not None:
+ cmd.extend(['--role-namespace', self.config.config_options['role_namespace']['value']])
+
return self.openshift_cmd(cmd, oadm=True)
@staticmethod
@@ -2085,6 +2102,7 @@ class PolicyUser(OpenShiftCLI):
'user': {'value': params['user'], 'include': False},
'resource_kind': {'value': params['resource_kind'], 'include': False},
'name': {'value': params['resource_name'], 'include': False},
+ 'role_namespace': {'value': params['role_namespace'], 'include': False},
})
policyuser = PolicyUser(nconfig, params['debug'])
@@ -2149,6 +2167,7 @@ def main():
debug=dict(default=False, type='bool'),
resource_name=dict(required=True, type='str'),
namespace=dict(default='default', type='str'),
+ role_namespace=dict(default=None, type='str'),
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
user=dict(required=True, type='str'),