Skip to content

Commit

Permalink
fixup! fix: read ephemeral-storage in code
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Aug 13, 2024
1 parent 2b44549 commit 559a154
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions controllers/nodeagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) {
}),
},
{
name: "invalid DPA CR with aws plugin from CloudStorage, error is returned",
name: "valid DPA CR with aws plugin from CloudStorage, NodeAgent DaemonSet is built",
dpa: createTestDpaWith(
nil,
oadpv1alpha1.DataProtectionApplicationSpec{
Expand Down Expand Up @@ -990,8 +990,8 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) {
},
},
},
nodeAgentDaemonSet: testNodeAgentDaemonSet.DeepCopy(),
errorMessage: "spec.backupLocations.velero must be provided in DPA",
nodeAgentDaemonSet: testNodeAgentDaemonSet.DeepCopy(),
wantNodeAgentDaemonSet: createTestBuiltNodeAgentDaemonSet(TestBuiltNodeAgentDaemonSetOptions{}),
},
{
name: "valid DPA CR with aws plugin and BSL, NodeAgent DaemonSet is built",
Expand Down
29 changes: 15 additions & 14 deletions pkg/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func AppendCloudProviderVolumes(dpa *oadpv1alpha1.DataProtectionApplication, ds
dpa.Spec.UnsupportedOverrides[oadpv1alpha1.OperatorTypeKey] == oadpv1alpha1.OperatorTypeMTC) { // OADP is installed via MTC

pluginNeedsCheck, foundProviderPlugin := providerNeedsDefaultCreds[string(plugin)]
// duplication with controllers/validator.go
if !foundProviderPlugin && !hasCloudStorage {
pluginNeedsCheck = true
}
Expand Down Expand Up @@ -221,24 +222,24 @@ func AppendCloudProviderVolumes(dpa *oadpv1alpha1.DataProtectionApplication, ds
}
}
for _, bslSpec := range dpa.Spec.BackupLocations {
if bslSpec.Velero == nil {
return errors.New("spec.backupLocations.velero must be provided in DPA")
}
if _, ok := bslSpec.Velero.Config["credentialsFile"]; ok {
if secretName, err := GetSecretNameFromCredentialsFileConfigString(bslSpec.Velero.Config["credentialsFile"]); err == nil {
ds.Spec.Template.Spec.Volumes = append(
ds.Spec.Template.Spec.Volumes,
corev1.Volume{
Name: secretName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: secretName,
if bslSpec.Velero != nil {
if _, ok := bslSpec.Velero.Config["credentialsFile"]; ok {
if secretName, err := GetSecretNameFromCredentialsFileConfigString(bslSpec.Velero.Config["credentialsFile"]); err == nil {
ds.Spec.Template.Spec.Volumes = append(
ds.Spec.Template.Spec.Volumes,
corev1.Volume{
Name: secretName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: secretName,
},
},
},
},
)
)
}
}
}

}
return nil
}
Expand Down

0 comments on commit 559a154

Please sign in to comment.