Path: blob/main/pkg/operator/testdata/test-integrations.in.yaml
4095 views
apiVersion: monitoring.grafana.com/v1alpha11kind: GrafanaAgent2metadata:3name: grafana-agent-example4namespace: default5labels:6app: grafana-agent-example7spec:8image: grafana/agent:main9logLevel: info10serviceAccountName: grafana-agent11storage:12volumeClaimTemplate:13spec:14resources:15requests:16storage: 1Gi17logs:18instanceSelector:19matchLabels:20agent: grafana-agent-example21metrics:22instanceSelector:23matchLabels:24agent: grafana-agent-example25integrations:26selector:27matchLabels:28agent: grafana-agent-example2930---3132apiVersion: monitoring.grafana.com/v1alpha133kind: MetricsInstance34metadata:35name: primary36namespace: default37labels:38agent: grafana-agent-example39spec:40remoteWrite:41- url: http://prometheus:9090/api/v1/write42podMonitorNamespaceSelector: {}43podMonitorSelector:44matchLabels:45instance: primary4647---4849apiVersion: monitoring.grafana.com/v1alpha150kind: LogsInstance51metadata:52name: primary53namespace: default54labels:55agent: grafana-agent-example56spec:57clients:58- url: http://loki:8080/loki/api/v1/push5960# Supply an empty namespace selector to look in all namespaces.61podLogsNamespaceSelector: {}62podLogsSelector:63matchLabels:64instance: primary6566---6768# Have the Agent monitor itself.69apiVersion: monitoring.coreos.com/v170kind: PodMonitor71metadata:72name: grafana-agents73namespace: default74labels:75instance: primary76spec:77selector:78matchLabels:79app.kubernetes.io/name: grafana-agent80podMetricsEndpoints:81- port: http-metrics8283---8485# Have the Agent get logs from itself.86apiVersion: monitoring.grafana.com/v1alpha187kind: PodLogs88metadata:89name: grafana-agents90namespace: default91labels:92instance: primary93spec:94selector:95matchLabels:96app.kubernetes.io/name: grafana-agent97pipelineStages:98- cri: {}99100---101102# Collect node_exporter metrics.103apiVersion: monitoring.grafana.com/v1alpha1104kind: Integration105metadata:106name: node-exporter107namespace: default108labels:109agent: grafana-agent-example110spec:111name: node_exporter112type:113allNodes: true114unique: true115config:116autoscrape:117enable: true118metrics_instance: default/primary119rootfs_path: /default/node_exporter/rootfs120sysfs_path: /default/node_exporter/sys121procfs_path: /default/node_exporter/proc122volumeMounts:123- mountPath: /default/node_exporter/proc124name: proc125- mountPath: /default/node_exporter/sys126name: sys127- mountPath: /default/node_exporter/rootfs128name: root129volumes:130- name: proc131hostPath:132path: /proc133- name: sys134hostPath:135path: /sys136- name: root137hostPath:138path: /root139# These aren't really used here, but just being mounted for local testing.140secrets:141- name: fake-secret142key: key143configMaps:144- name: fake-configmap145key: foo146147---148149# Collect kubernetes API events.150apiVersion: monitoring.grafana.com/v1alpha1151kind: Integration152metadata:153name: eventhandler154namespace: default155labels:156agent: grafana-agent-example157spec:158name: eventhandler159type:160unique: true161config:162logs_instance: default/primary163cache_path: "/var/lib/grafana-agent/data/eventhandler.cache"164165---166167#168# Pretend Secrets/ConfigMaps169#170171---172apiVersion: v1173kind: Secret174metadata:175name: fake-secret176namespace: default177stringData:178key: "value"179180---181apiVersion: v1182kind: ConfigMap183metadata:184name: fake-configmap185namespace: default186data:187foo: "bar"188189#190# Extra resources191#192193---194apiVersion: v1195kind: ServiceAccount196metadata:197name: grafana-agent198namespace: default199---200apiVersion: rbac.authorization.k8s.io/v1201kind: ClusterRole202metadata:203name: grafana-agent204rules:205- apiGroups:206- ""207resources:208- nodes209- nodes/proxy210- nodes/metrics211- services212- endpoints213- pods214- events # needed for eventhandler integration215verbs:216- get217- list218- watch219- nonResourceURLs:220- /metrics221- /metrics/cadvisor222verbs:223- get224---225apiVersion: rbac.authorization.k8s.io/v1226kind: ClusterRoleBinding227metadata:228name: grafana-agent229roleRef:230apiGroup: rbac.authorization.k8s.io231kind: ClusterRole232name: grafana-agent233subjects:234- kind: ServiceAccount235name: grafana-agent236namespace: default237238239