chore(netdata): add some more default confs (#3473)

* chore(netdata): add some more default confs

* bump

* use bash

* invert logic

* fix output
This commit is contained in:
Stavros Kois
2022-08-14 12:03:46 +00:00
committed by GitHub
parent 9602f608a7
commit c33ef6c9de
3 changed files with 64 additions and 13 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ name: netdata
sources:
- https://github.com/truecharts/charts/tree/master/charts/stable/netdata
- https://github.com/netdata
version: 2.0.28
version: 2.0.29
annotations:
truecharts.org/catagories: |
- utilities
+58 -12
View File
@@ -26,9 +26,16 @@ configmap:
data:
netdata-conf: |-
[global]
memory mode = dbengine
dbengine multihost disk space = 4096
page cache size = 64
memory mode = dbengine
dbengine multihost disk space = 4096
page cache size = 64
go-d-conf: |-
modules:
k8s_state: yes
go-d-k8s-state-conf: |-
jobs:
- name: k8s_state
update_every: 1
rbac:
main:
@@ -138,6 +145,22 @@ persistence:
volumeSpec:
configMap:
name: '{{ printf "%v-configs" (include "tc.common.names.fullname" .) }}'
go-d-configs:
enabled: "true"
mountPath: "/etc/netdata/truecharts-defaults/.go.d.conf"
subPath: "go-d-conf"
type: "custom"
volumeSpec:
configMap:
name: '{{ printf "%v-configs" (include "tc.common.names.fullname" .) }}'
go-d-k8s-state-configs:
enabled: "true"
mountPath: "/etc/netdata/truecharts-defaults/go.d/.k8s_state.conf"
subPath: "go-d-k8s-state-conf"
type: "custom"
volumeSpec:
configMap:
name: '{{ printf "%v-configs" (include "tc.common.names.fullname" .) }}'
initContainers:
create-config:
@@ -150,16 +173,39 @@ initContainers:
mountPath: "/etc/netdata/truecharts-defaults/.netdata.conf"
subPath: netdata-conf
readOnly: true
command: ["/bin/sh", "-c"]
- name: go-d-configs
mountPath: "/etc/netdata/truecharts-defaults/.go.d.conf"
subPath: go-d-conf
readOnly: true
- name: go-d-k8s-state-configs
mountPath: "/etc/netdata/truecharts-defaults/go.d/.k8s_state.conf"
subPath: go-d-k8s-state-conf
readOnly: true
command: ["/bin/bash", "-c"]
args:
- >
export configfile=/etc/netdata/netdata.conf;
if [ ! -f $configfile ]; then
cp /etc/netdata/truecharts-defaults/.netdata.conf $configfile
else
echo "Config file exists, skipping...";
fi;
cat $configfile
- |-
copy_config () {
local confSource="$1"
local confTarget="$2"
local dirTarget
dirTarget="$(dirname "${confTarget}")"
if [ ! -f "$confTarget" ]; then
if [ ! -d "${dirTarget}" ]; then
mkdir -p "$dirTarget"
fi;
cp "$confSource" "$confTarget"
echo "Content of $(basename "${confTarget}")"
cat "$confTarget"
else
echo "Config $confTarget exists, skipping..."
fi;
}
export -f copy_config
copy_config "/etc/netdata/truecharts-defaults/.netdata.conf" "/etc/netdata/netdata.conf"
copy_config "/etc/netdata/truecharts-defaults/.go.d.conf" "/etc/netdata/go.d.conf"
copy_config "/etc/netdata/truecharts-defaults/go.d/.k8s_state.conf" "/etc/netdata/go.d/k8s_state.conf"
portal:
enabled: true