I'm using the prometheus stack project to implement via helm with kubernetes, but I would like to customize some rules. I'm trying to use the additionalPrometheusRules
parameter for this, but I'm facing syntax errors inside it, here's my structure:
../module-prometheus-helm
├── Chart.yaml
├── charts
├── rules
│ └── customrules.yaml
├── templates
│ └── configmap.yaml
└── values.yaml
File: customrules.yaml
additionalPrometheusRules:
- name: my-rule-file
groups:
- name: my_group
rules:
- record: my_record
expr: 100 * my_record
File: configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-receiver-configmap
data:
{{ $currentScope := . }}
{{ range $path, $_ := .Files.Glob "rules/**.yaml" }}
{{- with $currentScope}}
{{ base $path }}: |-
{{ .Files.Get $path | indent 2 }}
{{- end }}
{{ end }}
File values.yaml is default helm.
Output Error
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(ConfigMap): unknown field "customrules.yaml" in io.k8s.api.core.v1.ConfigMap
helm.go:84: [debug] error validating "": error validating data: ValidationError(ConfigMap): unknown field "customrules.yaml" in io.k8s.api.core.v1.ConfigMap
How can I independently import the additional rules into the repository without polluting the values.yaml
file?