Skip to content

Commit d5c8be9

Browse files
committed
chore(addons):changes cluster role to role and clusterrolebinding to rolebinding
1 parent 7991bdd commit d5c8be9

7 files changed

Lines changed: 23 additions & 30 deletions

File tree

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
{{- if .Values.serviceAccount.create -}}
22
apiVersion: rbac.authorization.k8s.io/v1
3-
kind: ClusterRole
3+
kind: Role
44
metadata:
5+
namespace: {{ include "common.names.namespace" . | quote }}
56
name: {{ include "pmm.fullname" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
rules:
910
# standard RBAC
1011
- apiGroups: [""] # "" indicates the core API group
1112
resources:
12-
- namespaces
13+
# - namespaces
1314
- endpoints
1415
- services
15-
- nodes
16+
# - nodes
1617
- pods
1718
- secrets
1819
- serviceaccounts
1920
verbs:
2021
- get
2122
- watch
2223
- list
23-
- nonResourceURLs:
24-
- /metrics
25-
- /metrics/resources
26-
verbs:
27-
- get
24+
# - nonResourceURLs:
25+
# - /metrics
26+
# - /metrics/resources
27+
# verbs:
28+
# - get
2829
{{- end }}

addons/pmm/2.41/chart/pmm/templates/clusterrolebinding.yaml renamed to addons/pmm/2.41/chart/pmm/templates/rolebinding.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
{{- if .Values.serviceAccount.create -}}
22
{{- if .Values.pmmEnv.ENABLE_CLUSTER_ROLE_ADMIN -}}
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRoleBinding
4+
kind: RoleBinding
55
metadata:
6+
namespace: {{ include "common.names.namespace" . | quote }}
67
name: {{ include "pmm.fullname" . }}
78
roleRef:
89
apiGroup: rbac.authorization.k8s.io
9-
kind: ClusterRole
10+
kind: Role
1011
name: cluster-admin
1112
subjects:
1213
- kind: ServiceAccount
1314
name: {{ include "pmm.serviceAccountName" . }}
1415
namespace: {{ .Release.Namespace }}
1516
{{- else }}
1617
apiVersion: rbac.authorization.k8s.io/v1
17-
kind: ClusterRoleBinding
18+
kind: RoleBinding
1819
metadata:
1920
name: {{ include "pmm.fullname" . }}
2021
roleRef:
2122
apiGroup: rbac.authorization.k8s.io
22-
kind: ClusterRole
23+
kind: Role
2324
name: {{ include "pmm.fullname" . }}
2425
subjects:
2526
- kind: ServiceAccount

addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ kubernetes_sd_configs:
9494
own_namespace: true
9595
names:
9696
- {{ include "common.names.namespace" .context }}
97-
{{- range .value }}
98-
- {{ include "common.tplvalues.render" (dict "value" . "context" $) }}
99-
{{- end }}
10097

10198
relabel_configs:
10299
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]

addons/prometheus/2/chart/prometheus/templates/server/clusterrole.yaml renamed to addons/prometheus/2/chart/prometheus/templates/server/role.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ SPDX-License-Identifier: APACHE-2.0
44
*/}}
55

66
{{- if .Values.server.rbac.create }}
7-
kind: ClusterRole
7+
kind: Role
88
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
99
metadata:
10+
namespace: {{ include "common.names.namespace" . | quote }}
1011
name: {{ include "prometheus.server.fullname.namespace" . }}
1112
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1213
app.kubernetes.io/part-of: prometheus
@@ -19,14 +20,9 @@ rules:
1920
- apiGroups:
2021
- ""
2122
resources:
22-
- nodes
23-
- nodes/proxy
24-
- nodes/metrics
2523
- services
2624
- endpoints
2725
- pods
28-
- ingresses
29-
- configmaps
3026
verbs:
3127
- get
3228
- list
@@ -41,8 +37,7 @@ rules:
4137
- get
4238
- list
4339
- watch
44-
- nonResourceURLs:
45-
- "/metrics"
40+
4641
verbs:
4742
- get
4843
{{- if .Values.server.rbac.rules }}

addons/prometheus/2/chart/prometheus/templates/server/clusterrolebinding.yaml renamed to addons/prometheus/2/chart/prometheus/templates/server/rolebinding.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ Copyright Drycc Community.
33
SPDX-License-Identifier: APACHE-2.0
44
*/}}
55

6-
kind: ClusterRoleBinding
6+
kind: RoleBinding
77
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
88
metadata:
9+
namespace: {{ include "common.names.namespace" . | quote }}
910
name: {{ template "prometheus.server.fullname.namespace" . }}
1011
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1112
app.kubernetes.io/part-of: prometheus
@@ -15,7 +16,7 @@ metadata:
1516
{{- end }}
1617
roleRef:
1718
apiGroup: rbac.authorization.k8s.io
18-
kind: ClusterRole
19+
kind: Role
1920
name: {{ template "prometheus.server.fullname.namespace" . }}
2021
subjects:
2122
- kind: ServiceAccount

addons/prometheus/2/chart/prometheus/values.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ server:
636636
{{- end }}
637637
{{- if .Values.scrapeAddons.enabled }}
638638
- job_name: addons
639-
{{- include "addons.ds_scrape_config" (dict "value" .Values.scrapeNamespaces "context" $) | nindent 4 }}
639+
{{- include "addons.ds_scrape_config" (dict "context" $) | nindent 4 }}
640640
{{- end }}
641641
{{- if .Values.server.extraScrapeConfigs}}
642642
{{- include "common.tplvalues.render" (dict "value" .Values.server.extraScrapeConfigs "context" $) | nindent 2 }}
@@ -654,8 +654,6 @@ server:
654654
static_configs:
655655
- targets: [ "{{ printf "%s.%s.svc.%s:%d" (include "prometheus.alertmanager.fullname" .) (include "common.names.namespace" .) .Values.clusterDomain (int .Values.alertmanager.service.ports.http) }}" ]
656656
{{- end }}
657-
rule_files:
658-
- rules.yaml
659657
660658
## @param server.alertingRules Prometheus alerting rules. This content will be stored in the the rules.yaml file and the content can be a template.
661659
## ref: <https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/>

template/CHART_NAME/templates/clusterrolebinding.yaml renamed to template/CHART_NAME/templates/rolebinding.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright Drycc Community.
33
SPDX-License-Identifier: APACHE-2.0
44
*/}}
55

6-
kind: ClusterRoleBinding
6+
kind: RoleBinding
77
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
88
metadata:
99
name: {{ template "common.names.fullname" . }}
@@ -14,7 +14,7 @@ metadata:
1414
{{- end }}
1515
roleRef:
1616
apiGroup: rbac.authorization.k8s.io
17-
kind: ClusterRole
17+
kind: Role
1818
name: {{ template "common.names.fullname" . }}
1919
subjects:
2020
- kind: ServiceAccount

0 commit comments

Comments
 (0)