Skip to content

Commit cd08053

Browse files
committed
Support custom nodeLabels for all gatherMethods of feature-pod-logs
Originally custom nodeLabels have only be support for gatherMethod 'filelog'. This commits adds support of other gatherTypes as well. Signed-off-by: Matthias Baur <[email protected]>
1 parent a0dbefd commit cd08053

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

charts/k8s-monitoring/charts/feature-pod-logs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Be sure perform actual integration testing in a live environment in the main [k8
5353
| namespaceAnnotations | object | `{}` | Log labels to set with values copied from the Kubernetes Namespace annotations. Only used for "filelog" gather method. Format: `<log_label>: <kubernetes_namespace_annotation>`. |
5454
| namespaceLabels | object | `{}` | Log labels to set with values copied from the Kubernetes Namespace labels. Only used for "filelog" gather method. Format: `<log_label>: <kubernetes_namespace_label>`. |
5555
| nodeAnnotations | object | `{}` | Log labels to set with values copied from the Kubernetes Node annotations. Only used for "filelog" gather method. Format: `<log_label>: <kubernetes_node_annotation>`. |
56-
| nodeLabels | object | `{}` | Log labels to set with values copied from the Kubernetes Node labels. Only used for "filelog" gather method. Format: `<log_label>: <kubernetes_node_label>`. |
56+
| nodeLabels | object | `{}` | Log labels to set with values copied from the Kubernetes Node labels. Format: `<log_label>: <kubernetes_node_label>`. |
5757
| staticLabels | object | `{}` | Log labels to set with static values. |
5858
| staticLabelsFrom | object | `{}` | Log labels to set with static values, not quoted so it can reference config components. |
5959

charts/k8s-monitoring/charts/feature-pod-logs/templates/_nodes_common.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{{- $attachMetadata = or $attachMetadata .Values.nodeLabels.nodeOS -}}
88
{{- $attachMetadata = or $attachMetadata .Values.nodeLabels.nodeArchitecture -}}
99
{{- $attachMetadata = or $attachMetadata .Values.nodeLabels.instanceType -}}
10+
{{- $attachMetadata = or $attachMetadata (gt (keys .Values.nodeLabels | len) 0) -}}
1011
{{- if eq $attachMetadata true }}
1112
attach_metadata {
1213
node = true
@@ -99,4 +100,11 @@ rule {
99100
target_label = "instance_type"
100101
}
101102
{{- end }}
103+
{{- range $attribute, $label := (omit .Values.nodeLabels "nodePool" "region" "availabilityZone" "nodeRole" "nodeOS" "nodeArchitecture" "instanceType")}}
104+
105+
rule {
106+
source_labels = [{{ $label | quote }}]
107+
target_label = {{ $attribute | quote }}
108+
}
109+
{{- end }}
102110
{{- end }}

charts/k8s-monitoring/charts/feature-pod-logs/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ labels:
2727
app_kubernetes_io_name: app.kubernetes.io/name
2828

2929
# -- Log labels to set with values copied from the Kubernetes Node labels.
30-
# Only used for "filelog" gather method.
3130
# Format: `<log_label>: <kubernetes_node_label>`.
3231
# @section -- Log Processing
3332
nodeLabels: {}

0 commit comments

Comments
 (0)