chore(netdata): use configmap for readability and extendability (#2601)

* chore(netdata): use configmap for readability

* whoops

* typo

* mount confimap on initcont

* subpath

* type file

* add /dev
This commit is contained in:
Stavros Kois
2022-05-02 18:23:29 +03:00
committed by GitHub
parent 779988a56f
commit 8d0b5810e6
4 changed files with 49 additions and 7 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ maintainers:
name: netdata
sources:
- https://github.com/netdata
version: 0.0.4
version: 0.0.5
annotations:
truecharts.org/catagories: |
- utilities
+20 -1
View File
@@ -1 +1,20 @@
{{ include "common.all" . }}
{{- include "common.setup" . }}
{{/* Append the hardcoded settings */}}
{{- define "netdata.harcodedValues" -}}
persistence:
netdata-configs:
enabled: "true"
mountPath: "/etc/netdata/truecharts-defaults/.netdata.conf"
subPath: "netdata-conf"
type: "custom"
volumeSpec:
configMap:
name: {{ printf "%v-configs" (include "common.names.fullname" .) }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "netdata.harcodedValues" . | fromYaml) -}}
{{- include "netdata.configmap" . }}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}
@@ -0,0 +1,16 @@
{{- define "netdata.configmap" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-configs
labels:
{{- include "common.labels" . | nindent 4 }}
data:
netdata-conf: |-
[global]
memory mode = dbengine
dbengine multihost disk space = 4096
page cache size = 64
{{- end -}}
+12 -5
View File
@@ -99,6 +99,12 @@ persistence:
hostPath: "/proc"
mountPath: "/host/proc"
readOnly: true
dev:
enabled: true
type: hostPath
hostPath: "/dev"
mountPath: "/host/dev"
readOnly: true
sys:
enabled: true
type: hostPath
@@ -119,16 +125,17 @@ initContainers:
volumeMounts:
- name: config
mountPath: "/etc/netdata"
- name: netdata-configs
mountPath: "/etc/netdata/truecharts-defaults/.netdata.conf"
subPath: netdata-conf
readOnly: true
command: ["/bin/sh", "-c"]
args:
- >
export configfile=/etc/netdata/netdata.conf;
if [ ! -f $configfile ]; then
echo "Creating config file...";
echo '[global]' > $configfile;
echo ' memory mode = dbengine' >> $configfile;
echo ' dbengine multihost disk space = 4096' >> $configfile;
echo ' page cache size = 64' >> $configfile;
cp /etc/netdata/truecharts-defaults/.netdata.conf $configfile
else
echo "Config file exists, skipping...";
fi;
cat $configfile