Skip to content

Commit

Permalink
feature: add configurable rbac
Browse files Browse the repository at this point in the history
  • Loading branch information
domino-sbr1 committed Oct 7, 2024
1 parent ee96b8d commit b090994
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/unreleased/ENHANCEMENTS-491-20241002-142919.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: ENHANCEMENTS
body: '`Helm Chart`: Add the ability to configure the creation of the RBAC role and role binding.'
time: 2024-10-02T14:29:19.427979944Z
custom:
PR: "491"
1 change: 1 addition & 0 deletions charts/hcp-terraform-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ For a more detailed explanation, please refer to the [FAQ](../../docs/faq.md#gen
| operator.tfeAddress | string | `""` | The API URL of a Terraform Enterprise instance. |
| operator.watchedNamespaces | list | `[]` | List of namespaces the controllers should watch. |
| priorityClassName | string | `""` | Deployment priorityClassName. More information in [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/). |
| rbac.create | bool | `true` | Specifies whether a Role-Based Access Control (RBAC) resources should be created |
| replicaCount | int | `2` | The number of Operator replicas. |
| securityContext | object | `{"runAsNonRoot":true}` | Deployment pod security context. More information in [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). |
| serviceAccount.annotations | object | `{}` | Additional annotations for the ServiceAccount. |
Expand Down
4 changes: 3 additions & 1 deletion charts/hcp-terraform-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

---
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down Expand Up @@ -176,3 +177,4 @@ rules:
- subjectaccessreviews
verbs:
- create
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

---
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand All @@ -26,3 +27,4 @@ subjects:
- kind: ServiceAccount
name: {{ include "hcp-terraform-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
4 changes: 3 additions & 1 deletion charts/hcp-terraform-operator/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

---
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand Down Expand Up @@ -38,3 +39,4 @@ rules:
verbs:
- create
- patch
{{- end -}}
4 changes: 3 additions & 1 deletion charts/hcp-terraform-operator/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

---
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
Expand All @@ -14,3 +15,4 @@ subjects:
- kind: ServiceAccount
name: {{ include "hcp-terraform-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
4 changes: 4 additions & 0 deletions charts/hcp-terraform-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ serviceAccount:
# -- The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template.
name: ""

rbac:
# -- Specifies whether a Role-Based Access Control (RBAC) resources should be created
create: true

0 comments on commit b090994

Please sign in to comment.