Skip to content

Commit

Permalink
Make deployer IAM resource naming consistent (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
eshiroma authored Dec 3, 2019
1 parent c433b86 commit 22133f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions marketplace/deployer_util/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def make_deployer_rolebindings(schema, namespace, app_name, labels, sa_name):
'apiVersion': 'rbac.authorization.k8s.io/v1',
'kind': 'RoleBinding',
'metadata': {
'name': '{}:deployer-rb'.format(app_name),
'name': '{}-deployer-rb'.format(app_name),
'namespace': namespace,
'labels': labels,
},
Expand All @@ -410,7 +410,7 @@ def make_deployer_rolebindings(schema, namespace, app_name, labels, sa_name):
roles_and_rolebindings.append(default_rolebinding)

for i, rules in enumerate(deployer_service_account.custom_role_rules()):
role_name = '{}:deployer-r{}'.format(app_name, i)
role_name = '{}-deployer-r{}'.format(app_name, i)
roles_and_rolebindings.append({
'apiVersion': 'rbac.authorization.k8s.io/v1',
'kind': 'Role',
Expand All @@ -425,7 +425,7 @@ def make_deployer_rolebindings(schema, namespace, app_name, labels, sa_name):
'apiVersion': 'rbac.authorization.k8s.io/v1',
'kind': 'RoleBinding',
'metadata': {
'name': '{}:deployer-rb{}'.format(app_name, i),
'name': '{}-deployer-rb{}'.format(app_name, i),
'namespace': namespace,
'labels': labels,
},
Expand Down Expand Up @@ -467,7 +467,7 @@ def make_deployer_rolebindings(schema, namespace, app_name, labels, sa_name):
'apiVersion': 'rbac.authorization.k8s.io/v1',
'kind': 'RoleBinding',
'metadata': {
'name': limit_name('{}:{}:deployer-rb'.format(app_name, role), 64),
'name': limit_name('{}:{}-deployer-rb'.format(app_name, role), 64),
'namespace': namespace,
'labels': labels,
},
Expand Down
12 changes: 6 additions & 6 deletions marketplace/deployer_util/provision_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_make_deployer_rolebindings_no_roles(self):
'kind':
'RoleBinding',
'metadata': {
'name': 'app-name-1:deployer-rb',
'name': 'app-name-1-deployer-rb',
'namespace': 'namespace-1',
'labels': {
'some-key': 'some-value'
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_make_deployer_rolebindings_all_roles(self):
'kind':
'Role',
'metadata': {
'name': 'app-name-1:deployer-r0',
'name': 'app-name-1-deployer-r0',
'namespace': 'namespace-1',
'labels': {
'some-key': 'some-value'
Expand All @@ -194,7 +194,7 @@ def test_make_deployer_rolebindings_all_roles(self):
'kind':
'RoleBinding',
'metadata': {
'name': 'app-name-1:deployer-rb0',
'name': 'app-name-1-deployer-rb0',
'namespace': 'namespace-1',
'labels': {
'some-key': 'some-value'
Expand All @@ -203,7 +203,7 @@ def test_make_deployer_rolebindings_all_roles(self):
'roleRef': {
'apiGroup': 'rbac.authorization.k8s.io',
'kind': 'Role',
'name': 'app-name-1:deployer-r0',
'name': 'app-name-1-deployer-r0',
},
'subjects': [{
'kind': 'ServiceAccount',
Expand Down Expand Up @@ -256,7 +256,7 @@ def test_make_deployer_rolebindings_all_roles(self):
'kind':
'RoleBinding',
'metadata': {
'name': 'app-name-1:edit:deployer-rb',
'name': 'app-name-1:edit-deployer-rb',
'namespace': 'namespace-1',
'labels': {
'some-key': 'some-value'
Expand Down Expand Up @@ -332,7 +332,7 @@ def test_make_deployer_rolebindings_clusterrole_only(self):
'kind':
'RoleBinding',
'metadata': {
'name': 'app-name-1:deployer-rb',
'name': 'app-name-1-deployer-rb',
'namespace': 'namespace-1',
'labels': {
'some-key': 'some-value'
Expand Down

0 comments on commit 22133f0

Please sign in to comment.