Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/helm-dev-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ jobs:
check ''
check '' --set runner.enableWritePermissions=true
check '' --set runner.readOnly=true
check '' --set runner.customResourceRead=true
check '' --set runner.customResourceRead=true --set runner.readOnly=true
check 'ClusterRole/nudgebee-agent-runner-scanner-pullsecrets-read:get Role/nudgebee-agent-runner-scanner-pullsecrets:create,delete,patch,update' \
--set runner.scannerAutoCopyPullSecrets=true
check 'ClusterRole/nudgebee-agent-runner-helm-releases:list' --set runner.helmReleaseDiscovery=true
Expand Down
106 changes: 106 additions & 0 deletions charts/nudgebee-agent/templates/runner-custom-resource-read.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{{- /*
Opt-in (runner.customResourceRead): read access behind the UI's CRDs tab,
which lists the cluster's CRDs and, per CRD, its objects (get_resource,
all namespaces). Read-only and rendered in both standard and read-only mode.

- customresourcedefinitions: the CRD list itself.
- The built-in `view` ClusterRole: read on built-in kinds plus every CRD
whose operator labels its roles aggregate-to-view (cert-manager, Argo,
Elastic, ...). The default `view` grants no Secrets; anything a cluster
later aggregates into `view` is granted to the runner too.
- Named VictoriaMetrics and prometheus-operator kinds, whose operators do
not aggregate to `view` and which Nudgebee itself runs. Named, not `*`:
vmusers (password/bearerToken may be inline) and vmalertmanagers
(configRawYaml may embed receiver credentials) are left out on purpose.

CRDs outside these stay unreadable; grant them with
runner.customClusterRoleRules. Secret-bearing kinds are refused by the
runner itself (pkg/kube/secretpolicy.go) whatever RBAC allows.
*/}}
{{- if .Values.runner.customResourceRead }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "nudgebee-agent.fullname" . }}-runner-custom-resource-read
rules:
- apiGroups:
- "apiextensions.k8s.io"
resources:
- customresourcedefinitions
verbs:
- get
- list
- watch
- apiGroups:
- "operator.victoriametrics.com"
resources:
- vlagents
- vlclusters
- vlogs
- vlsingles
- vmagents
- vmalertmanagerconfigs
- vmalerts
- vmanomalies
- vmanomalyconfigs
- vmauths
- vmclusters
- vmdistributed
- vmnodescrapes
- vmpodscrapes
- vmprobes
- vmrules
- vmscrapeconfigs
- vmservicescrapes
- vmsingles
- vmstaticscrapes
- vtclusters
- vtsingles
verbs:
- get
- list
- watch
- apiGroups:
- "monitoring.coreos.com"
resources:
- alertmanagerconfigs
- alertmanagers
- podmonitors
- probes
- prometheusagents
- prometheuses
- prometheusrules
- scrapeconfigs
- servicemonitors
- thanosrulers
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "nudgebee-agent.fullname" . }}-runner-custom-resource-read
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "nudgebee-agent.fullname" . }}-runner-custom-resource-read
subjects:
- kind: ServiceAccount
name: {{ include "nudgebee-agent.fullname" . }}-runner-service-account
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "nudgebee-agent.fullname" . }}-runner-view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: {{ include "nudgebee-agent.fullname" . }}-runner-service-account
namespace: {{ .Release.Namespace }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/nudgebee-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ runner:
# cluster. Off by default: the upgrade check then reports Helm release
# compatibility as unknown. Also applies under runner.readOnly.
helmReleaseDiscovery: false
# Read access for the UI's CRDs tab: the CRD list, the built-in `view`
# ClusterRole (no Secrets by default), and named VictoriaMetrics / prometheus-operator
# kinds. Read-only; also applies under runner.readOnly. Off by default: the
# CRDs tab then shows "not allowed" until this is enabled. See
# templates/runner-custom-resource-read.yaml for what is left out and why.
customResourceRead: false
customClusterRoleRules: []
imagePullSecrets: []
# Extra volumes on the runner pod. The common use is trusting a private CA
Expand Down
Loading