Commit 372f4a8
authored
Add TLS configuration to Recommender http client (#252)
* Add TLS configuration to Recommender http client
This allows to set client certificate along with server CA allowing
the recommender server to implement mTLS and validate client certificate.
Note that this will work only with a default client implementing an
http.Transport. Any other RoundTripper will need to implement their
own TLS implementation.
The implementation here reloads the certificate and private key for
every request to a given recommender endpoint. This is to support
systems where certificate can be rotated from time to time.
* Implement certificate caching
To prevent reloading the certificate and key from disk at every new
HTTPs connection we cache the certificate in a central cache (up until
it is either expired or too old). The cache is trimmed every 10 minutes
to remove stale entries (not accessed after 10 min).
* Supports setting wpa default TLS config for the recommender API
For environment where certificates can be the same for all WPA resources,
it might be cumbersome to specify the same client certificate in all
the recommender specs.
By using the `--tls-*` option it is possible to set default CA, certificate
and key files (along with a few other TLS options) that will be used
when the recommender specs don't contain such information.
* Retry if certificate & key loaded don't match
For environments where client certificate loaded from disks are renewed
it is very possible that the certificate generator can't write both files
atomically. More care should be used when reading so that if the certificate
and the key don't match, reading is retried until there's either a match or
a failure.
* Declare the recommender tls_config in the CRD
* Refactor tests for a bit more readability
* Review fixes
* Remove LRU mentions as the cache is not an LRU cache
* Cache errors for 1 min to prevent busy looping reading invalid certs
* Review fix: reorder TLS functions
So that types and methods are close together.
* Regenerate all bundle and manifests1 parent 8b765f5 commit 372f4a8
File tree
11 files changed
+900
-14
lines changed- apis/datadoghq/v1alpha1
- bundle/manifests
- config/crd/bases
- v1beta1
- v1
- controllers/datadoghq
11 files changed
+900
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
135 | 167 | | |
136 | 168 | | |
137 | 169 | | |
| |||
141 | 173 | | |
142 | 174 | | |
143 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
144 | 180 | | |
145 | 181 | | |
146 | 182 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
316 | 348 | | |
317 | 349 | | |
318 | 350 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
316 | 348 | | |
317 | 349 | | |
318 | 350 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
306 | 333 | | |
307 | 334 | | |
308 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
51 | 66 | | |
52 | 67 | | |
53 | 68 | | |
| |||
72 | 87 | | |
73 | 88 | | |
74 | 89 | | |
75 | | - | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
79 | 100 | | |
80 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
81 | 104 | | |
82 | 105 | | |
83 | 106 | | |
84 | 107 | | |
85 | 108 | | |
86 | 109 | | |
87 | 110 | | |
88 | | - | |
| 111 | + | |
89 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
90 | 120 | | |
91 | | - | |
| 121 | + | |
92 | 122 | | |
93 | 123 | | |
94 | 124 | | |
| |||
139 | 169 | | |
140 | 170 | | |
141 | 171 | | |
142 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
143 | 176 | | |
144 | 177 | | |
145 | 178 | | |
| |||
0 commit comments