Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit 2c35780

Browse files
author
Simon Lord
committed
Allow any version string to be used in spec
Fixes #120 (once tagged and released as 0.1.1)
1 parent 7f15250 commit 2c35780

File tree

6 files changed

+8
-38
lines changed

6 files changed

+8
-38
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ USE_GLOBAL_NAMESPACE ?= false
1616

1717
ifdef WERCKER
1818
# Insert swear words about mysql group replication and hostname length. Arghh..
19-
VERSION := ${WERCKER_GIT_COMMIT}
19+
VERSION ?= ${WERCKER_GIT_COMMIT}
2020
TENANT := "oracle"
2121
else
2222
NEW_NAMESPACE ?= e2e-${USER}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: "mysql.oracle.com/v1"
2+
kind: MySQLCluster
3+
metadata:
4+
name: mysql-cluster-5-7-22
5+
spec:
6+
version: 5.7.22-1.1.5

pkg/apis/mysql/v1/cluster.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ const (
2929
// ClusterCRDResourcePlural defines the custom resource name for mysqlclusters
3030
const ClusterCRDResourcePlural = "mysqlclusters"
3131

32-
// TODO (owain) we need to remove this because it's not reasonable for us to maintain a list
33-
// of all the potential MySQL versions that can be used and in reality, it shouldn't matter
34-
// too much. The burden of this is not worth the benfit to a user
35-
var validVersions = []string{
36-
defaultVersion,
37-
}
38-
3932
// MySQLClusterSpec defines the attributes a user can specify when creating a cluster
4033
type MySQLClusterSpec struct {
4134
// Version defines the MySQL Docker image version.

pkg/apis/mysql/v1/cluster_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,8 @@ import (
1818
"testing"
1919

2020
corev1 "k8s.io/api/core/v1"
21-
"k8s.io/apimachinery/pkg/util/validation/field"
2221
)
2322

24-
func TestValidVersion(t *testing.T) {
25-
for _, version := range validVersions {
26-
errList := validateVersion(version, field.NewPath("spec", "version"))
27-
if len(errList) > 0 {
28-
t.Fail()
29-
}
30-
}
31-
}
32-
33-
func TestInvalidVersion(t *testing.T) {
34-
err := validateVersion("1.2.3", field.NewPath("spec", "version"))
35-
if err == nil {
36-
t.Fail()
37-
}
38-
}
39-
4023
func TestDefaultReplicas(t *testing.T) {
4124
cluster := &MySQLCluster{}
4225
cluster.EnsureDefaults()

pkg/apis/mysql/v1/validate_cluster.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ func validateCluster(c *MySQLCluster) field.ErrorList {
2828
func validateClusterSpec(s MySQLClusterSpec, fldPath *field.Path) field.ErrorList {
2929
allErrs := field.ErrorList{}
3030

31-
allErrs = append(allErrs, validateVersion(s.Version, fldPath.Child("version"))...)
32-
3331
return allErrs
3432
}
3533

@@ -39,16 +37,6 @@ func validateClusterStatus(s MySQLClusterStatus, fldPath *field.Path) field.Erro
3937
return allErrs
4038
}
4139

42-
func validateVersion(version string, fldPath *field.Path) field.ErrorList {
43-
allErrs := field.ErrorList{}
44-
for _, validVersion := range validVersions {
45-
if version == validVersion {
46-
return allErrs
47-
}
48-
}
49-
return append(allErrs, field.Invalid(fldPath, version, "invalid version specified"))
50-
}
51-
5240
func validatePhase(phase MySQLClusterPhase, fldPath *field.Path) field.ErrorList {
5341
allErrs := field.ErrorList{}
5442
for _, validPhase := range MySQLClusterValidPhases {

wercker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ e2e-test:
146146
name: e2e default tests
147147
code: |
148148
export KUBECONFIG="/tmp/kubeconfig"
149-
echo -n "${KUBECONFIG_VAR}" | openssl enc -base64 -d -A > "${KUBECONFIG}"
149+
echo -n "${KUBECONFIG_V0_1_VAR}" | openssl enc -base64 -d -A > "${KUBECONFIG}"
150150
ginkgo -nodes=4 -v test/e2e -- \
151151
--kubeconfig="${KUBECONFIG}" \
152152
--operator-version="$(cat dist/version.txt)" \

0 commit comments

Comments
 (0)