@@ -76,6 +76,33 @@ otelcol.auth.bearer "metrics_service" {
76
76
token = remote.kubernetes.secret.metrics_service.data[{{ .bearerToken.tokenKey | quote }}]
77
77
}
78
78
{{- end }}
79
+ {{- else if eq .authMode "oauth2" }}
80
+ otelcol.auth.oauth2 "metrics_service" {
81
+ {{- if eq .oauth2.clientId "" }}
82
+ client_id = nonsensitive(remote.kubernetes.secret.metrics_service.data[{{ .oauth2.clientIdKey | quote }}])
83
+ {{- else }}
84
+ client_id = {{ .oauth2.clientId | quote }}
85
+ {{- end }}
86
+
87
+ {{- if eq .oauth2.clientSecretFile "" }}
88
+ client_secret = remote.kubernetes.secret.metrics_service.data[{{ .oauth2.clientSecretKey | quote }}]
89
+ {{- else }}
90
+ client_secret_file = {{ .oauth2.clientSecretFile | quote }}
91
+ {{- end }}
92
+ {{- if .oauth2.endpointParams }}
93
+ endpoint_params = {
94
+ {{- range $k, $v := .oauth2.endpointParams }}
95
+ {{ $k }} = {{ $v | quote }},
96
+ {{- end }}
97
+ }
98
+ {{- end }}
99
+ {{- if .oauth2.scopes }}
100
+ scopes = {{ .oauth2.scopes | toJson }}
101
+ {{- end }}
102
+ {{- if .oauth2.tokenURL }}
103
+ token_url = {{ required ".Values.oauth2.tokenURL is a required value when .Values.authMode is oauth2" .oauth2.tokenURL | quote }}
104
+ {{- end }}
105
+ }
79
106
{{- end }}
80
107
{{ if eq .protocol "otlp" }}
81
108
otelcol.exporter.otlp "metrics_service" {
@@ -89,6 +116,8 @@ otelcol.exporter.otlphttp "metrics_service" {
89
116
auth = otelcol.auth.basic.metrics_service.handler
90
117
{{- else if eq .authMode "bearerToken" }}
91
118
auth = otelcol.auth.bearer.metrics_service.handler
119
+ {{- else if eq .authMode "oauth2" }}
120
+ auth = otelcol.auth.oauth2.metrics_service.handler
92
121
{{- end }}
93
122
headers = {
94
123
"X-Scope-OrgID" = nonsensitive(remote.kubernetes.secret.metrics_service.data[{{ .tenantIdKey | quote }}]),
0 commit comments