Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/mas/devops/tekton.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ def updateTektonDefinitions(namespace: str, yamlFile: str) -> None:
logger.debug(line)


def preparePipelinesNamespace(dynClient: DynamicClient, instanceId: str = None, storageClass: str = None, accessMode: str = None, waitForBind: bool = True):
def preparePipelinesNamespace(dynClient: DynamicClient, instanceId: str = None, storageClass: str = None, accessMode: str = None, waitForBind: bool = True, configureRBAC: bool = True):
templateDir = path.join(path.abspath(path.dirname(__file__)), "templates")
env = Environment(
loader=FileSystemLoader(searchpath=templateDir)
)

if instanceId is None:
namespace = "mas-pipelines"
template = env.get_template("pipelines-rbac-cluster.yml.j2")
else:
namespace = f"mas-{instanceId}-pipelines"
template = env.get_template("pipelines-rbac.yml.j2")

# Create RBAC
renderedTemplate = template.render(mas_instance_id=instanceId)
logger.debug(renderedTemplate)
crb = yaml.safe_load(renderedTemplate)
clusterRoleBindingAPI = dynClient.resources.get(api_version="rbac.authorization.k8s.io/v1", kind="ClusterRoleBinding")
clusterRoleBindingAPI.apply(body=crb, namespace=namespace)
if configureRBAC:
# Create RBAC
renderedTemplate = template.render(mas_instance_id=instanceId)
logger.debug(renderedTemplate)
crb = yaml.safe_load(renderedTemplate)
clusterRoleBindingAPI = dynClient.resources.get(api_version="rbac.authorization.k8s.io/v1", kind="ClusterRoleBinding")
clusterRoleBindingAPI.apply(body=crb, namespace=namespace)

# Create PVC (instanceId namespace only)
if instanceId is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/mas/devops/templates/pipelinerun-install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
pipelineRef:
name: mas-install

serviceAccountName: pipeline
serviceAccountName: "{{ service_account_name | default('pipeline', True) }}"
timeouts:
pipeline: "0"

Expand Down
4 changes: 2 additions & 2 deletions src/mas/devops/templates/pipelinerun-uninstall.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
pipelineRef:
name: mas-uninstall

serviceAccountName: pipeline
serviceAccountName: "{{ service_account_name | default('pipeline', True) }}"
timeouts:
pipeline: "0"

Expand All @@ -34,4 +34,4 @@ spec:
value: {{ uds_action }}
- name: dro_namespace
value: {{ dro_namespace }}

2 changes: 1 addition & 1 deletion src/mas/devops/templates/pipelinerun-update.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
pipelineRef:
name: mas-update

serviceAccountName: pipeline
serviceAccountName: "{{ service_account_name | default('pipeline', True) }}"
timeouts:
pipeline: "0"

Expand Down
2 changes: 1 addition & 1 deletion src/mas/devops/templates/pipelinerun-upgrade.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
pipelineRef:
name: mas-upgrade

serviceAccountName: pipeline
serviceAccountName: "{{ service_account_name | default('pipeline', True) }}"
timeouts:
pipeline: "0"

Expand Down