velero/pkg
Bridget McErlean 9ffffda11e
Use Credential from BSL for restic commands (#3489)
* Use Credential from BSL for restic commands

This change introduces support for restic to make use of per-BSL
credentials. It makes use of the `credentials.FileStore` introduced in
PR #3442 to write the BSL credentials to disk. To support per-BSL
credentials for restic, the environment for the restic commands needs to
be modified for each provider to ensure that the credentials are
provided via the correct provider specific environment variables.
This change introduces a new function `restic.CmdEnv` to check the BSL
provider and create the correct mapping of environment variables for
each provider.

Previously, AWS and GCP could rely on the environment variables in the
Velero deployments to obtain the credentials file, but now these
environment variables need to be set with the path to the serialized
credentials file if a credential is set on the BSL.

For Azure, the credentials file in the environment was loaded and parsed
to set the environment variables for restic. Now, we check if the BSL
has a credential, and if it does, load and parse that file instead.

This change also introduces a few other small improvements. Now that we
are fetching the BSL to check for the `Credential` field, we can use the
BSL directly to get the `CACert` which means that we can remove the
`GetCACert` function. Also, now that we have a way to serialize secrets
to disk, we can use the `credentials.FileStore` to get a temp file for
the restic repo password and remove the `restic.TempCredentialsFile`
function.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>

* Add documentation for per-BSL credentials

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>

* Address review feedback

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>

* Address review comments

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-03-11 13:10:51 -05:00
..
apis/velero/v1 Partially revert adding credentials to VSL (#3561) 2021-03-11 10:10:27 -08:00
archive Restore API group version by priority (#3133) 2021-02-16 12:36:17 -05:00
backup 🐛 Do not run ItemAction plugins for unresolvable types for all types (#3059) 2020-11-11 09:50:57 -05:00
builder Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
buildinfo update license headers to Velero contributors (#1302) 2019-03-20 12:32:48 -07:00
client Support cli uninstall (#3399) 2021-03-04 14:16:40 -05:00
cmd Use Credential from BSL for restic commands (#3489) 2021-03-11 13:10:51 -05:00
controller Use Credential from BSL for restic commands (#3489) 2021-03-11 13:10:51 -05:00
discovery fix EnableAPIGroupersions output log format (#2882) 2020-09-01 13:50:44 -04:00
features Add features package (#1849) 2019-09-18 10:57:04 -06:00
generated Remove unneeded auto-generated files (#2732) 2020-07-20 15:37:27 -07:00
install Support cli uninstall (#3399) 2021-03-04 14:16:40 -05:00
kuberesource restore proper lowercase/plural CRD resource (#2949) 2020-10-02 09:48:12 -04:00
label Bug fix: Calculate label using backup name for CSI objects (#2510) 2020-05-07 11:56:13 -07:00
metrics Modify function name typo (#3106) 2020-11-23 11:28:34 -05:00
persistence Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
plugin Update in-code documentation to show resources can be specified with group name (#3498) 2021-03-01 13:24:11 -05:00
podexec update to k8s 1.17 deps and fix breaks (#2180) 2020-01-10 08:55:58 -08:00
restic Use Credential from BSL for restic commands (#3489) 2021-03-11 13:10:51 -05:00
restore Restore progress reporting (#3125) 2021-03-04 16:21:44 -05:00
test Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
util Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
volume Fix various typos found by codespell (#3057) 2020-11-10 11:48:35 -05:00