Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ charts/matrixone-operator/charts/
*.tgz
e2e*.xml
e2e.test
docs/troubleshooting/
docs/draft
4 changes: 2 additions & 2 deletions pkg/controllers/common/fileservice.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Matrix Origin
// Copyright 2025-2026 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -179,7 +179,7 @@ func sharedFileServiceConfig(sp v1alpha1.SharedStorageProvider, cache *v1alpha1.
}
m["data-dir"] = fs.Path
}
cacheConfig := map[string]string{}
cacheConfig := map[string]interface{}{}
if cache != nil {
if cache.MemoryCacheSize != nil {
cacheConfig["memory-capacity"] = asSizeBytes(*cache.MemoryCacheSize)
Expand Down
10 changes: 5 additions & 5 deletions pkg/controllers/common/fileservice_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Matrix Origin
// Copyright 2025-2026 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,7 @@ func TestFileServiceConfig(t *testing.T) {
}, {
"name": "S3",
"backend": "S3",
"cache": map[string]string{
"cache": map[string]interface{}{
"memory-capacity": "1B",
},
"s3": map[string]interface{}{
Expand All @@ -68,7 +68,7 @@ func TestFileServiceConfig(t *testing.T) {
}, {
"name": "ETL",
"backend": "S3",
"cache": map[string]string{
"cache": map[string]interface{}{
"memory-capacity": "1B",
},
"s3": map[string]interface{}{
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestFileServiceConfig(t *testing.T) {
"key-prefix": "prefix/data",
"bucket": "bucket",
},
"cache": map[string]string{
"cache": map[string]interface{}{
"memory-capacity": "1GiB",
"disk-path": "/var/lib/matrixone/disk-cache",
"disk-capacity": "1GiB",
Expand All @@ -122,7 +122,7 @@ func TestFileServiceConfig(t *testing.T) {
"key-prefix": "prefix/etl",
"bucket": "bucket",
},
"cache": map[string]string{
"cache": map[string]interface{}{
"memory-capacity": "1B",
},
}},
Expand Down
59 changes: 58 additions & 1 deletion pkg/controllers/dnset/resource_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Matrix Origin
// Copyright 2025-2026 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/matrixorigin/matrixone-operator/api/core/v1alpha1"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -330,3 +331,59 @@ service-addresses = ["test-log-0.test-log-headless.test.svc:32001", "test-log-2.
})
}
}

func TestBuildDNSetConfigMapPreservesUserFileServiceCache(t *testing.T) {
g := NewGomegaWithT(t)
userConfig := v1alpha1.NewTomlConfig(nil)
g.Expect(userConfig.UnmarshalTOML([]byte(`
[[fileservice]]
name = "S3"

[fileservice.cache]
custom-key = "keep-me"
memory-capacity = "user-value"
`))).To(Succeed())

memoryCacheSize := resource.MustParse("1Gi")
dn := &v1alpha1.DNSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: "test",
Name: "test",
},
Spec: v1alpha1.DNSetSpec{
PodSet: v1alpha1.PodSet{
Config: userConfig,
},
SharedStorageCache: v1alpha1.SharedStorageCache{
MemoryCacheSize: &memoryCacheSize,
},
},
}
ls := &v1alpha1.LogSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: "test",
Name: "test",
},
Spec: v1alpha1.LogSetSpec{
SharedStorage: v1alpha1.SharedStorageProvider{
S3: &v1alpha1.S3Provider{
Path: "bucket/prefix",
},
},
},
Status: v1alpha1.LogSetStatus{
Discovery: &v1alpha1.LogSetDiscovery{
Port: 6001,
Address: "test",
},
},
}

configMap, configSuffix, err := buildDNSetConfigMap(dn, ls, nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(configSuffix).To(BeEmpty())
config := configMap.Data["config.toml"]
g.Expect(config).To(ContainSubstring(`custom-key = "keep-me"`))
g.Expect(config).To(ContainSubstring(`memory-capacity = "1GiB"`))
g.Expect(config).NotTo(ContainSubstring(`memory-capacity = "user-value"`))
}
Loading