Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove permissions for openshift only resources in helm chart #1356

Merged
merged 2 commits into from
Jan 13, 2024
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
1 change: 1 addition & 0 deletions deploy/helm/grafana-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ It's easier to just manage this configuration outside of the operator.
| image.repository | string | `"ghcr.io/grafana/grafana-operator"` | grafana operator image repository |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | image pull secrets |
| isOpenShift | bool | `false` | Determines if the target cluster is OpenShift. Additional rbac permissions for routes will be added on OpenShift |
| leaderElect | bool | `false` | If you want to run multiple replicas of the grafana-operator, this is not recommended. |
| metricsService.metricsPort | int | `9090` | metrics service port |
| metricsService.type | string | `"ClusterIP"` | metrics service type |
Expand Down
6 changes: 6 additions & 0 deletions deploy/helm/grafana-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{{- $watchNamespaces := coalesce .Values.watchNamespaces .Release.Namespace }}
{{- $namespaceScoped := false }}
{{- $isOpenShift := false }}
{{- if or (.Values.namespaceScope) (.Values.watchNamespaces) }}
{{- $namespaceScoped = true }}
{{- end }}
{{- if (.Values.isOpenShift) }}
{{- $isOpenShift = true }}
{{- end }}
{{- $operatorNamespace := .Release.Namespace }}
{{- range ( split "," $watchNamespaces ) }}
---
Expand Down Expand Up @@ -204,6 +208,7 @@ rules:
- patch
- update
- watch
{{- if $isOpenShift }}
- apiGroups:
NissesSenap marked this conversation as resolved.
Show resolved Hide resolved
- route.openshift.io
resources:
Expand All @@ -216,6 +221,7 @@ rules:
- list
- update
- watch
{{- end }}
- apiGroups:
- authentication.k8s.io
resources:
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/grafana-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ leaderElect: false
# By default it's all namespaces, if you only want to listen for the same namespace as the operator is deployed to look at namespaceScope.
watchNamespaces: ""

# -- Determines if the target cluster is OpenShift. Additional rbac permissions for routes will be added on OpenShift
isOpenShift: false

# -- Additional environment variables
env: []
# -- grafana image, e.g. docker.io/grafana/grafana:9.1.6, overwrites the default grafana image defined in the operator
Expand Down