Skip to content

Commit 3814f8d

Browse files
nammnfealebenpae
authored andcommitted
add option to not install clusterrole for telemetry (#4133)
# Summary - some customers might have multiple operators in the same cluster. If yes, enabling telemetry would install the clusterrole (non-namespaced resource) multiple times and fail - this adds support for customers to not install the clusterrole as a helm chart setting ## Proof of Work no clusterrole ``` 1.24.0 ~/projects/ops-manager-kubernetes better-helm-chart* kind-e2e-operator/nnguyen-evg-single 05:45:26 PM ❯ helm install operator helm_chart --set operator.telemetry.installClusterRoles=false NAME: operator LAST DEPLOYED: Wed Feb 26 17:45:30 2025 NAMESPACE: nnguyen-evg-single STATUS: deployed REVISION: 1 TEST SUITE: None 1.24.0 ~/projects/ops-manager-kubernetes better-helm-chart* kind-e2e-operator/nnguyen-evg-single 05:45:33 PM ❯ k get clusterrole | rg telemetry <--- none ``` clusterrole exists ``` ❯ helm install operator helm_chart --set operator.telemetry.installClusterRoles=true NAME: operator LAST DEPLOYED: Wed Feb 26 17:47:38 2025 NAMESPACE: nnguyen-evg-single STATUS: deployed REVISION: 1 TEST SUITE: None 1.24.0 ~/projects/ops-manager-kubernetes better-helm-chart kind-e2e-operator/nnguyen-evg-single 05:47:42 PM ❯ k get clusterrole | rg telemetry mongodb-enterprise-operator-cluster-telemetry 2025-02-26T16:47:40Z ``` ## Checklist - [ ] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you checked for release_note changes?
1 parent 3d0e563 commit 3814f8d

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

config/rbac/operator-roles.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ apiVersion: rbac.authorization.k8s.io/v1
77
metadata:
88
name: mongodb-enterprise-operator-cluster-telemetry
99
rules:
10-
1110
# Non-resource URL permissions
1211
- nonResourceURLs:
1312
- "/version"

helm_chart/templates/operator-roles.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,15 @@ subjects:
181181

182182

183183
{{ if and .Values.operator.telemetry.collection.clusters.enabled .Values.operator.telemetry.enabled}}
184+
{{- $clusterRoleName := printf "%s-cluster-telemetry" .Values.operator.name }}
185+
{{- if .Values.operator.telemetry.installClusterRoles }}
184186
---
185187
# Additional ClusterRole for clusterVersionDetection
186188
kind: ClusterRole
187189
apiVersion: rbac.authorization.k8s.io/v1
188190
metadata:
189-
name: {{ .Values.operator.name }}-cluster-telemetry
191+
name: {{ $clusterRoleName }}
190192
rules:
191-
{{ if .Values.operator.telemetry.collection.clusters.enabled }}
192193
# Non-resource URL permissions
193194
- nonResourceURLs:
194195
- "/version"
@@ -219,7 +220,7 @@ metadata:
219220
roleRef:
220221
apiGroup: rbac.authorization.k8s.io
221222
kind: ClusterRole
222-
name: {{ .Values.operator.name }}-cluster-telemetry
223+
name: {{ $clusterRoleName }}
223224
subjects:
224225
- kind: ServiceAccount
225226
name: {{ .Values.operator.name }}

helm_chart/values.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ operator:
101101
telemetry:
102102
# Enables telemetry. Setting this to false will stop all telemetry related work on the operator.
103103
enabled: true
104+
# Adds RBAC clusterRole for kube-system uid detection for the kubernetes cluster uid
105+
# Adds RBAC clusterRole for RBAC for nodes. We are listing exactly one node to detect the cluster provider (e.g. eks)
106+
# Adds RBAC clusterRole for /version query for detecting kubernetes server version
107+
# Note: the cluster UUID is unique but random and mongoDB has no way to map this to a customer.
108+
installClusterRoles: true
104109
collection:
105110
# Valid time units are "m", "h". Anything less than one minute defaults to 1h
106111
frequency: 1h
107112
# Enables the operator to collect and send cluster level telemetry
108-
# Adds RBAC clusterRole for kube-system uid detection for the kubernetes cluster uid
109-
# Adds RBAC clusterRole for RBAC for nodes. We are listing exactly one node to detect the cluster provider (e.g. eks)
110-
# Adds RBAC clusterRole for /version query for detecting kubernetes server version
111-
# Note: the cluster UUID is unique but random and mongoDB has no way to map this to a customer.
112113
clusters:
113114
enabled: true
114115
# Enables the operator to collect and send deployment level telemetry

public/mongodb-enterprise-multi-cluster.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ apiVersion: rbac.authorization.k8s.io/v1
3333
metadata:
3434
name: mongodb-enterprise-operator-multi-cluster-cluster-telemetry
3535
rules:
36-
3736
# Non-resource URL permissions
3837
- nonResourceURLs:
3938
- "/version"

public/mongodb-enterprise-openshift.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ apiVersion: rbac.authorization.k8s.io/v1
3333
metadata:
3434
name: mongodb-enterprise-operator-cluster-telemetry
3535
rules:
36-
3736
# Non-resource URL permissions
3837
- nonResourceURLs:
3938
- "/version"

public/mongodb-enterprise.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ apiVersion: rbac.authorization.k8s.io/v1
3333
metadata:
3434
name: mongodb-enterprise-operator-cluster-telemetry
3535
rules:
36-
3736
# Non-resource URL permissions
3837
- nonResourceURLs:
3938
- "/version"

scripts/funcs/operator_deployment

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ get_operator_helm_values() {
3232
"operator.enablePVCResize=${MDB_ENABLE_PVC_RESIZE:-true}"
3333
"operator.telemetry.enabled=true"
3434
"operator.telemetry.collection.clusters.enabled=${MDB_OPERATOR_TELEMETRY_COLLECTION_CLUSTERS_ENABLED:-true}"
35+
"operator.telemetry.collection.clusters.installClusterRoles=true"
3536
"operator.telemetry.collection.deployments.enabled=true"
3637
"operator.telemetry.collection.operators.enabled=true"
3738
# only send the telemetry to the backend on a specific variant, thus default to false

0 commit comments

Comments
 (0)