Skip to content

Commit

Permalink
fix: allow using existing Role and RoleBinding resources (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
minijus authored Sep 20, 2024
1 parent 00703fd commit 172fc5e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/nx-agents/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: nx-agents
description: Nx Cloud Agents Helm Chart
type: application
version: 1.2.4
version: 1.2.5
maintainers:
- name: nx
url: "https://nx.app/"
Expand Down
6 changes: 5 additions & 1 deletion charts/nx-agents/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.roleBindings.controller.existingRoleBinding }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -14,6 +15,8 @@ subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccounts.controller.name }}
namespace: {{ .Values.global.namespace }}
{{- end }}
{{- if not .Values.roleBindings.runner.existingRoleBinding }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -29,4 +32,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccounts.runner.name }}
namespace: {{ .Values.global.namespace }}
namespace: {{ .Values.global.namespace }}
{{- end }}
6 changes: 5 additions & 1 deletion charts/nx-agents/templates/roles.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.roles.controller.existingRole }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down Expand Up @@ -60,6 +61,8 @@ rules:
- jobs/status
verbs:
- get
{{- end }}
{{- if not .Values.roles.runner.existingRole }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -73,4 +76,5 @@ rules:
- services
verbs:
- get
- list
- list
{{- end }}
16 changes: 16 additions & 0 deletions charts/nx-agents/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ serviceAccounts:
annotations: {}
imagePullSecrets: []

roles:
controller:
# when set to true, controller role will not be created and will use the existing role
existingRole: false
runner:
# when set to true, runner role will not be created and will use the existing role
existingRole: false

roleBindings:
controller:
# when set to true, controller role binding will not be created and will use the existing role binding
existingRoleBinding: false
runner:
# when set to true, runner role binding will not be created and will use the existing role binding
existingRoleBinding: false

# The controller is the main component of the workflow system. It is responsible for managing the state of workflows, starting
# new runs in your cluster, and managing the agents that run your workflows. It should be internally accessible from both
# your nx-api and frontend deployments in your application cluster. Within Nx, we accomplish this with a service of type
Expand Down

0 comments on commit 172fc5e

Please sign in to comment.