Path: blob/main/pkg/operator/testdata/test-resource-hierarchy.yaml
4095 views
apiVersion: monitoring.grafana.com/v1alpha11kind: GrafanaAgent2metadata:3name: grafana-agent-example4namespace: default5labels:6app: grafana-agent-example7spec:8image: grafana/agent:latest9serviceAccountName: grafana-agent10logs:11instanceSelector:12matchLabels:13agent: grafana-agent-example14metrics:15instanceSelector:16matchLabels:17agent: grafana-agent-example18integrations:19selector:20matchLabels:21agent: grafana-agent-example2223---2425apiVersion: monitoring.grafana.com/v1alpha126kind: MetricsInstance27metadata:28name: primary29namespace: default30labels:31agent: grafana-agent-example32spec:33remoteWrite:34- url: http://prometheus:9090/api/v1/write35basicAuth:36username:37name: prometheus-fake-credentials38key: fakeUsername39password:40name: prometheus-fake-credentials41key: fakePassword42# Supply an empty namespace selector to look in all namespaces.43podMonitorNamespaceSelector: {}44podMonitorSelector:45matchLabels:46instance: primary47# Supply an empty namespace selector to look in all namespaces.48serviceMonitorNamespaceSelector: {}49serviceMonitorSelector:50matchLabels:51instance: primary5253---5455apiVersion: monitoring.grafana.com/v1alpha156kind: LogsInstance57metadata:58name: primary59namespace: default60labels:61agent: grafana-agent-example62spec:63clients:64- url: http://loki:8080/loki/api/v1/push6566# Supply an empty namespace selector to look in all namespaces.67podLogsNamespaceSelector: {}68podLogsSelector:69matchLabels:70instance: primary7172---7374apiVersion: monitoring.grafana.com/v1alpha175kind: Integration76metadata:77name: node-exporter78namespace: default79labels:80agent: grafana-agent-example81spec:82name: node_exporter83type:84allNodes: true85unique: true86config:87rootfs_path: /rootfs88sysfs_path: /host/sys89procfs_path: /host/proc90volumeMounts:91- mountPath: /host/proc92name: proc93- mountPath: /host/sys94name: sys95- mountPath: /rootfs96name: root97volumes:98- hostPath:99path: /proc100name: proc101- hostPath:102path: /sys103name: sys104- hostPath:105path: /106name: root107108---109110# Have the Agent monitor itself.111apiVersion: monitoring.coreos.com/v1112kind: PodMonitor113metadata:114name: grafana-agents115namespace: default116labels:117instance: primary118spec:119selector:120matchLabels:121app.kubernetes.io/name: grafana-agent122podMetricsEndpoints:123- port: http-metrics124125---126127# Have the Agent get logs from itself.128apiVersion: monitoring.grafana.com/v1alpha1129kind: PodLogs130metadata:131name: grafana-agents132namespace: default133labels:134instance: primary135spec:136selector:137matchLabels:138app.kubernetes.io/name: grafana-agent139pipelineStages:140- cri: {}141142#143# Pretend credentials144#145146---147apiVersion: v1148kind: Secret149metadata:150name: prometheus-fake-credentials151namespace: default152data:153# "user"154fakeUsername: "dXNlcg=="155# "password"156fakePassword: "cGFzc3dvcmQ="157158#159# Extra resources160#161162---163apiVersion: v1164kind: ServiceAccount165metadata:166name: grafana-agent167namespace: default168---169apiVersion: rbac.authorization.k8s.io/v1170kind: ClusterRole171metadata:172name: grafana-agent173rules:174- apiGroups:175- ""176resources:177- nodes178- nodes/proxy179- nodes/metrics180- services181- endpoints182- pods183verbs:184- get185- list186- watch187- nonResourceURLs:188- /metrics189- /metrics/cadvisor190verbs:191- get192---193apiVersion: rbac.authorization.k8s.io/v1194kind: ClusterRoleBinding195metadata:196name: grafana-agent197roleRef:198apiGroup: rbac.authorization.k8s.io199kind: ClusterRole200name: grafana-agent201subjects:202- kind: ServiceAccount203name: grafana-agent204namespace: default205206207