@@ -28,8 +28,10 @@ import (
28
28
"fmt"
29
29
"reflect"
30
30
31
+ "github.com/arangodb/kube-arangodb/pkg/util/errors"
32
+
31
33
"github.com/arangodb/kube-arangodb/pkg/util"
32
- "github.com/pkg/errors"
34
+
33
35
core "k8s.io/api/core/v1"
34
36
)
35
37
@@ -44,7 +46,7 @@ func validatePullPolicy(v core.PullPolicy) error {
44
46
case "" , core .PullAlways , core .PullNever , core .PullIfNotPresent :
45
47
return nil
46
48
default :
47
- return maskAny (errors .Wrapf (ValidationError , "Unknown pull policy: '%s'" , string (v )))
49
+ return errors . WithStack (errors .Wrapf (ValidationError , "Unknown pull policy: '%s'" , string (v )))
48
50
}
49
51
}
50
52
@@ -328,64 +330,64 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
328
330
// Return errors when validation fails, nil on success.
329
331
func (s * DeploymentSpec ) Validate () error {
330
332
if err := s .GetMode ().Validate (); err != nil {
331
- return maskAny (errors .Wrap (err , "spec.mode" ))
333
+ return errors . WithStack (errors .Wrap (err , "spec.mode" ))
332
334
}
333
335
if err := s .GetEnvironment ().Validate (); err != nil {
334
- return maskAny (errors .Wrap (err , "spec.environment" ))
336
+ return errors . WithStack (errors .Wrap (err , "spec.environment" ))
335
337
}
336
338
if err := s .GetStorageEngine ().Validate (); err != nil {
337
- return maskAny (errors .Wrap (err , "spec.storageEngine" ))
339
+ return errors . WithStack (errors .Wrap (err , "spec.storageEngine" ))
338
340
}
339
341
if err := validatePullPolicy (s .GetImagePullPolicy ()); err != nil {
340
- return maskAny (errors .Wrap (err , "spec.imagePullPolicy" ))
342
+ return errors . WithStack (errors .Wrap (err , "spec.imagePullPolicy" ))
341
343
}
342
344
if s .GetImage () == "" {
343
- return maskAny (errors .Wrapf (ValidationError , "spec.image must be set" ))
345
+ return errors . WithStack (errors .Wrapf (ValidationError , "spec.image must be set" ))
344
346
}
345
347
if err := s .ExternalAccess .Validate (); err != nil {
346
- return maskAny (errors .Wrap (err , "spec.externalAccess" ))
348
+ return errors . WithStack (errors .Wrap (err , "spec.externalAccess" ))
347
349
}
348
350
if err := s .RocksDB .Validate (); err != nil {
349
- return maskAny (errors .Wrap (err , "spec.rocksdb" ))
351
+ return errors . WithStack (errors .Wrap (err , "spec.rocksdb" ))
350
352
}
351
353
if err := s .Authentication .Validate (false ); err != nil {
352
- return maskAny (errors .Wrap (err , "spec.auth" ))
354
+ return errors . WithStack (errors .Wrap (err , "spec.auth" ))
353
355
}
354
356
if err := s .TLS .Validate (); err != nil {
355
- return maskAny (errors .Wrap (err , "spec.tls" ))
357
+ return errors . WithStack (errors .Wrap (err , "spec.tls" ))
356
358
}
357
359
if err := s .Sync .Validate (s .GetMode ()); err != nil {
358
- return maskAny (errors .Wrap (err , "spec.sync" ))
360
+ return errors . WithStack (errors .Wrap (err , "spec.sync" ))
359
361
}
360
362
if err := s .Single .Validate (ServerGroupSingle , s .GetMode ().HasSingleServers (), s .GetMode (), s .GetEnvironment ()); err != nil {
361
- return maskAny (err )
363
+ return errors . WithStack (err )
362
364
}
363
365
if err := s .Agents .Validate (ServerGroupAgents , s .GetMode ().HasAgents (), s .GetMode (), s .GetEnvironment ()); err != nil {
364
- return maskAny (err )
366
+ return errors . WithStack (err )
365
367
}
366
368
if err := s .DBServers .Validate (ServerGroupDBServers , s .GetMode ().HasDBServers (), s .GetMode (), s .GetEnvironment ()); err != nil {
367
- return maskAny (err )
369
+ return errors . WithStack (err )
368
370
}
369
371
if err := s .Coordinators .Validate (ServerGroupCoordinators , s .GetMode ().HasCoordinators (), s .GetMode (), s .GetEnvironment ()); err != nil {
370
- return maskAny (err )
372
+ return errors . WithStack (err )
371
373
}
372
374
if err := s .SyncMasters .Validate (ServerGroupSyncMasters , s .Sync .IsEnabled (), s .GetMode (), s .GetEnvironment ()); err != nil {
373
- return maskAny (err )
375
+ return errors . WithStack (err )
374
376
}
375
377
if err := s .SyncWorkers .Validate (ServerGroupSyncWorkers , s .Sync .IsEnabled (), s .GetMode (), s .GetEnvironment ()); err != nil {
376
- return maskAny (err )
378
+ return errors . WithStack (err )
377
379
}
378
380
if err := s .Metrics .Validate (); err != nil {
379
- return maskAny (errors .Wrap (err , "spec.metrics" ))
381
+ return errors . WithStack (errors .Wrap (err , "spec.metrics" ))
380
382
}
381
383
if err := s .Chaos .Validate (); err != nil {
382
- return maskAny (errors .Wrap (err , "spec.chaos" ))
384
+ return errors . WithStack (errors .Wrap (err , "spec.chaos" ))
383
385
}
384
386
if err := s .License .Validate (); err != nil {
385
- return maskAny (errors .Wrap (err , "spec.licenseKey" ))
387
+ return errors . WithStack (errors .Wrap (err , "spec.licenseKey" ))
386
388
}
387
389
if err := s .Bootstrap .Validate (); err != nil {
388
- return maskAny (err )
390
+ return errors . WithStack (err )
389
391
}
390
392
return nil
391
393
}
0 commit comments