Skip to content

Commit

Permalink
api: forbidden lower_case_table_names modify in my.cnf #477
Browse files Browse the repository at this point in the history
  • Loading branch information
acekingke committed May 16, 2022
1 parent 4b6a47d commit e66164b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha1/mysqlcluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func (r *MysqlCluster) ValidateUpdate(old runtime.Object) error {
if oldStorageSize.Cmp(newStorageSize) == 1 {
return fmt.Errorf("storage size cannot be changed to smaller than current size")
}
oldmyconf := oldCluster.Spec.MysqlOpts.MysqlConf
newmyconf := r.Spec.MysqlOpts.MysqlConf
if oldmyconf["lower_case_table_names"] != newmyconf["lower_case_table_names"] {
return fmt.Errorf("lower_case_table_names cannot be changed")
}
// TODO(user): fill in your validation logic upon object update.
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions config/samples/mysql_v1alpha1_mysqlcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ spec:
memory: 128Mi

podPolicy:
imagePullPolicy: Always
sidecarImage: acekingke/sidecar:0.1
imagePullPolicy: IfNotPresent
sidecarImage: radondb/mysql57-sidecar:v2.2.0
busyboxImage: busybox:1.32

slowLogTail: false
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require (
github.com/go-test/deep v1.0.7
github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365
github.com/imdario/mergo v0.3.12
github.com/onsi/ginkgo v1.16.4
github.com/onsi/ginkgo/v2 v2.0.0
github.com/onsi/gomega v1.17.0
github.com/presslabs/controller-util v0.3.0
Expand Down

0 comments on commit e66164b

Please sign in to comment.