Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Custom Cassandra YAML and JVM options. #9

Merged
merged 11 commits into from
Nov 8, 2019
8 changes: 8 additions & 0 deletions operator/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -766,3 +766,11 @@ parameters:
- name: JVM_OPT_G1R_SET_UPDATING_PAUSE_TIME_PERCENT
description: "Have the JVM do less remembered set work during STW, instead preferring concurrent GC. Reduces p99.9 latency."
default: ""

- name: CUSTOM_CASSANDRA_YAML_BASE64
description: "Base64 encoded Cassandra properties appended to cassandra.yaml."
phrynchanka marked this conversation as resolved.
Show resolved Hide resolved
default: ""

- name: CUSTOM_JVM_OPTIONS_BASE64
description: "Base64 encoded JVM Options appended to jvm.options."
phrynchanka marked this conversation as resolved.
Show resolved Hide resolved
default: ""
4 changes: 4 additions & 0 deletions operator/templates/cassandra-yaml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1352,3 +1352,7 @@ data:
{{ if .Params.OTC_BACKLOG_EXPIRATION_INTERVAL_MS }}
otc_backlog_expiration_interval_ms: {{ .Params.OTC_BACKLOG_EXPIRATION_INTERVAL_MS }}
{{ end }}
{{ if .Params.CUSTOM_CASSANDRA_YAML_BASE64 }}
{{ .Params.CUSTOM_CASSANDRA_YAML_BASE64 | b64dec }}
{{ end }}
4 changes: 4 additions & 0 deletions operator/templates/jvm-options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,7 @@ data:
### Cassandra 4.0 which will use JDK 11.
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
{{ if .Params.CUSTOM_JVM_OPTIONS_BASE64 }}
{{ .Params.CUSTOM_JVM_OPTIONS_BASE64 | b64dec }}
{{ end }}
27 changes: 27 additions & 0 deletions tests/suites/sanity_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package suites

import (
"encoding/base64"
"fmt"
"os"
"strings"
Expand Down Expand Up @@ -85,6 +86,32 @@ var _ = Describe(TestName, func() {
Expect(configuration[parameter]).To(Equal(desiredValue))
})

It("Customize cassandra.yaml", func() {
phrynchanka marked this conversation as resolved.
Show resolved Hide resolved
parameter := "otc_backlog_expiration_interval_ms"
initialValue := "200"
desiredValue := "300"
desiredValueBase64 := base64.StdEncoding.EncodeToString([]byte("otc_backlog_expiration_interval_ms: 300"))
phrynchanka marked this conversation as resolved.
Show resolved Hide resolved
phrynchanka marked this conversation as resolved.
Show resolved Hide resolved

configuration, err := cassandra.ClusterConfiguration(
TestNamespace, TestInstance,
)
Expect(err).To(BeNil())
Expect(configuration[parameter]).To(Equal(initialValue))

err = kudo.UpdateInstanceParameters(
TestNamespace,
TestInstance,
map[string]string{"CUSTOM_CASSANDRA_YAML_BASE64": desiredValueBase64},
)
Expect(err).To(BeNil())

configuration, err = cassandra.ClusterConfiguration(
TestNamespace, TestInstance,
)
Expect(err).To(BeNil())
Expect(configuration[parameter]).To(Equal(desiredValue))
})

It("Uninstalls the operator", func() {
err := kudo.UninstallOperator(OperatorName, TestNamespace, TestInstance)
Expect(err).To(BeNil())
Expand Down