From 416615b8322118be7b0034d0c78823cb36794b50 Mon Sep 17 00:00:00 2001 From: "vivek.name: \"Vivek Reddy" Date: Tue, 20 Jan 2026 23:06:34 +0000 Subject: [PATCH] Add use_sdk=true to SmartStore volumes configuration This change adds the use_sdk=true parameter to SmartStore volume configurations to enable the AWS SDK for S3 operations. Changes: - Add use_sdk=true to volume configurations in GetSmartstoreVolumesConfig - Add test coverage for use_sdk parameter - Update test fixtures to reflect new configuration format --- go.mod | 4 +- go.sum | 4 ++ pkg/splunk/enterprise/configuration.go | 2 + pkg/splunk/enterprise/configuration_test.go | 39 +++++++++++++++++++ .../configmap_smartstore_volumes.json | 4 +- 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index e1d9c42b5..00ed12a4d 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 github.com/minio/minio-go/v7 v7.0.16 - github.com/onsi/ginkgo/v2 v2.27.3 - github.com/onsi/gomega v1.38.3 + github.com/onsi/ginkgo/v2 v2.27.5 + github.com/onsi/gomega v1.39.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.19.1 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index b0a4c1cd2..be47e66e2 100644 --- a/go.sum +++ b/go.sum @@ -263,8 +263,12 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8= github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= +github.com/onsi/ginkgo/v2 v2.27.5 h1:ZeVgZMx2PDMdJm/+w5fE/OyG6ILo1Y3e+QX4zSR0zTE= +github.com/onsi/ginkgo/v2 v2.27.5/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM= github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= +github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= +github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/pkg/splunk/enterprise/configuration.go b/pkg/splunk/enterprise/configuration.go index a0d90b354..4cdcaa4da 100644 --- a/pkg/splunk/enterprise/configuration.go +++ b/pkg/splunk/enterprise/configuration.go @@ -1840,6 +1840,7 @@ func GetSmartstoreVolumesConfig(ctx context.Context, client splcommon.Controller volumesConf = fmt.Sprintf(`%s [volume:%s] storageType = remote +use_sdk = true path = s3://%s remote.s3.access_key = %s remote.s3.secret_key = %s @@ -1851,6 +1852,7 @@ remote.s3.auth_region = %s volumesConf = fmt.Sprintf(`%s [volume:%s] storageType = remote +use_sdk = true path = s3://%s remote.s3.endpoint = %s remote.s3.auth_region = %s diff --git a/pkg/splunk/enterprise/configuration_test.go b/pkg/splunk/enterprise/configuration_test.go index 3be6d0393..2c9aa92e2 100644 --- a/pkg/splunk/enterprise/configuration_test.go +++ b/pkg/splunk/enterprise/configuration_test.go @@ -1150,6 +1150,45 @@ maxGlobalRawDataSizeMB = 5000 t.Errorf("expected: %s, returned: %s", expectedINIFormatString, indexesConfIni) } } + +func TestGetSmartstoreVolumesConfigAddsUseSdk(t *testing.T) { + ctx := context.TODO() + cr := enterpriseApi.Standalone{ + ObjectMeta: metav1.ObjectMeta{ + Name: "standalone", + Namespace: "test", + }, + } + + client := spltest.NewMockClient() + secret, err := splutil.ApplyNamespaceScopedSecretObject(ctx, client, "test") + require.NoError(t, err) + secret.Data[s3AccessKey] = []byte("access") + secret.Data[s3SecretKey] = []byte("secret") + _, err = splctrl.ApplySecret(ctx, client, secret) + require.NoError(t, err) + + smartstore := &enterpriseApi.SmartStoreSpec{ + VolList: []enterpriseApi.VolumeSpec{ + { + Name: "msos_s2s3_vol", + Endpoint: "https://s3.us-west-2.amazonaws.com", + Path: "testbucket", + Region: "us-west-2", + SecretRef: secret.Name, + }, + }, + } + + conf, err := GetSmartstoreVolumesConfig(ctx, client, &cr, smartstore, map[string]string{}) + require.NoError(t, err) + require.Contains(t, conf, "use_sdk = true") + + smartstore.VolList[0].SecretRef = "" + conf, err = GetSmartstoreVolumesConfig(ctx, client, &cr, smartstore, map[string]string{}) + require.NoError(t, err) + require.Contains(t, conf, "use_sdk = true") +} func TestGetServerConfigEntries(t *testing.T) { SmartStoreCacheManager := enterpriseApi.CacheManagerSpec{ diff --git a/pkg/splunk/enterprise/testdata/fixtures/configmap_smartstore_volumes.json b/pkg/splunk/enterprise/testdata/fixtures/configmap_smartstore_volumes.json index 351bd62c9..697a85320 100644 --- a/pkg/splunk/enterprise/testdata/fixtures/configmap_smartstore_volumes.json +++ b/pkg/splunk/enterprise/testdata/fixtures/configmap_smartstore_volumes.json @@ -15,7 +15,7 @@ }, "data": { "conftoken": "1601945361", - "indexes.conf": "[default]\nrepFactor = auto\nmaxDataSize = auto\nhomePath = $SPLUNK_DB/$_index_name/db\ncoldPath = $SPLUNK_DB/$_index_name/colddb\nthawedPath = $SPLUNK_DB/$_index_name/thaweddb\n \n[volume:msos_s2s3_vol]\nstorageType = remote\npath = s3://testbucket-rs-london\nremote.s3.access_key = abcdJDckRkxhMEdmSk5FekFRRzBFOXV6bGNldzJSWE9IenhVUy80aa\nremote.s3.secret_key = g4NVp0a29PTzlPdGczWk1vekVUcVBSa0o4NkhBWWMvR1NadDV4YVEy\nremote.s3.endpoint = https://s3-eu-west-2.amazonaws.com\nremote.s3.auth_region = \n \n[salesdata1]\nremotePath = volume:msos_s2s3_vol/remotepath1\n\n[salesdata2]\nremotePath = volume:msos_s2s3_vol/remotepath2\n\n[salesdata3]\nremotePath = volume:msos_s2s3_vol/remotepath3\n", + "indexes.conf": "[default]\nrepFactor = auto\nmaxDataSize = auto\nhomePath = $SPLUNK_DB/$_index_name/db\ncoldPath = $SPLUNK_DB/$_index_name/colddb\nthawedPath = $SPLUNK_DB/$_index_name/thaweddb\n \n[volume:msos_s2s3_vol]\nstorageType = remote\nuse_sdk = true\npath = s3://testbucket-rs-london\nremote.s3.access_key = abcdJDckRkxhMEdmSk5FekFRRzBFOXV6bGNldzJSWE9IenhVUy80aa\nremote.s3.secret_key = g4NVp0a29PTzlPdGczWk1vekVUcVBSa0o4NkhBWWMvR1NadDV4YVEy\nremote.s3.endpoint = https://s3-eu-west-2.amazonaws.com\nremote.s3.auth_region = \n \n[salesdata1]\nremotePath = volume:msos_s2s3_vol/remotepath1\n\n[salesdata2]\nremotePath = volume:msos_s2s3_vol/remotepath2\n\n[salesdata3]\nremotePath = volume:msos_s2s3_vol/remotepath3\n", "server.conf": "" } -} \ No newline at end of file +}