Skip to content

Commit

Permalink
Merge pull request #22 from splunk/namespace-labels-annotation
Browse files Browse the repository at this point in the history
Add new k8s tagger changes
  • Loading branch information
chaitanyaphalak authored Jun 29, 2021
2 parents 82dc04a + f1ec402 commit 19ea6a8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Binary file added charts/opentelemetry-collector-0.1.0.tgz
Binary file not shown.
12 changes: 7 additions & 5 deletions charts/sck-otel/templates/_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ processors:
name: k8s.pod.uid
extract:
metadata:
- deployment
- cluster
- namespace
- node
- startTime
- k8s.pod.name
- k8s.pod.uid
- k8s.deployment.name
- k8s.cluster.name
- k8s.namespace.name
- k8s.node.name
- k8s.pod.start_time
annotations:
{{- toYaml .Values.containers.listOfAnnotations | nindent 8 }}
labels:
Expand Down
7 changes: 7 additions & 0 deletions charts/sck-otel/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ containers:
# List of annotation and label fields to enrich with
listOfAnnotations:
- key: splunk.com/index
from: pod
- key: splunk.com/sourcetype
from: pod
- key: splunk.com/exclude
from: pod
- key: splunk.com/index
from: namespace
- key: splunk.com/exclude
from: namespace
listOfLabels:
- key: app
multilineSupportConfig: []
Expand Down
11 changes: 10 additions & 1 deletion ci_scripts/sck_otel_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,18 @@ containers:
- key: splunk.com/exclude
- key: splunk.com/customField
tag_name: customField
- key: splunk.com/index
from: namespace
- key: splunk.com/exclude
from: namespace
- key: splunk.com/customField
tag_name: customField
from: namespace
listOfLabels:
- key: app

from: pod
- key: app
from: namespace
customMetadata:
cluster_name: ci-k8s-cluster
customfield1: customvalue1
Expand Down
6 changes: 3 additions & 3 deletions test/k8s_logging_tests/test_config_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_splunk_index(setup, test_input, expected):

@pytest.mark.parametrize("label,index,expected", [
("pod-w-index-wo-ns-index", "pod-anno", 1),
#("pod-wo-index-w-ns-index", "ns-anno", 1),
("pod-wo-index-w-ns-index", "ns-anno", 1),
("pod-w-index-w-ns-index", "pod-anno", 1)
])
def test_label_collection(setup, label, index, expected):
Expand All @@ -65,7 +65,7 @@ def test_label_collection(setup, label, index, expected):

@pytest.mark.parametrize("container_name,expected", [
("pod-w-index-w-ns-index", 1),
#("pod-wo-index-w-ns-index", 1),
("pod-wo-index-w-ns-index", 1),
("pod-w-index-wo-ns-index", 1),
("pod-wo-index-wo-ns-index", 1),
])
Expand Down Expand Up @@ -252,7 +252,7 @@ def test_custom_metadata_fields(setup, field,value, expected):

@pytest.mark.parametrize("label,index,value,expected", [
("pod-w-index-wo-ns-index", "pod-anno", "pod-value-2", 1),
#("pod-wo-index-w-ns-index", "ns-anno", "ns-value", 1),
("pod-wo-index-w-ns-index", "ns-anno", "ns-value", 1),
("pod-w-index-w-ns-index", "pod-anno", "pod-value-1", 1)
])
def test_custom_metadata_fields_annotations(setup, label, index, value, expected):
Expand Down

0 comments on commit 19ea6a8

Please sign in to comment.