@@ -19,6 +19,34 @@ const (
1919
2020// ValidateNamespaceStore validates namespacestore configuration
2121func ValidateNamespaceStore (nsStore * nbv1.NamespaceStore ) error {
22+ // ensure that the Spec contains the expected sub-spec for the declared type
23+ switch nsStore .Spec .Type {
24+ case nbv1 .NSStoreTypeAWSS3 :
25+ if nsStore .Spec .AWSS3 == nil {
26+ return util.ValidationError {Msg : "AWSS3 spec must be provided for type aws-s3" }
27+ }
28+ case nbv1 .NSStoreTypeS3Compatible :
29+ if nsStore .Spec .S3Compatible == nil {
30+ return util.ValidationError {Msg : "S3Compatible spec must be provided for type s3-compatible" }
31+ }
32+ case nbv1 .NSStoreTypeIBMCos :
33+ if nsStore .Spec .IBMCos == nil {
34+ return util.ValidationError {Msg : "IBMCos spec must be provided for type ibm-cos" }
35+ }
36+ case nbv1 .NSStoreTypeAzureBlob :
37+ if nsStore .Spec .AzureBlob == nil {
38+ return util.ValidationError {Msg : "AzureBlob spec must be provided for type azure-blob" }
39+ }
40+ case nbv1 .NSStoreTypeGoogleCloudStorage :
41+ if nsStore .Spec .GoogleCloudStorage == nil {
42+ return util.ValidationError {Msg : "GoogleCloudStorage spec must be provided for type google-cloud-storage" }
43+ }
44+ case nbv1 .NSStoreTypeNSFS :
45+ if nsStore .Spec .NSFS == nil {
46+ return util.ValidationError {Msg : "NSFS spec must be provided for type nsfs" }
47+ }
48+ }
49+
2250 if err := ValidateNSEmptySecretName (* nsStore ); err != nil {
2351 return err
2452 }
0 commit comments