Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OADP-425 #625

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions controllers/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,14 @@ func (r *DPAReconciler) buildRegistryDeployment(registryDeployment *appsv1.Deplo
)
}
} else if bsl.Spec.Provider == GCPProvider {
cloudProviderMap := credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP]
// check for secret name
secretName, _ := r.getSecretNameAndKey(&bsl.Spec, oadpv1alpha1.DefaultPluginGCP)
registryDeployment.Spec.Template.Spec.Volumes = []corev1.Volume{
{
Name: cloudProviderMap.SecretName,
Name: secretName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: cloudProviderMap.SecretName,
SecretName: secretName,
},
},
},
Expand Down Expand Up @@ -391,9 +392,11 @@ func (r *DPAReconciler) buildRegistryContainer(bsl *velerov1.BackupStorageLocati

// append secret volumes if the BSL provider is GCP
if bsl.Spec.Provider == GCPProvider {
// check for secret name
secretName, _ := r.getSecretNameAndKey(&bsl.Spec, oadpv1alpha1.DefaultPluginGCP)
containers[0].VolumeMounts = []corev1.VolumeMount{
{
Name: credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP].SecretName,
Name: secretName,
MountPath: credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP].MountPath,
},
}
Expand Down Expand Up @@ -526,7 +529,9 @@ func (r *DPAReconciler) getGCPRegistryEnvVars(bsl *velerov1.BackupStorageLocatio
}

if gcpEnvVars[i].Name == RegistryStorageGCSKeyfile {
gcpEnvVars[i].Value = credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP].MountPath + "/" + credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP].PluginSecretKey
// check for secret name
_, secretKey := r.getSecretNameAndKey(&bsl.Spec, oadpv1alpha1.DefaultPluginGCP)
gcpEnvVars[i].Value = credentials.PluginSpecificFields[oadpv1alpha1.DefaultPluginGCP].MountPath + "/" + secretKey
}
}
return gcpEnvVars, nil
Expand Down Expand Up @@ -1086,6 +1091,10 @@ func (r *DPAReconciler) ReconcileRegistrySecrets(log logr.Logger) (bool, error)

// Now for each of these bsl instances, create a registry secret
for _, bsl := range bslList.Items {
// skip for GCP as nothing is directly exposed in env vars
if bsl.Spec.Provider == GCPProvider {
continue
}
secret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "oadp-" + bsl.Name + "-" + bsl.Spec.Provider + "-registry-secret",
Expand Down