Skip to content

Commit

Permalink
add: Add grafana-agent chart
Browse files Browse the repository at this point in the history
  • Loading branch information
aoshimash committed Apr 30, 2022
1 parent 4aa8a5e commit a73616d
Show file tree
Hide file tree
Showing 11 changed files with 516 additions and 0 deletions.
13 changes: 13 additions & 0 deletions charts/grafana-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v2
name: grafana-agent
version: v0.0.1
description: grafana-agent Chart for Grafana Labs Kubernetes integration. https://grafana.com/docs/grafana-cloud/kubernetes/integration-kubernetes/
type: application
home: https://github.com/aoshimash/homelab-helm-charts
sources:
- https://grafana.com/docs/grafana-cloud/kubernetes/integration-kubernetes/
dependencies:
- name: kube-state-metrics
version: 4.7.0
repository: https://prometheus-community.github.io/helm-charts
25 changes: 25 additions & 0 deletions charts/grafana-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# grafana-agent

grafana-agent Chart for Grafana Labs Kubernetes integration.

## Values

| Key | Type | Default | Description |
|---|---|---|---|
| kube-state-metrics.imag.tag | string | v2.4.1 | kube-state-metrics chart version |
| cluster_name | string | mycluster | Cluster name |
| container_runtime | string | cri | Cluster container runtime (which "cri" or "docker") |
| image.tag | string | v0.24.0 | `grafana/agent` image tag |
| prometheus.scrape_interval | string | 60s | How often should the metrics be collected |
| prometheus.remote_write.url | string | nil | URL to send Prometheus metrics to Grafana Cloud |
| prometheus.remote_write.basic_auth.username | string | nil | Grafana Cloud Prometheus username |
| prometheus.remote_write.basic_auth.password | string | nil | Grafana Cloud Prometheus password |
| logs.sync_period | string | 10s | Period to resync directories being watched and files being tailed to discover |
| logs.client.url | string | nil | URL to send Loki to Grafana Cloud |
| logs.client.basic_auth.username | string | nil | Grafana Cloud Loki username |
| logs.client.basic_auth.password | string | nil | Grafana Cloud Loki password |

## Reference

- [Grafana Cloud Kubernetes Integration](https://grafana.com/docs/grafana-cloud/kubernetes/integration-kubernetes/)
- [kube-state-metrics](https://artifacthub.io/packages/helm/prometheus-community/kube-state-metrics)
43 changes: 43 additions & 0 deletions charts/grafana-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- define "grafana-agent.metrics.serviceAccount.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.metrics.clusterRole.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.metrics.clusterRoleBinding.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.metrics.service.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.metrics.statefulSet.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.metrics.configMap.name" -}}
{{- printf "grafana-agent" -}}
{{- end -}}

{{- define "grafana-agent.logs.serviceAccount.name" -}}
{{- printf "grafana-agent-logs" -}}
{{- end -}}

{{- define "grafana-agent.logs.clusterRole.name" -}}
{{- printf "grafana-agent-logs" -}}
{{- end -}}

{{- define "grafana-agent.logs.clusterRoleBinding.name" -}}
{{- printf "grafana-agent-logs" -}}
{{- end -}}

{{- define "grafana-agent.logs.daemonSet.name" -}}
{{- printf "grafana-agent-logs" -}}
{{- end -}}

{{- define "grafana-agent.logs.configMap.name" -}}
{{- printf "grafana-agent-logs" -}}
{{- end -}}
46 changes: 46 additions & 0 deletions charts/grafana-agent/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "grafana-agent.metrics.clusterRole.name" }}
rules:
- apiGroups:
- ""
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
- events
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "grafana-agent.logs.clusterRole.name" }}
rules:
- apiGroups:
- ""
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
- events
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
26 changes: 26 additions & 0 deletions charts/grafana-agent/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "grafana-agent.metrics.clusterRoleBinding.name" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "grafana-agent.metrics.clusterRole.name" }}
subjects:
- kind: ServiceAccount
name: {{ template "grafana-agent.metrics.serviceAccount.name" }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "grafana-agent.logs.clusterRoleBinding.name" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "grafana-agent.logs.clusterRole.name" }}
subjects:
- kind: ServiceAccount
name: {{ template "grafana-agent.logs.serviceAccount.name" }}
namespace: {{ .Release.Namespace }}
Loading

0 comments on commit a73616d

Please sign in to comment.