Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust configuration for istio environment #171

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- BREAKING: Remove SAPM receiver from default config (#168)

### Added

- Add Istio specific configurations (#171)

## [0.28.1] - 2021-06-18

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ receivers:
receiver_creator:
watch_observers: [k8s_observer]
receivers:
{{- if .Values.autodetect.prometheus }}
{{- if or .Values.autodetect.prometheus .Values.autodetect.istio }}
prometheus_simple:
{{- if .Values.autodetect.prometheus }}
# Enable prometheus scraping for pods with standard prometheus annotations
rule: type == "pod" && annotations["prometheus.io/scrape"] == "true"
{{- else }}
# Enable prometheus scraping for istio pods only
rule: type == "pod" && annotations["prometheus.io/scrape"] == "true" && "istio.io/rev" in labels
{{- end }}
config:
metrics_path: '`"prometheus.io/path" in annotations ? annotations["prometheus.io/path"] : "/metrics"`'
endpoint: '`endpoint`:`"prometheus.io/port" in annotations ? annotations["prometheus.io/port"] : 9090`'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ data:
k8s.pod.labels.{{ . }} ${record.dig("kubernetes","labels","{{ . }}")}
{{- end }}

{{- if .Values.autodetect.istio }}
# Automaically compose service.name attribute the same way as done in istio for traces
service.name ${record.dig("kubernetes","labels","app")}.${record.dig("kubernetes","namespace_name")}
{{- end }}

denylist ${record.dig("kubernetes", "annotations", "splunk.com/exclude") ? record.dig("kubernetes", "annotations", "splunk.com/exclude") : record.dig("kubernetes", "namespace_annotations", "splunk.com/exclude") ? (record["kubernetes"]["namespace_annotations"]["splunk.com/exclude"]) : ("false")}
</record>
</filter>
Expand Down
3 changes: 3 additions & 0 deletions helm-charts/splunk-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
{{- if .Values.otelAgent.podAnnotations }}
{{- toYaml .Values.otelAgent.podAnnotations | nindent 8 }}
{{- end }}
{{- if .Values.autodetect.istio }}
sidecar.istio.io/inject: "false"
{{- end }}
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
{{- if .Values.otelCollector.podAnnotations }}
{{- toYaml .Values.otelCollector.podAnnotations | nindent 8 }}
{{- end }}
{{- if .Values.autodetect.istio }}
sidecar.istio.io/inject: "false"
{{- end }}
spec:
serviceAccountName: {{ template "splunk-otel-collector.serviceAccountName" . }}
{{- if .Values.otelCollector.nodeSelector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
{{- if .Values.otelK8sClusterReceiver.podAnnotations }}
{{- toYaml .Values.otelK8sClusterReceiver.podAnnotations | nindent 8 }}
{{- end }}
{{- if .Values.autodetect.istio }}
sidecar.istio.io/inject: "false"
{{- end }}
spec:
serviceAccountName: {{ template "splunk-otel-collector.serviceAccountName" . }}
{{- if .Values.otelK8sClusterReceiver.nodeSelector }}
Expand Down
4 changes: 3 additions & 1 deletion helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ logsEnabled: true
# Optional: Automatic detection of additional metric sources.
# Set autodetect.prometheus=true if you want the otel-collector agent to scrape
# prometheus metrics from pods that have prometheus-style annotations like
# "prometheus.io/scrape"
# "prometheus.io/scrape".
# Set autodetect.istio=true in istio environment.
################################################################################

autodetect:
prometheus: false
istio: false

################################################################################
# Optional: Configuration for additional metadata that will be added to all the
Expand Down