File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,8 @@ func (r *DPAReconciler) buildVeleroDeployment(veleroDeployment *appsv1.Deploymen
376376 }
377377 r .ReconcileRestoreResourcesVersionPriority (dpa )
378378
379+ // TODO! Reuse removeDuplicateValues with interface type
380+ dpa .Spec .Configuration .Velero .DefaultPlugins = removeDuplicatePluginValues (dpa .Spec .Configuration .Velero .DefaultPlugins )
379381 dpa .Spec .Configuration .Velero .FeatureFlags = removeDuplicateValues (dpa .Spec .Configuration .Velero .FeatureFlags )
380382 deploymentName := veleroDeployment .Name //saves desired deployment name before install.Deployment overwrites them.
381383 ownerRefs := veleroDeployment .OwnerReferences // saves desired owner refs
@@ -395,6 +397,21 @@ func (r *DPAReconciler) buildVeleroDeployment(veleroDeployment *appsv1.Deploymen
395397 return r .customizeVeleroDeployment (dpa , veleroDeployment )
396398}
397399
400+ func removeDuplicatePluginValues (slice []oadpv1alpha1.DefaultPlugin ) []oadpv1alpha1.DefaultPlugin {
401+ if slice == nil {
402+ return nil
403+ }
404+ keys := make (map [oadpv1alpha1.DefaultPlugin ]bool )
405+ list := []oadpv1alpha1.DefaultPlugin {}
406+ for _ , entry := range slice {
407+ if _ , found := keys [entry ]; ! found { //add entry to list if not found in keys already
408+ keys [entry ] = true
409+ list = append (list , entry )
410+ }
411+ }
412+ return list // return the result through the passed in argument
413+ }
414+
398415// remove duplicate entry in string slice
399416func removeDuplicateValues (slice []string ) []string {
400417 if slice == nil {
You can’t perform that action at this time.
0 commit comments