-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da7bab9
commit 3998b0a
Showing
2 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
apiVersion: druid.apache.org/v1alpha1 | ||
kind: Druid | ||
metadata: | ||
name: volume-expansion | ||
namespace: default | ||
spec: | ||
image: apache/druid:25.0.0 | ||
startScript: /druid.sh | ||
rollingDeploy: false | ||
securityContext: | ||
fsGroup: 1000 | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
services: | ||
- spec: | ||
type: ClusterIP | ||
commonConfigMountPath: "/opt/druid/conf/druid/cluster/_common" | ||
jvm.options: |- | ||
-server | ||
-XX:MaxDirectMemorySize=10240g | ||
-Duser.timezone=UTC | ||
-Dfile.encoding=UTF-8 | ||
-Djava.io.tmpdir=/druid/data | ||
common.runtime.properties: |- | ||
# Metadata Store | ||
druid.metadata.storage.type=derby | ||
druid.metadata.storage.connector.connectURI=jdbc:derby://localhost:1527/druid/data/derbydb/metadata.db;create=true | ||
druid.metadata.storage.connector.host=localhost | ||
druid.metadata.storage.connector.port=1527 | ||
druid.metadata.storage.connector.createTables=true | ||
# Deep Storage | ||
druid.storage.type=local | ||
druid.storage.storageDirectory=/druid/deepstorage | ||
# Service discovery | ||
druid.selectors.indexing.serviceName=druid/overlord | ||
druid.selectors.coordinator.serviceName=druid/coordinator | ||
nodes: | ||
brokers: | ||
nodeType: "broker" | ||
kind: "Deployment" | ||
druid.port: 8088 | ||
nodeConfigMountPath: "/opt/druid/conf/druid/cluster/query/broker" | ||
replicas: 1 | ||
runtime.properties: |- | ||
druid.service=druid/broker | ||
additionalContainer: | ||
- command: | ||
- /bin/sh echo hello | ||
containerName: node-level | ||
image: hello-world | ||
coordinators: | ||
nodeType: "coordinator" | ||
druid.port: 8080 | ||
nodeConfigMountPath: "/opt/druid/conf/druid/cluster/master/coordinator-overlord" | ||
replicas: 1 | ||
runtime.properties: |- | ||
druid.service=druid/coordinator | ||
druid.coordinator.asOverlord.enabled=true | ||
druid.coordinator.asOverlord.overlordService=druid/overlord | ||
historicals: | ||
nodeType: "historical" | ||
kind: "StatefulSet" | ||
druid.port: 8080 | ||
nodeConfigMountPath: "/opt/druid/conf/druid/cluster/data/historical" | ||
replicas: 1 | ||
runtime.properties: |- | ||
druid.service=druid/historical | ||
druid.segmentCache.locations=[{\"path\":\"/druid/data/segments\",\"maxSize\":10737418240}] | ||
druid.server.maxSize=10737418240 | ||
volumeMounts: | ||
- mountPath: /druid/data | ||
name: data-volume | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data-volume | ||
spec: | ||
storageClassName: default | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package druid | ||
|
||
import ( | ||
"time" | ||
|
||
druidv1alpha1 "github.com/datainfrahq/druid-operator/apis/druid/v1alpha1" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
// +kubebuilder:docs-gen:collapse=Imports | ||
|
||
/* | ||
zookeeper_dep_mgmt_test | ||
*/ | ||
var _ = Describe("Test volume expansion feature", func() { | ||
const ( | ||
filePath = "testdata/volume-expansion.yaml" | ||
timeout = time.Second * 45 | ||
interval = time.Millisecond * 250 | ||
) | ||
|
||
Context("When checking if volume expansion is enabled", func() { | ||
It("should error if storageClassName does not exists", func() { | ||
druid := &druidv1alpha1.Druid{} | ||
|
||
druidCR, err := readDruidClusterSpecFromFile(filePath) | ||
Expect(err).Should(BeNil()) | ||
|
||
By("By setting storage class name to nil") | ||
druidCR.Spec.Nodes["historicals"].VolumeClaimTemplates[0].Spec.StorageClassName = nil | ||
|
||
Expect(druidCR.Spec.Nodes["historicals"].VolumeClaimTemplates[0].Spec.StorageClassName).Should(BeNil()) | ||
|
||
By("By creating a new druidCR") | ||
Expect(k8sClient.Create(ctx, druidCR)).To(Succeed()) | ||
|
||
By("By getting a newly created druidCR") | ||
Eventually(func() bool { | ||
err := k8sClient.Get(ctx, types.NamespacedName{Name: druidCR.Name, Namespace: druidCR.Namespace}, druid) | ||
return err == nil | ||
}, timeout, interval).Should(BeTrue()) | ||
|
||
By("By getting the historicals nodeSpec") | ||
allNodeSpecs, err := getAllNodeSpecsInDruidPrescribedOrder(druid) | ||
Expect(err).Should(BeNil()) | ||
|
||
nodeSpec := &druidv1alpha1.DruidNodeSpec{} | ||
for _, elem := range allNodeSpecs { | ||
if elem.key == "historicals" { | ||
nodeSpec = &elem.spec | ||
} | ||
} | ||
Expect(nodeSpec).ShouldNot(BeNil()) | ||
|
||
By("By calling the expand volume function with storageClass nil") | ||
Expect(isVolumeExpansionEnabled(ctx, k8sClient, druid, nodeSpec, nil)).Error() | ||
}) | ||
}) | ||
}) |