We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b51b048 commit 883d42cCopy full SHA for 883d42c
pkg/internal/mysqlcluster/validation.go
@@ -31,5 +31,20 @@ func (c *MysqlCluster) Validate() error {
31
return fmt.Errorf("%s is not a valid MySQL version", c.Spec.MysqlVersion)
32
}
33
34
+ // volume spec should be specified on the cluster
35
+ vs := c.Spec.VolumeSpec
36
+ if anyNull(vs.PersistentVolumeClaim, vs.HostPath, vs.EmptyDir) {
37
+ return fmt.Errorf("no .spec.volumeSpec is specified")
38
+ }
39
+
40
return nil
41
42
43
+// anyNull checks if any of the given parameters is null and returns true if so
44
+func anyNull(vars ...interface{}) bool {
45
+ isNull := false
46
+ for _, v := range vars {
47
+ isNull = isNull || v == nil
48
49
+ return isNull
50
+}
0 commit comments