velero/pkg/controller
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
..
backup_controller.go Convert DownloadRequest resource/controller to kubebuilder (#3004) 2021-03-01 13:28:46 -05:00
backup_controller_test.go Use controller-runtime client to get restic secrets (#3320) 2021-02-18 10:30:52 -08:00
backup_deletion_controller.go Replace NewObjectBackupStore with interface (#3329) 2021-02-08 13:04:08 -05:00
backup_deletion_controller_test.go Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
backup_storage_location_controller.go Convert DownloadRequest resource/controller to kubebuilder (#3004) 2021-03-01 13:28:46 -05:00
backup_storage_location_controller_test.go Replace NewObjectBackupStore with interface (#3329) 2021-02-08 13:04:08 -05:00
backup_sync_controller.go Replace NewObjectBackupStore with interface (#3329) 2021-02-08 13:04:08 -05:00
backup_sync_controller_test.go Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
backup_tracker.go update license headers to Velero contributors (#1302) 2019-03-20 12:32:48 -07:00
backup_tracker_test.go update license headers to Velero contributors (#1302) 2019-03-20 12:32:48 -07:00
constants.go Centralize + rename controller names and list (#2936) 2020-10-06 13:58:56 -04:00
download_request_controller.go Convert DownloadRequest resource/controller to kubebuilder (#3004) 2021-03-01 13:28:46 -05:00
download_request_controller_test.go Convert DownloadRequest resource/controller to kubebuilder (#3004) 2021-03-01 13:28:46 -05:00
gc_controller.go Centralize + rename controller names and list (#2936) 2020-10-06 13:58:56 -04:00
gc_controller_test.go Use controller-runtime client to get restic secrets (#3320) 2021-02-18 10:30:52 -08:00
generic_controller.go wait for informer caches to sync before running controllers 2020-03-03 15:55:17 -07:00
interface.go update license headers to Velero contributors (#1302) 2019-03-20 12:32:48 -07:00
pod_volume_backup_controller.go Use Credential from BSL for restic commands (#3489) 2021-03-11 13:10:51 -05:00
pod_volume_backup_controller_test.go Centralize + rename controller names and list (#2936) 2020-10-06 13:58:56 -04:00
pod_volume_restore_controller.go Use Credential from BSL for restic commands (#3489) 2021-03-11 13:10:51 -05:00
pod_volume_restore_controller_test.go Modify InitContainer checking function that potentially incurs error (#3198) 2021-02-08 13:26:56 -05:00
restic_repository_controller.go Centralize + rename controller names and list (#2936) 2020-10-06 13:58:56 -04:00
restore_controller.go Replace NewObjectBackupStore with interface (#3329) 2021-02-08 13:04:08 -05:00
restore_controller_test.go Pass configured BSL credential to plugin via config (#3442) 2021-03-04 13:43:15 -08:00
schedule_controller.go Centralize + rename controller names and list (#2936) 2020-10-06 13:58:56 -04:00
schedule_controller_test.go pass annotations from scheduler to created backup (#3067) 2020-11-19 13:19:42 -08:00
server_status_request_controller.go Convert DownloadRequest resource/controller to kubebuilder (#3004) 2021-03-01 13:28:46 -05:00
server_status_request_controller_test.go fix(tests): make tests pass 2021-01-26 13:06:27 +02:00
suite_test.go Use controller-runtime client to get restic secrets (#3320) 2021-02-18 10:30:52 -08:00