feat: add grafana pdc agent

This commit is contained in:
2025-06-20 12:53:11 +02:00
parent 3152759107
commit fc30cf1983
4 changed files with 133 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
bases:
- ../envs/environments.yaml.gotmpl
commonLabels:
tier: system
releases:
- name: grafana-pdc-agent
namespace: prometheus
chart: _grafana-pdc-agent
missingFileHandler: Info
values:
- ../values/env.yaml
- ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
- ../values/grafana-pdc-agent/env.yaml.gotmpl
- ../values/grafana-pdc-agent/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl
hooks:
- events: [ prepare, cleanup ]
showlogs: true
command: ../bin/helmify
args:
- '{{`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}`}}'
- '{{`{{ .Release.Chart }}`}}'
- '{{`{{ .Environment.Name }}`}}'
- ../values/grafana-pdc-agent/manifests
- _grafana-pdc-agent
+3
View File
@@ -0,0 +1,3 @@
grafana_pdc_agent:
enabled: true
autosync: true
@@ -0,0 +1,37 @@
{{- if .Values.grafana_pdc_agent.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: grafana-pdc-agent
namespace: argocd
spec:
destination:
namespace: proometheus
server: 'https://kubernetes.default.svc'
sources:
- repoURL: {{ .Values.clusterConfig.manifests }}
targetRevision: HEAD
path: helmfile.d
plugin:
name: helmfile-cmp
env:
- name: CLUSTER_NAME
value: {{ .Values.clusterConfig.cluster }}
- name: HELMFILE_ENVIRONMENT
value: default
- name: HELMFILE_FILE_PATH
value: grafana-pdc-agent.yaml.gotmpl
project: sys
syncPolicy:
managedNamespaceMetadata:
labels:
component: sys
syncOptions:
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
{{- if .Values.grafana_pdc_agent.autosync }}
automated:
prune: true
# selfHeal: false
{{- end }}
{{- end }}
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana-pdc-agent
name: grafana-pdc-agent
name: grafana-pdc-agent
namespace: prometheus
spec:
replicas: 1
selector:
matchLabels:
name: grafana-pdc-agent
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
name: grafana-pdc-agent
spec:
containers:
- name: grafana-pdc-agent
env:
- name: TOKEN
valueFrom:
secretKeyRef:
key: token
name: grafana-pdc-agent
- name: CLUSTER
valueFrom:
secretKeyRef:
key: cluster
name: grafana-pdc-agent
- name: HOSTED_GRAFANA_ID
valueFrom:
secretKeyRef:
key: hosted-grafana-id
name: grafana-pdc-agent
args:
- -cluster
- $(CLUSTER)
- -token
- $(TOKEN)
- -gcloud-hosted-grafana-id
- "$(HOSTED_GRAFANA_ID)"
image: grafana/pdc-agent:latest
imagePullPolicy: Always
resources:
limits:
memory: 1Gi
requests:
cpu: 1
memory: 1Gi
securityContext:
allowPrivilegeEscalation: false
privileged: false
runAsNonRoot: true
capabilities:
drop:
- all
securityContext:
runAsUser: 30000
runAsGroup: 30000
fsGroup: 30000