Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaphalak committed Nov 16, 2021
1 parent ecac299 commit 17e73c0
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 68 deletions.
46 changes: 28 additions & 18 deletions helm-charts/splunk-otel-collector/templates/config/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -223,34 +223,44 @@ Add Extra Labels
*/}}
{{- define "splunk-otel-collector.addExtraLabels" -}}
labels:
{{- with .Values.extraAttributes.podLabels }}
{{- range . }}
- key: {{ . }}
from: pod
{{- end }}
{{- if .Values.extraAttributes.fromLabels }}
{{- range $ignore, $item := .Values.extraAttributes.fromLabels }}
{{- if $item.key }}
- key: {{ $item.key }}
from: {{ $item.from }}
{{- if $item.tag_name }}
tag_name: {{ $item.tag_name }}
{{- end }}{{- end }}
{{- if $item.key_regex }}
- key_regex: {{ $item.key_regex }}
from: {{ $item.from }}
{{- if $item.tag_name }}
tag_name: {{ $item.tag_name }}
{{- end }}{{- end }}
{{- end }}
{{- with .Values.extraAttributes.namespaceLabels }}
{{- range . }}
- key: {{ . }}
from: namespace
{{- end }}
{{- end }}
{{- end }}

{{/*
Add Extra Annotations
*/}}
{{- define "splunk-otel-collector.addExtraAnnotations" -}}
{{- with .Values.extraAttributes.podAnnotations }}
{{- range . }}
- key: {{ . }}
from: pod
{{- if .Values.extraAttributes.fromAnnotations }}
{{- range $ignore, $item := .Values.extraAttributes.fromAnnotations }}
{{- if $item.key }}
- key: {{ $item.key }}
from: {{ $item.from }}
{{- if $item.tag_name }}
tag_name: {{ $item.tag_name }}
{{- end }}
{{- end }}
{{- with .Values.extraAttributes.namespaceAnnotations }}
{{- range . }}
- key: {{ . }}
from: namespace
{{- if $item.key_regex }}
- key_regex: {{ $item.key_regex }}
from: {{ $item.from }}
{{- if $item.tag_name }}
tag_name: {{ $item.tag_name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,24 @@ processors:
- key: splunk.com/index
tag_name: com.splunk.index
from: pod
{{/* {{- if .Values.extraAttributes.fromAnnotations }}*/}}
{{/* {{- range $key, $from := .Values.extraAttributes.fromAnnotations }}*/}}
{{/* - key: {{ $key }}*/}}
{{/* from: {{ $from }}*/}}
{{/* {{- end }}*/}}
{{/* {{- end }}*/}}
{{/* {{- if .Values.extraAttributes.fromAnnotations }}*/}}
{{/* {{- range $ignore, $item := .Values.extraAttributes.fromAnnotations }}*/}}
{{/* {{- if $item.key }}*/}}
{{/* - key: {{ $item.key }}*/}}
{{/* from: {{ $item.from }}*/}}
{{/* {{- end }}*/}}
{{/* {{- if $item.key_regex }}*/}}
{{/* - key_regex: {{ $item.key_regex }}*/}}
{{/* from: {{ $item.from }}*/}}
{{/* {{- end }}*/}}
{{/* {{- end }}*/}}
{{/* {{- end }}*/}}
{{- include "splunk-otel-collector.addExtraAnnotations" . | nindent 8 }}
{{- include "splunk-otel-collector.addExtraLabels" . | nindent 6 }}
Expand Down
20 changes: 4 additions & 16 deletions helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,28 +217,16 @@
"type": "object",
"additionalProperties": false,
"properties": {
"podLabels": {
"type": "array",
"items": {
"type": "string"
}
},
"podAnnotations": {
"fromLabels": {
"type": "array",
"items": {
"type": "string"
}
},
"namespaceAnnotations": {
"type": "array",
"items": {
"type": "string"
"type": "object"
}
},
"namespaceLabels": {
"fromAnnotations": {
"type": "array",
"items": {
"type": "string"
"type": "object"
}
},
"custom": {
Expand Down
24 changes: 10 additions & 14 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,24 @@ extraAttributes:
# Labels that will be collected from k8s pods (in case they are set)
# and added as extra attributes to the telemetry in the following format:
# k8s.pod.labels.<label_name>: <label_value>
podLabels:
- app
# - k8s-app
# - release

# Labels that will be collected from k8s namespaces (in case they are set)
# and added as extra attributes to the telemetry in the following format:
# k8s.namespace.labels.<label_name>: <label_value>
namespaceLabels: []
# - dev
# - staging
# - production
fromLabels: []
# - key_regex: .*
# from: pod
# - key: release
# from: namespace

# Annotations that will be collected from k8s pods (in case they are set)
# and added as extra attributes to the telemetry in the following format:
# k8s.pod.annotations.<label_name>: <label_value>
podAnnotations: []

# k8s.pod.annotations.<annotation_name>: <annotation_value>
# Annotations that will be collected from k8s namespaces (in case they are set)
# and added as extra attributes to the telemetry in the following format:
# k8s.namespace.annotations.<label_name>: <label_value>
namespaceAnnotations: []
# k8s.namespace.annotations.<annotation_name>: <annotation_value>
fromAnnotations: []
# - key: app-version
# tag_name: app-version

# List of hardcoded key/value pairs that will be added as attributes to
# all the telemetry.
Expand Down
4 changes: 1 addition & 3 deletions rendered/manifests/agent-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ data:
- from: pod
key: splunk.com/index
tag_name: com.splunk.index
labels:
- from: pod
key: app
labels: null
metadata:
- k8s.namespace.name
- k8s.node.name
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/agent-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 790d57dad52c0223f49079b27f8a296d1e7e44db9a935fd6f18c44a29430d3ea
checksum/config: 1a6c0413d19edb7a2192621b2c96ae859518180918bcbf06de44d532f682db3c
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ data:
- from: pod
key: splunk.com/index
tag_name: com.splunk.index
labels:
- from: pod
key: app
labels: null
metadata:
- k8s.namespace.name
- k8s.node.name
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/gateway-only/deployment-collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-collector
release: default
annotations:
checksum/config: 2e7be98480a03c03060498c2cb193a76be0b8c3df20eefa257c731e17f4b37d0
checksum/config: a6726215c4253cf39562e3ec4907735b6d1b51c9db4b891fd29910d3aa3f373a
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
4 changes: 1 addition & 3 deletions rendered/manifests/logs-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ data:
- from: pod
key: splunk.com/index
tag_name: com.splunk.index
labels:
- from: pod
key: app
labels: null
metadata:
- k8s.namespace.name
- k8s.node.name
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/logs-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 6f7586b89c9389ac616ef627e399118402f55fa0120e556b7c0944a4f5cac702
checksum/config: e0eb5767699967795e41b392ba2076a80b6ced4db994a1c5399494ab8eb75225
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
4 changes: 1 addition & 3 deletions rendered/manifests/metrics-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ data:
- from: pod
key: splunk.com/index
tag_name: com.splunk.index
labels:
- from: pod
key: app
labels: null
metadata:
- k8s.namespace.name
- k8s.node.name
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/metrics-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 29dfd627340b85c0f5acd88315d621f84a139c4efcff44ea91ad906f11ba3489
checksum/config: 2375aa23231de51baddb397fe0d6a47595dbba5d51466d0052c5b55d66490cac
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
4 changes: 1 addition & 3 deletions rendered/manifests/traces-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ data:
- from: pod
key: splunk.com/index
tag_name: com.splunk.index
labels:
- from: pod
key: app
labels: null
metadata:
- k8s.namespace.name
- k8s.node.name
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/traces-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: d85c8ebfbbcb65a217cfeeb22b3cfea9f932f6cb26d6fab40fc4f8d64b40b71d
checksum/config: 00023eb2814f8ce41d15228bff6b0e2f3ae92bf7fb2b5e38e8c237a4d5fb798e
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down

0 comments on commit 17e73c0

Please sign in to comment.