3434 dnsConfig :
3535 {{- . | nindent 8 }}
3636 {{- end }}
37+ initContainers :
38+ - name : get-cpu-allocatable
39+ image : bitnami/kubectl:latest
40+ command :
41+ - sh
42+ - -c
43+ - |
44+ NODE_NAME=$(echo $KUBE_NODE_NAME)
45+ echo "Node Name: $KUBE_NODE_NAME"
46+ export NODE_CPU_ALLOCATABLE=$(kubectl get node $NODE_NAME -o jsonpath='{.status.allocatable.cpu}')
47+ echo "NODE_CPU_ALLOCATABLE : $NODE_CPU_ALLOCATABLE"
48+ cp /temp-config/daemonset-config.yaml /final-config
49+ yq -i '.processors.metricsgeneration/calculate_percentage.rules[2].scale_by = env(NODE_CPU_ALLOCATABLE)' /final-config/daemonset-config.yaml
50+ cat /final-config/daemonset-config.yaml
51+ env :
52+ - name : KUBE_NODE_NAME
53+ valueFrom :
54+ fieldRef :
55+ apiVersion : v1
56+ fieldPath : spec.nodeName
57+ volumeMounts :
58+ - name : daemonset-config
59+ mountPath : /temp-config
60+ - name : final-daemonset-config
61+ mountPath : /final-config
3762 containers :
3863 - name : otel-collector-daemonset
3964 {{- with include "nrKubernetesOtel.daemonset.securityContext.container" . }}
@@ -101,7 +126,7 @@ spec:
101126 - name : varlogpods
102127 mountPath : /var/log/pods
103128 readOnly : true
104- - name : daemonset-config
129+ - name : final- daemonset-config
105130 mountPath : /config
106131 {{- with .Values.daemonset.extraVolumeMounts }}
107132 {{- toYaml . | nindent 12 }}
@@ -115,6 +140,8 @@ spec:
115140 - name : varlogpods
116141 hostPath :
117142 path : /var/log/pods
143+ - name : final-daemonset-config
144+ emptyDir : {}
118145 - name : daemonset-config
119146 configMap :
120147 name : {{ include "nrKubernetesOtel.daemonset.configMap.fullname" . }}
0 commit comments