Skip to content

Commit

Permalink
Fix telemetry templates (istio#47894)
Browse files Browse the repository at this point in the history
fix configmap
  • Loading branch information
bochengchu authored Nov 17, 2023
1 parent bf30b8f commit cd981f4
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* Prometheus is enabled if its enabled and there are no config overrides set */}}
{{ define "prometheus" }}
{{/* Default Prometheus is enabled if its enabled and there are no config overrides set */}}
{{ define "default-prometheus" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.prometheus.enabled
Expand All @@ -10,8 +10,8 @@
)) }}
{{- end }}

{{/* SD has metrics and logging split. Metrics are enabled if SD is enabled and there are no config overrides set */}}
{{ define "sd-metrics" }}
{{/* SD has metrics and logging split. Default metrics are enabled if SD is enabled and there are no config overrides set */}}
{{ define "default-sd-metrics" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.stackdriver.enabled
Expand All @@ -22,14 +22,14 @@
{{- end }}

{{/* SD has metrics and logging split. */}}
{{ define "sd-logs" }}
{{ define "default-sd-logs" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.stackdriver.enabled
(not (or
.Values.telemetry.v2.stackdriver.configOverride
(has .Values.telemetry.v2.stackdriver.outboundAccessLogging (list "" "ERRORS_ONLY"))
(has .Values.telemetry.v2.stackdriver.inboundAccessLogging (list "" "ALL"))
(has .Values.telemetry.v2.stackdriver.inboundAccessLogging (list "" "FULL"))
.Values.telemetry.v2.stackdriver.disableOutbound ))
}}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# is processed as if it were declared in the leaf namespace.
rootNamespace: {{ .Values.meshConfig.rootNamespace | default .Values.global.istioNamespace }}

{{ $prom := include "prometheus" . | eq "true" }}
{{ $sdMetrics := include "sd-metrics" . | eq "true" }}
{{ $sdLogs := include "sd-logs" . | eq "true" }}
{{ $prom := include "default-prometheus" . | eq "true" }}
{{ $sdMetrics := include "default-sd-metrics" . | eq "true" }}
{{ $sdLogs := include "default-sd-logs" . | eq "true" }}
{{- if or $prom $sdMetrics $sdLogs }}
defaultProviders:
{{- if or $prom $sdMetrics }}
metrics:
{{ if $prom }}- prometheus{{ end }}
{{ if $sdMetrics }}- stackdriver{{ end }}
{{ if and $sdMetrics $sdLogs }}- stackdriver{{ end }}
{{- end }}
{{- if $sdLogs }}
{{- if and $sdMetrics $sdLogs }}
accessLogging:
- stackdriver
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
12 changes: 6 additions & 6 deletions manifests/charts/istiod-remote/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* Prometheus is enabled if its enabled and there are no config overrides set */}}
{{ define "prometheus" }}
{{/* Default Prometheus is enabled if its enabled and there are no config overrides set */}}
{{ define "default-prometheus" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.prometheus.enabled
Expand All @@ -10,8 +10,8 @@
)) }}
{{- end }}

{{/* SD has metrics and logging split. Metrics are enabled if SD is enabled and there are no config overrides set */}}
{{ define "sd-metrics" }}
{{/* SD has metrics and logging split. Default metrics are enabled if SD is enabled and there are no config overrides set */}}
{{ define "default-sd-metrics" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.stackdriver.enabled
Expand All @@ -22,14 +22,14 @@
{{- end }}

{{/* SD has metrics and logging split. */}}
{{ define "sd-logs" }}
{{ define "default-sd-logs" }}
{{- and
(not .Values.meshConfig.defaultProviders)
.Values.telemetry.enabled .Values.telemetry.v2.enabled .Values.telemetry.v2.stackdriver.enabled
(not (or
.Values.telemetry.v2.stackdriver.configOverride
(has .Values.telemetry.v2.stackdriver.outboundAccessLogging (list "" "ERRORS_ONLY"))
(has .Values.telemetry.v2.stackdriver.inboundAccessLogging (list "" "ALL"))
(has .Values.telemetry.v2.stackdriver.inboundAccessLogging (list "" "FULL"))
.Values.telemetry.v2.stackdriver.disableOutbound ))
}}
{{- end }}
10 changes: 5 additions & 5 deletions manifests/charts/istiod-remote/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# is processed as if it were declared in the leaf namespace.
rootNamespace: {{ .Values.meshConfig.rootNamespace | default .Values.global.istioNamespace }}

{{ $prom := include "prometheus" . | eq "true" }}
{{ $sdMetrics := include "sd-metrics" . | eq "true" }}
{{ $sdLogs := include "sd-logs" . | eq "true" }}
{{ $prom := include "default-prometheus" . | eq "true" }}
{{ $sdMetrics := include "default-sd-metrics" . | eq "true" }}
{{ $sdLogs := include "default-sd-logs" . | eq "true" }}
{{- if or $prom $sdMetrics $sdLogs }}
defaultProviders:
{{- if or $prom $sdMetrics }}
metrics:
{{ if $prom }}- prometheus{{ end }}
{{ if $sdMetrics }}- stackdriver{{ end }}
{{ if and $sdMetrics $sdLogs }}- stackdriver{{ end }}
{{- end }}
{{- if $sdLogs }}
{{- if and $sdMetrics $sdLogs }}
accessLogging:
- stackdriver
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions manifests/charts/istiod-remote/templates/telemetryv2_1.18.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
10 changes: 5 additions & 5 deletions manifests/charts/istiod-remote/templates/telemetryv2_1.19.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
10 changes: 5 additions & 5 deletions manifests/charts/istiod-remote/templates/telemetryv2_1.20.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
10 changes: 5 additions & 5 deletions manifests/charts/istiod-remote/templates/telemetryv2_1.21.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.telemetry.enabled .Values.telemetry.v2.enabled }}
{{ $prom := not (include "prometheus" . | eq "true") }}
{{ $sdMetrics := not (include "sd-metrics" . | eq "true") }}
{{ $sdLogs := not (include "sd-logs" . | eq "true") }}
{{ $customProm := not (include "default-prometheus" . | eq "true") }}
{{ $customSdMetrics := not (include "default-sd-metrics" . | eq "true") }}
{{ $customSdLogs := not (include "default-sd-logs" . | eq "true") }}
---
# Note: http stats filter is wasm enabled only in sidecars.
{{- if and .Values.telemetry.v2.prometheus.enabled $prom }}
{{- if and .Values.telemetry.v2.prometheus.enabled $customProm }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
---
{{- end }}
{{/*TODO: this is broken, we do not handle the split quite right! */}}
{{- if and .Values.telemetry.v2.stackdriver.enabled $sdLogs $sdMetrics }}
{{- if and .Values.telemetry.v2.stackdriver.enabled (or $customSdLogs $customSdMetrics) }}
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/fix-stackdriver-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: release-notes/v2
kind: bug-fix
area: installation
releaseNotes:
- |
**Fixed** an issue where installing with Stackdriver and having custom configs would lead to Stackdriver not being enabled.

0 comments on commit cd981f4

Please sign in to comment.