Skip to content

Commit b76ed41

Browse files
committed
WIP: Adding oauth2 support, adding processors for otlp destinations, adding a test to exercise every auth mode.
Signed-off-by: Pete Wall <pete.wall@grafana.com>
1 parent 1541c64 commit b76ed41

32 files changed

+1162
-31
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

charts/k8s-monitoring/destinations/loki-values.yaml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ proxyURL: ""
2020
tenantId: ""
2121
# -- The key for storing the tenant ID in the secret.
2222
# @section -- General
23-
tenantIdKey: "tenantId"
23+
tenantIdKey: tenantId
2424
# -- Raw config for accessing the tenant ID.
2525
# @section -- General
2626
tenantIdFrom: ""
@@ -45,17 +45,16 @@ extraLabelsFrom: {}
4545

4646
auth:
4747
# -- The type of authentication to do.
48-
# Options are "none" (default), "basic", "bearerToken".
49-
# @default -- none
48+
# Options are "none" (default), "basic", "bearerToken", "oauth2".
5049
# @section -- Authentication
51-
type: ""
50+
type: none
5251

5352
# -- The username for basic authentication.
5453
# @section -- Authentication - Basic
5554
username: ""
5655
# -- The key for storing the username in the secret.
5756
# @section -- Authentication - Basic
58-
usernameKey: "username"
57+
usernameKey: username
5958
# -- Raw config for accessing the username.
6059
# @section -- Authentication - Basic
6160
usernameFrom: ""
@@ -80,6 +79,52 @@ auth:
8079
# @section -- Authentication - Bearer Token
8180
bearerTokenFrom: ""
8281

82+
# Authenticate to Loki using OAuth2
83+
# @section -- Authentication - OAuth2
84+
oauth2:
85+
# -- OAuth2 client ID
86+
# @section -- Authentication - OAuth2
87+
clientId: ""
88+
# -- The key for the client ID property in the secret
89+
# @section -- Authentication - OAuth2
90+
clientIdKey: clientId
91+
# -- Raw config for accessing the client ID
92+
# @section -- Authentication - OAuth2
93+
clientIdFrom: ""
94+
# -- Prometheus OAuth2 client secret
95+
# @section -- Authentication - OAuth2
96+
clientSecret: ""
97+
# -- The key for the client secret property in the secret
98+
# @section -- Authentication - OAuth2
99+
clientSecretKey: clientSecret
100+
# -- Raw config for accessing the client secret
101+
# @section -- Authentication - OAuth2
102+
clientSecretFrom: ""
103+
# -- File containing the OAuth2 client secret.
104+
# @section -- Authentication - OAuth2
105+
clientSecretFile: ""
106+
# -- Prometheus OAuth2 endpoint parameters
107+
# @section -- Authentication - OAuth2
108+
endpointParams: {}
109+
# -- HTTP proxy to send requests through.
110+
# @section -- Authentication - OAuth2
111+
proxyURL: ""
112+
# -- Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.
113+
# @section -- Authentication - OAuth2
114+
noProxy: ""
115+
# -- Use the proxy URL indicated by environment variables.
116+
# @section -- Authentication - OAuth2
117+
proxyFromEnvironment: false
118+
# -- Specifies headers to send to proxies during CONNECT requests.
119+
# @section -- Authentication - OAuth2
120+
proxyConnectHeader: {}
121+
# -- List of scopes to authenticate with.
122+
# @section -- Authentication - OAuth2
123+
scopes: []
124+
# -- URL to fetch the token from.
125+
# @section -- Authentication - OAuth2
126+
tokenURL: ""
127+
83128
secret:
84129
# -- (bool) Whether to create a secret for this Loki destination.
85130
# @default -- `true`

charts/k8s-monitoring/destinations/otlp-values.yaml

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,16 @@ extraHeadersFrom: {}
5252

5353
auth:
5454
# -- The type of authentication to do.
55-
# Options are "none" (default), "basic", "bearerToken".
56-
# @default -- none
55+
# Options are "none" (default), "basic", "bearerToken", "oauth2".
5756
# @section -- Authentication
58-
type: "none"
57+
type: none
5958

6059
# -- The username for basic authentication.
6160
# @section -- Authentication - Basic
6261
username: ""
6362
# -- The key for storing the username in the secret.
6463
# @section -- Authentication - Basic
65-
usernameKey: "username"
64+
usernameKey: username
6665
# -- Raw config for accessing the username.
6766
# @section -- Authentication - Basic
6867
usernameFrom: ""
@@ -72,7 +71,7 @@ auth:
7271
password: ""
7372
# -- The key for storing the password in the secret.
7473
# @section -- Authentication - Basic
75-
passwordKey: "password"
74+
passwordKey: password
7675
# -- Raw config for accessing the password.
7776
# @section -- Authentication - Basic
7877
passwordFrom: ""
@@ -82,11 +81,57 @@ auth:
8281
bearerToken: ""
8382
# -- The key for storing the bearer token in the secret.
8483
# @section -- Authentication - Bearer Token
85-
bearerTokenKey: "bearerToken"
84+
bearerTokenKey: bearerToken
8685
# -- Raw config for accessing the bearer token.
8786
# @section -- Authentication - Bearer Token
8887
bearerTokenFrom: ""
8988

89+
# Authenticate to Prometheus using OAuth2
90+
# @section -- Authentication - OAuth2
91+
oauth2:
92+
# -- OAuth2 client ID
93+
# @section -- Authentication - OAuth2
94+
clientId: ""
95+
# -- The key for the client ID property in the secret
96+
# @section -- Authentication - OAuth2
97+
clientIdKey: clientId
98+
# -- Raw config for accessing the client ID
99+
# @section -- Authentication - OAuth2
100+
clientIdFrom: ""
101+
# -- Prometheus OAuth2 client secret
102+
# @section -- Authentication - OAuth2
103+
clientSecret: ""
104+
# -- The key for the client secret property in the secret
105+
# @section -- Authentication - OAuth2
106+
clientSecretKey: clientSecret
107+
# -- Raw config for accessing the client secret
108+
# @section -- Authentication - OAuth2
109+
clientSecretFrom: ""
110+
# -- File containing the OAuth2 client secret.
111+
# @section -- Authentication - OAuth2
112+
clientSecretFile: ""
113+
# -- Prometheus OAuth2 endpoint parameters
114+
# @section -- Authentication - OAuth2
115+
endpointParams: {}
116+
# -- HTTP proxy to send requests through.
117+
# @section -- Authentication - OAuth2
118+
proxyURL: ""
119+
# -- Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.
120+
# @section -- Authentication - OAuth2
121+
noProxy: ""
122+
# -- Use the proxy URL indicated by environment variables.
123+
# @section -- Authentication - OAuth2
124+
proxyFromEnvironment: false
125+
# -- Specifies headers to send to proxies during CONNECT requests.
126+
# @section -- Authentication - OAuth2
127+
proxyConnectHeader: {}
128+
# -- List of scopes to authenticate with.
129+
# @section -- Authentication - OAuth2
130+
scopes: []
131+
# -- URL to fetch the token from.
132+
# @section -- Authentication - OAuth2
133+
tokenURL: ""
134+
90135
secret:
91136
# -- (bool) Whether to create a secret for this Prometheus destination.
92137
# @default -- `true`
@@ -148,3 +193,54 @@ readBufferSize: ""
148193
# -- Size of the write buffer the gRPC client to use for writing requests.
149194
# @section -- General
150195
writeBufferSize: ""
196+
197+
# -- Processors to apply to the data before sending it.
198+
processors:
199+
batch:
200+
# -- Whether to use a batch processor.
201+
# @section -- Batch Processor
202+
enabled: true
203+
# -- Amount of data to buffer before flushing the batch.
204+
# @section -- Batch Processor
205+
size: 8192
206+
# -- Upper limit of a batch size. When set to 0, there is no upper limit.
207+
# @section -- Batch Processor
208+
maxSize: 0
209+
# -- How long to wait before flushing the batch.
210+
# @section -- Batch Processor
211+
timeout: 2s
212+
memoryLimiter:
213+
# -- Whether to use a memory limiter.
214+
# @section -- Memory Limiter
215+
enabled: true
216+
# -- How often to check memory usage.
217+
# @section -- Memory Limiter
218+
checkInterval: 1s
219+
# -- Maximum amount of memory targeted to be allocated by the process heap.
220+
# @section -- Memory Limiter
221+
limit: 0MiB
222+
transform:
223+
# -- Whether to use a transform processor.
224+
# @section -- Transform Processor
225+
enabled: false
226+
227+
# -- Metric transforms
228+
# @section -- Transform Processor
229+
metrics:
230+
resource: []
231+
metric: []
232+
datapoint: []
233+
234+
# -- Log transforms
235+
# @section -- Transform Processor
236+
log:
237+
resource: []
238+
log: []
239+
labels: []
240+
241+
# -- Trace transforms
242+
# @section -- Transform Processor
243+
traces:
244+
resource: []
245+
span: []
246+
spanevent: []

charts/k8s-monitoring/destinations/prometheus-values.yaml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ proxyURL: ""
2020
tenantId: ""
2121
# -- The key for storing the tenant ID in the secret.
2222
# @section -- General
23-
tenantIdKey: "tenantId"
23+
tenantIdKey: tenantId
2424
# -- Raw config for accessing the tenant ID.
2525
# @section -- General
2626
tenantIdFrom: ""
@@ -54,17 +54,16 @@ metricProcessingRules: ""
5454

5555
auth:
5656
# -- The type of authentication to do.
57-
# Options are "none" (default), "basic", "bearerToken", "sigv4".
58-
# @default -- none
57+
# Options are "none" (default), "basic", "bearerToken", "oauth2", "sigv4".
5958
# @section -- Authentication
60-
type: "none"
59+
type: none
6160

6261
# -- The username for basic authentication.
6362
# @section -- Authentication - Basic
6463
username: ""
6564
# -- The key for storing the username in the secret.
6665
# @section -- Authentication - Basic
67-
usernameKey: "username"
66+
usernameKey: username
6867
# -- Raw config for accessing the username.
6968
# @section -- Authentication - Basic
7069
usernameFrom: ""
@@ -74,7 +73,7 @@ auth:
7473
password: ""
7574
# -- The key for storing the password in the secret.
7675
# @section -- Authentication - Basic
77-
passwordKey: "password"
76+
passwordKey: password
7877
# -- Raw config for accessing the password.
7978
# @section -- Authentication - Basic
8079
passwordFrom: ""
@@ -84,19 +83,65 @@ auth:
8483
bearerToken: ""
8584
# -- The key for storing the bearer token in the secret.
8685
# @section -- Authentication - Bearer Token
87-
bearerTokenKey: "bearerToken"
86+
bearerTokenKey: bearerToken
8887
# -- Raw config for accessing the bearer token.
8988
# @section -- Authentication - Bearer Token
9089
bearerTokenFrom: ""
9190

91+
# Authenticate to Prometheus using OAuth2
92+
# @section -- Authentication - OAuth2
93+
oauth2:
94+
# -- OAuth2 client ID
95+
# @section -- Authentication - OAuth2
96+
clientId: ""
97+
# -- The key for the client ID property in the secret
98+
# @section -- Authentication - OAuth2
99+
clientIdKey: clientId
100+
# -- Raw config for accessing the client ID
101+
# @section -- Authentication - OAuth2
102+
clientIdFrom: ""
103+
# -- Prometheus OAuth2 client secret
104+
# @section -- Authentication - OAuth2
105+
clientSecret: ""
106+
# -- The key for the client secret property in the secret
107+
# @section -- Authentication - OAuth2
108+
clientSecretKey: clientSecret
109+
# -- Raw config for accessing the client secret
110+
# @section -- Authentication - OAuth2
111+
clientSecretFrom: ""
112+
# -- File containing the OAuth2 client secret.
113+
# @section -- Authentication - OAuth2
114+
clientSecretFile: ""
115+
# -- Prometheus OAuth2 endpoint parameters
116+
# @section -- Authentication - OAuth2
117+
endpointParams: {}
118+
# -- HTTP proxy to send requests through.
119+
# @section -- Authentication - OAuth2
120+
proxyURL: ""
121+
# -- Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.
122+
# @section -- Authentication - OAuth2
123+
noProxy: ""
124+
# -- Use the proxy URL indicated by environment variables.
125+
# @section -- Authentication - OAuth2
126+
proxyFromEnvironment: false
127+
# -- Specifies headers to send to proxies during CONNECT requests.
128+
# @section -- Authentication - OAuth2
129+
proxyConnectHeader: {}
130+
# -- List of scopes to authenticate with.
131+
# @section -- Authentication - OAuth2
132+
scopes: []
133+
# -- URL to fetch the token from.
134+
# @section -- Authentication - OAuth2
135+
tokenURL: ""
136+
92137
# Authentication using AWS Signature Version 4
93138
sigv4:
94139
# -- The access key for sigv4 authentication.
95140
# @section -- Authentication - SigV4
96141
accessKey: ""
97142
# -- The key for storing the access key in the secret.
98143
# @section -- Authentication - SigV4
99-
accessKeyKey: "accessKey"
144+
accessKeyKey: accessKey
100145
# -- Raw config for accessing the access key.
101146
# @section -- Authentication - SigV4
102147
accessKeyFrom: ""
@@ -106,7 +151,7 @@ auth:
106151
secretKey: ""
107152
# -- The key for storing the secret key in the secret.
108153
# @section -- Authentication - Sig
109-
secretKeyKey: "secretKey"
154+
secretKeyKey: secretKey
110155
# -- Raw config for accessing the secret key.
111156
# @section -- Authentication - SigV4
112157
secretKeyFrom: ""

0 commit comments

Comments
 (0)