Additional Validation on Include/Exclude

- Adding in additional test to ensure *Namespaces attributes
don't directly conflict logically with one another
- Additional PR changes around naming/typos

Signed-off-by: Justin Nauman <justin.r.nauman@gmail.com>
This commit is contained in:
Justin Nauman
2017-09-05 17:17:46 -05:00
parent af2a792a9a
commit b50a046370
3 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -39,6 +39,7 @@ import (
informers "github.com/heptio/ark/pkg/generated/informers/externalversions/ark/v1"
listers "github.com/heptio/ark/pkg/generated/listers/ark/v1"
"github.com/heptio/ark/pkg/restore"
"github.com/heptio/ark/pkg/util/collections"
)
type restoreController struct {
@@ -286,7 +287,11 @@ func (controller *restoreController) getValidationErrors(itm *api.Restore) []str
}
if len(itm.Spec.Namespaces) > 0 && len(itm.Spec.IncludedNamespaces) > 0 {
validationErrors = append(validationErrors, "Namespace and ItemNamespaces can not both be defined on the backup spec.")
validationErrors = append(validationErrors, "Namespaces and IncludedNamespaces can not both be defined on the backup spec.")
}
for err := range collections.ValidateIncludesExcludes(itm.Spec.IncludedNamespaces, itm.Spec.ExcludedNamespaces) {
validationErrors = append(validationErrors, fmt.Sprintf("Invalid included/excluded namespace lists: %v", err))
}
if !controller.pvProviderExists && itm.Spec.RestorePVs != nil && *itm.Spec.RestorePVs {