Skip to content

Commit efa90be

Browse files
committed
Update doc, comments, flakyness and fix code review
1 parent 0dd8b4e commit efa90be

File tree

10 files changed

+11
-19
lines changed

10 files changed

+11
-19
lines changed

docs/integrate-operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The MySQL operator provides 3 services to access the nodes:
2222
* `<cluster_name>-mysql-master` is the service that points to the master node and this endpoint
2323
should be used for writes. This service is usually used to construct the DSN.
2424

25-
* `<cluster_name>-mysql` is the service that routes traffic to all the _healthy_ nodes from the
25+
* `<cluster_name>-mysql` is the service that routes traffic to _all healthy_ nodes from the
2626
cluster. You should use this endpoint for reads.
2727

2828
* `mysql` is the service used internally to access all nodes within a namespace. You can use this

docs/operator-upgrades.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ This upgrade requires a Kubernetes cluster upgrade because the `v0.2.x` works on
3333

3434
## v0.3.x upgrade
3535

36-
This version works on Kubernetes grater or equal with `1.11`. The upgrade should be done on staging
36+
This version requires at list Kubernetes `1.11`. The upgrade should be tried on staging environment
3737
first because it's with downtime. It requires the deletion of the statefulset and recreation of it.
38-
The reason behind is that we changed the headless service name (which is an invariant statefulset
38+
The reason behind is that we changed the headless service name (which is an immutable statefulset
3939
field) to make it smaller that will prevent you from hitting this
4040
[bug](https://github.com/presslabs/mysql-operator/issues/170).
4141

pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/mysql/v1alpha1/zz_generated.defaults.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/mysqlcluster/internal/syncer/statefullset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func (s *sfsSyncer) ensureContainersSpec() []core.Container {
282282
fmt.Sprintf("--defaults-file=%s", confClientPath),
283283
"-e",
284284
// nolint: gosec
285-
fmt.Sprintf("SELECT * FROM %s.%s WHERE name='configured' AND value='1'",
285+
fmt.Sprintf("SELECT true as 'ready' FROM %s.%s WHERE name='configured' AND value='1'",
286286
constants.OperatorDbName, constants.OperatorStatusTableName),
287287
},
288288
},

pkg/controller/node/node_ctrl_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ var _ = Describe("MysqlNode controller", func() {
119119
By("create the MySQL cluster")
120120
Expect(c.Create(context.TODO(), secret)).To(Succeed())
121121
Expect(c.Create(context.TODO(), cluster.Unwrap())).To(Succeed())
122+
// ensure that cluster is created, else test may be flaky
123+
Eventually(testutil.RefreshFn(c, cluster.Unwrap())).ShouldNot(BeNil())
122124

123125
By("create MySQL pod")
124126
getOrCreatePod(c, cluster, 0)

pkg/controller/node/sql.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ func (r *nodeSQLRunner) readStatusValue(ctx context.Context, key string) (string
246246

247247
var value string
248248
if err := r.readFromMysql(ctx, qq, &value); err != nil {
249-
// if no rows found then continue to add GTID purged
250249
if err != sql.ErrNoRows {
251250
return "", err
252251
}

pkg/internal/mysqlcluster/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ func (c *MysqlCluster) Validate() error {
3333

3434
// volume spec should be specified on the cluster
3535
vs := c.Spec.VolumeSpec
36-
if anyNull(vs.PersistentVolumeClaim, vs.HostPath, vs.EmptyDir) {
36+
if anyIsNull(vs.PersistentVolumeClaim, vs.HostPath, vs.EmptyDir) {
3737
return fmt.Errorf("no .spec.volumeSpec is specified")
3838
}
3939

4040
return nil
4141
}
4242

4343
// anyNull checks if any of the given parameters is null and returns true if so
44-
func anyNull(vars ...interface{}) bool {
44+
func anyIsNull(vars ...interface{}) bool {
4545
isNull := false
4646
for _, v := range vars {
4747
isNull = isNull || v == nil

pkg/sidecar/appconf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func initFileQuery(cfg *Config, gtidPurged string) []byte {
185185
CREATE TABLE IF NOT EXISTS %[1]s.%[2]s (
186186
name varchar(64) PRIMARY KEY,
187187
value varchar(512) NOT NULL
188-
)`, constants.OperatorDbName, constants.OperatorStatusTableName))
188+
) ENGINE=CSV `, constants.OperatorDbName, constants.OperatorStatusTableName))
189189

190190
// mark node as not configured at startup, the operator will mark it configured
191191
// nolint: gosec

test/e2e/cluster/cluster.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,6 @@ var _ = Describe("Mysql cluster tests", func() {
131131
It("scale down a cluster", func() {
132132
// configure MySQL cluster to have 2 replicas and to use PV for data storage
133133
cluster.Spec.Replicas = &two
134-
// cluster.Spec.VolumeSpec.EmptyDir = nil
135-
// cluster.Spec.VolumeSpec.HostPath = nil
136-
// cluster.Spec.VolumeSpec.PersistentVolumeClaim = &core.PersistentVolumeClaimSpec{
137-
// Resources: core.ResourceRequirements{
138-
// Requests: core.ResourceList{
139-
// core.ResourceStorage: resource.MustParse("1Gi"),
140-
// },
141-
// },
142-
// }
143134
Expect(f.Client.Update(context.TODO(), cluster)).To(Succeed())
144135

145136
// test cluster to be ready

0 commit comments

Comments
 (0)