This repository was archived by the owner on Jul 26, 2022. It is now read-only.
File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,24 @@ spec:
410
410
property : value
411
411
` ` `
412
412
413
+ Due to the way Azure handles binary files, you need to explicitly let the ExternalSecret know that the secret is binary.
414
+ You can do that with the ` isBinary` field on the key. This is necessary for certificates and other secret binary files.
415
+
416
+ ` ` ` yml
417
+ apiVersion: kubernetes-client.io/v1
418
+ kind: ExternalSecret
419
+ metadata:
420
+ name: hello-keyvault-service
421
+ spec:
422
+ backendType: azureKeyVault
423
+ keyVaultName: hello-world
424
+ data:
425
+ - key: hello-service/credentials
426
+ name: password
427
+ isBinary: true
428
+ ` ` `
429
+
430
+
413
431
# # Metrics
414
432
415
433
kubernetes-external-secrets exposes the following metrics over a prometheus endpoint :
Original file line number Diff line number Diff line change 69
69
type : string
70
70
property :
71
71
description : Property to extract if secret in backend is a JSON object
72
+ isBinary :
73
+ description : >-
74
+ You must set this to true if configuring an item for a binary file stored in Azure KeyVault.
75
+ Azure automatically base64 encodes binary files and setting this to true ensures External Secrets
76
+ does not base64 encode the base64 encoded binary files.
77
+ type : boolean
72
78
required :
73
79
- name
74
80
- key
Original file line number Diff line number Diff line change @@ -26,13 +26,18 @@ class AzureKeyVaultBackend extends KVBackend {
26
26
* Get secret property value from Azure Key Vault.
27
27
* @param {string } key - Key used to store secret property value in Azure Key Vault.
28
28
* @param {string } specOptions.keyVaultName - Name of the azure key vault
29
+ * @param {string } keyOptions.isBinary - Does the secret contain a binary? Set to "true" to handle as binary. Does not work with "property"
29
30
* @returns {Promise } Promise object representing secret property value.
30
31
*/
31
32
32
- async _get ( { key, specOptions : { keyVaultName } } ) {
33
+ async _get ( { key, keyOptions , specOptions : { keyVaultName } } ) {
33
34
const client = this . _keyvaultClient ( { keyVaultName } )
34
35
this . _logger . info ( `fetching secret ${ key } from Azure KeyVault ${ keyVaultName } ` )
35
36
const secret = await client . getSecret ( key )
37
+ // Handle binary files, since the Azure client does not
38
+ if ( keyOptions && keyOptions . isBinary ) {
39
+ return Buffer . from ( secret . value , 'base64' )
40
+ }
36
41
return JSON . stringify ( secret )
37
42
}
38
43
}
You can’t perform that action at this time.
0 commit comments