Skip to content

Commit

Permalink
Cassandra 3.11.7 support (#209)
Browse files Browse the repository at this point in the history
* Renaming a dir

* Updating go code to know about Cassandra 3.11.7

* Updating docs and examples

* Ran codegen
  • Loading branch information
jimdickinson committed Aug 21, 2020
1 parent 48f7038 commit ecf8157
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 55 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Quick start:
# *** This is for GKE Regular Channel - k8s 1.16 -> Adjust based on your cloud or storage options
kubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/docs/user/cass-operator-manifests-v1.16.yaml
kubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/operator/k8s-flavors/gke/storage.yaml
kubectl -n cass-operator create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml
kubectl -n cass-operator create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml
```

### Loading the operator
Expand Down Expand Up @@ -57,7 +57,7 @@ kubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0

### Creating a CassandraDatacenter

The following resource defines a Cassandra 3.11.6 datacenter with 3 nodes on one rack, which you can also find at [operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml](operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml):
The following resource defines a Cassandra 3.11.7 datacenter with 3 nodes on one rack, which you can also find at [operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml](operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml):

```yaml
apiVersion: cassandra.datastax.com/v1beta1
Expand All @@ -67,7 +67,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: 3.11.6
serverVersion: 3.11.7
managementApiAuth:
insecure: {}
size: 3
Expand All @@ -92,7 +92,7 @@ spec:
Apply the above as follows:

```console
kubectl -n cass-operator apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml
kubectl -n cass-operator apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.3.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml
```

You can check the status of pods in the Cassandra cluster as follows:
Expand Down
2 changes: 1 addition & 1 deletion buildsettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ dev:
images:
- datastax/dse-server:6.8.2
- datastax/cass-config-builder:1.0.2
- datastax/cassandra-mgmtapi-3_11_6:v0.1.5
- datastax/cassandra-mgmtapi-3_11_7:v0.1.12
Original file line number Diff line number Diff line change
Expand Up @@ -6038,6 +6038,7 @@ spec:
- 6.8.1
- 6.8.2
- 3.11.6
- 3.11.7
- 4.0.0
type: string
serviceAccount:
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/k8s_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ operator/deploy/operator.yaml,
operator/example-cassdc-yaml/dse-6.8.x/example-cassdc-minimal.yaml

# if using cassandra
operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml
operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml
```

To check the cluster status:
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/workflow_details.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: "3.11.6"
serverVersion: "3.11.7"
managementApiAuth:
insecure: {}
size: 1
Expand Down
6 changes: 3 additions & 3 deletions docs/user/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: 3.11.6
serverVersion: 3.11.7
managementApiAuth:
insecure: {}
size: 3
Expand Down Expand Up @@ -318,7 +318,7 @@ for your `CassandraDatacenter` resource, you can use the `serverType`, `serverVe
spec properties.

`serverType` is required and must be either `dse` or `cassandra`. `serverVersion` is also required,
and the supported versions for DSE are `6.8.0` through `6.8.2`, and for Cassandra it is `3.11.6`. More versions
and the supported versions for DSE are `6.8.0` through `6.8.2`, and for Cassandra it is `3.11.6`/`3.11.7`. More versions
will be supported in the future.

If `serverImage` is not specified, a default image for the provided `serverType` and
Expand Down Expand Up @@ -347,7 +347,7 @@ metadata:
name: dtcntr
spec:
serverType: cassandra
serverVersion: 3.11.6
serverVersion: 3.11.7
serverImage: private-docker-registry.example.com/cass-img/cassandra-with-mgmtapi:1a2b3c4d
```

Expand Down
2 changes: 1 addition & 1 deletion docs/user/jvm_server_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: 3.11.6
serverVersion: 3.11.7
size: 3
storageConfig:
cassandraDataVolumeClaimSpec:
Expand Down
2 changes: 1 addition & 1 deletion mage/k8s/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func SetupExampleCluster() {
func SetupCassandraCluster() {
mg.Deps(SetupExampleCluster)
kubectl.ApplyFiles(
"operator/example-cassdc-yaml/cassandra-3.11.6/example-cassdc-minimal.yaml",
"operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml",
).ExecVPanic()
kubectl.WatchPods()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6028,6 +6028,7 @@ spec:
- 6.8.1
- 6.8.2
- 3.11.6
- 3.11.7
- 4.0.0
type: string
serviceAccount:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
serverType: "cassandra"

# Which server version to use. Required.
serverVersion: "3.11.6"
serverVersion: "3.11.7"

# Use the serverImage configuration to override Cass Operator's logic to map
# the serverType plus serverVersion into a public container image on Docker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: "3.11.6"
serverVersion: "3.11.7"
managementApiAuth:
insecure: {}
size: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
clusterName: cluster1
serverType: cassandra
serverVersion: "3.11.6"
serverVersion: "3.11.7"
managementApiAuth:
insecure: {}
size: 3
Expand Down
13 changes: 10 additions & 3 deletions operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ const (
defaultConfigBuilderImage = "datastax/cass-config-builder:1.0.2"
ubi_defaultConfigBuilderImage = "datastax/cass-config-builder:1.0.2-ubi7"

cassandra_3_11_6 = "datastax/cassandra-mgmtapi-3_11_6:v0.1.5"
cassandra_4_0_0 = "datastax/cassandra-mgmtapi-4_0_0:v0.1.5"
cassandra_3_11_6 = "datastax/cassandra-mgmtapi-3_11_6:v0.1.5"
cassandra_3_11_7 = "datastax/cassandra-mgmtapi-3_11_7:v0.1.12"
cassandra_4_0_0 = "datastax/cassandra-mgmtapi-4_0_0:v0.1.5"

ubi_cassandra_3_11_6 = "datastax/cassandra:3.11.6-ubi7"
ubi_cassandra_3_11_7 = "datastax/cassandra:3.11.7-ubi7"
ubi_cassandra_4_0_0 = "datastax/cassandra:4.0-ubi7"

dse_6_8_0 = "datastax/dse-server:6.8.0"
Expand Down Expand Up @@ -109,6 +112,8 @@ func getImageForDefaultBaseOs(sv string) (string, bool) {
return dse_6_8_2, true
case "cassandra-3.11.6":
return cassandra_3_11_6, true
case "cassandra-3.11.7":
return cassandra_3_11_7, true
case "cassandra-4.0.0":
return cassandra_4_0_0, true
}
Expand All @@ -125,6 +130,8 @@ func getImageForUniversalBaseOs(sv string) (string, bool) {
return ubi_dse_6_8_2, true
case "cassandra-3.11.6":
return ubi_cassandra_3_11_6, true
case "cassandra-3.11.7":
return ubi_cassandra_3_11_7, true
case "cassandra-4.0.0":
return ubi_cassandra_4_0_0, true
}
Expand All @@ -149,7 +156,7 @@ type CassandraDatacenterSpec struct {

// Version string for config builder,
// used to generate Cassandra server configuration
// +kubebuilder:validation:Enum="6.8.0";"6.8.1";"6.8.2";"3.11.6";"4.0.0"
// +kubebuilder:validation:Enum="6.8.0";"6.8.1";"6.8.2";"3.11.6";"3.11.7";"4.0.0"
ServerVersion string `json:"serverVersion"`

// Cassandra server image name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func Test_makeImage(t *testing.T) {
args: args{
serverImage: "",
serverType: "cassandra",
serverVersion: "3.11.6",
serverVersion: "3.11.7",
},
want: "datastax/cassandra-mgmtapi-3_11_6:v0.1.5",
want: "datastax/cassandra-mgmtapi-3_11_7:v0.1.12",
errString: "",
},
{
Expand Down
2 changes: 2 additions & 0 deletions operator/pkg/apis/cassandra/v1beta1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func ValidateSingleDatacenter(dc CassandraDatacenter) error {
switch dc.Spec.ServerVersion {
case "3.11.6":
err = nil
case "3.11.7":
err = nil
case "4.0.0":
err = nil
default:
Expand Down
10 changes: 5 additions & 5 deletions operator/pkg/apis/cassandra/v1beta1/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Test_ValidateSingleDatacenter(t *testing.T) {
},
Spec: CassandraDatacenterSpec{
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
},
},
errString: "",
Expand Down Expand Up @@ -138,7 +138,7 @@ func Test_ValidateSingleDatacenter(t *testing.T) {
},
Spec: CassandraDatacenterSpec{
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
Config: json.RawMessage(`
{
"cassandra-yaml": {},
Expand All @@ -149,7 +149,7 @@ func Test_ValidateSingleDatacenter(t *testing.T) {
`),
},
},
errString: "attempted to define config dse-yaml with cassandra-3.11.6",
errString: "attempted to define config dse-yaml with cassandra-3.11.7",
},
{
name: "Cassandra 3.11 invalid config file jvm-server-options",
Expand All @@ -159,7 +159,7 @@ func Test_ValidateSingleDatacenter(t *testing.T) {
},
Spec: CassandraDatacenterSpec{
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
Config: json.RawMessage(`
{
"cassandra-yaml": {},
Expand All @@ -170,7 +170,7 @@ func Test_ValidateSingleDatacenter(t *testing.T) {
`),
},
},
errString: "attempted to define config jvm-server-options with cassandra-3.11.6",
errString: "attempted to define config jvm-server-options with cassandra-3.11.7",
},
{
name: "DSE 6.8 invalid config file jvm-options",
Expand Down
41 changes: 21 additions & 20 deletions operator/pkg/reconciliation/constructor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
package reconciliation

import (
"k8s.io/apimachinery/pkg/api/resource"
"reflect"
"testing"

"k8s.io/apimachinery/pkg/api/resource"

api "github.com/datastax/cass-operator/operator/pkg/apis/cassandra/v1beta1"
"github.com/datastax/cass-operator/operator/pkg/oplabels"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -126,7 +127,7 @@ func Test_newStatefulSetForCassandraDatacenter(t *testing.T) {
CassandraDataVolumeClaimSpec: &corev1.PersistentVolumeClaimSpec{},
},
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
},
},
},
Expand All @@ -146,14 +147,14 @@ func TestCassandraDatacenter_buildInitContainer_resources_set(t *testing.T) {
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
ConfigBuilderResources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
Requests: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
},
Expand All @@ -175,7 +176,7 @@ func TestCassandraDatacenter_buildInitContainer_resources_set_when_not_specified
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
},
}

Expand All @@ -194,14 +195,14 @@ func TestCassandraDatacenter_buildContainers_systemlogger_resources_set(t *testi
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
SystemLoggerResources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
Requests: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
},
Expand All @@ -222,7 +223,7 @@ func TestCassandraDatacenter_buildContainers_systemlogger_resources_set_when_not
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
},
}

Expand All @@ -241,16 +242,16 @@ func TestCassandraDatacenter_buildContainers_reaper_resources(t *testing.T) {
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
Resources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
Requests: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
},
Expand All @@ -272,7 +273,7 @@ func TestCassandraDatacenter_buildContainers_reaper_resources_set_when_not_speci
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
},
Expand Down Expand Up @@ -301,7 +302,7 @@ func TestCassandraDatacenter_buildPodTemplateSpec_containers_merge(t *testing.T)
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
PodTemplateSpec: &corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{testContainer}},
Expand Down Expand Up @@ -329,7 +330,7 @@ func TestCassandraDatacenter_buildPodTemplateSpec_initcontainers_merge(t *testin
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
PodTemplateSpec: &corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
InitContainers: []corev1.Container{testContainer}},
Expand All @@ -351,7 +352,7 @@ func TestCassandraDatacenter_buildPodTemplateSpec_labels_merge(t *testing.T) {
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.6",
ServerVersion: "3.11.7",
PodTemplateSpec: &corev1.PodTemplateSpec{},
},
}
Expand Down
Loading

0 comments on commit ecf8157

Please sign in to comment.