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
49 changes: 2 additions & 47 deletions api/v1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ const (
ConfKeyPort = "port"

// XDR keys.
confKeyXdr = "xdr"
confKeyXdrDlogPath = "xdr-digestlog-path"
ConfKeyXdr = "xdr"

// Security keys.
ConfKeySecurity = "security"
Expand Down Expand Up @@ -333,7 +332,7 @@ func IsAerospikeNamespacePresent(
// IsXdrEnabled indicates if XDR is enabled in aerospikeConfig.
func IsXdrEnabled(aerospikeConfigSpec AerospikeConfigSpec) bool {
aerospikeConfig := aerospikeConfigSpec.Value
xdrConf := aerospikeConfig[confKeyXdr]
xdrConf := aerospikeConfig[ConfKeyXdr]

return xdrConf != nil
}
Expand Down Expand Up @@ -367,50 +366,6 @@ func ReadTLSAuthenticateClient(serviceConf map[string]interface{}) (
return nil, fmt.Errorf("invalid configuration")
}

// GetDigestLogFile returns the xdr digest file path if configured.
func GetDigestLogFile(aerospikeConfigSpec AerospikeConfigSpec) (
*string, error,
) {
aerospikeConfig := aerospikeConfigSpec.Value

if xdrConfTmp, ok := aerospikeConfig[confKeyXdr]; ok {
xdrConf, ok := xdrConfTmp.(map[string]interface{})
if !ok {
return nil, fmt.Errorf(
"aerospikeConfig.xdr not a valid map %v",
aerospikeConfig[confKeyXdr],
)
}

dgLog, ok := xdrConf[confKeyXdrDlogPath]
if !ok {
return nil, fmt.Errorf(
"%s is missing in aerospikeConfig.xdr %v", confKeyXdrDlogPath,
xdrConf,
)
}

if _, ok := dgLog.(string); !ok {
return nil, fmt.Errorf(
"%s is not a valid string in aerospikeConfig.xdr %v",
confKeyXdrDlogPath, xdrConf,
)
}

// "/opt/aerospike/xdr/digestlog 100G"
if len(strings.Fields(dgLog.(string))) != 2 {
return nil, fmt.Errorf(
"%s is not in valid format (/opt/aerospike/xdr/digestlog 100G) in aerospikeConfig.xdr %v",
confKeyXdrDlogPath, xdrConf,
)
}

return &strings.Fields(dgLog.(string))[0], nil
}

return nil, fmt.Errorf("xdr not configured")
}

func GetServiceTLSNameAndPort(aeroConf *AerospikeConfigSpec) (tlsName string, port *int32) {
return GetTLSNameAndPort(aeroConf, ConfKeyNetworkService)
}
Expand Down
8 changes: 0 additions & 8 deletions config/samples/xdr_src_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ spec:
storageClass: ssd
volumeMode: Filesystem
size: 3Gi
- name: xdr
aerospike:
path: /opt/aerospike/xdr
source:
persistentVolume:
storageClass: ssd
volumeMode: Filesystem
size: 3Gi
- name: aerospike-config-secret
source:
secret:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.11
require (
github.com/aerospike/aerospike-backup-service/v3 v3.2.0
github.com/aerospike/aerospike-client-go/v8 v8.2.2
github.com/aerospike/aerospike-management-lib v1.8.1-0.20250829065008-0363517825bc
github.com/aerospike/aerospike-management-lib v1.8.1-0.20251029081729-d5f8b09e1080
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/deckarep/golang-set/v2 v2.8.0
github.com/evanphx/json-patch v4.12.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/aerospike/aerospike-backup-service/v3 v3.2.0 h1:vqvT7OE1didb/R4vOTNWI
github.com/aerospike/aerospike-backup-service/v3 v3.2.0/go.mod h1:aSD1pSRjyMYQ1UW2Kkg/vinn+ngeobKzDIVj+UZIi2c=
github.com/aerospike/aerospike-client-go/v8 v8.2.2 h1:NV1GxB+ATUb1cQtwaIS731A/6EkwuAX4/heh8CpvQOI=
github.com/aerospike/aerospike-client-go/v8 v8.2.2/go.mod h1:H6CzKDoHxBj1yY/oQPci1bUIbEx2ATQtJ2GtZ+N64Wg=
github.com/aerospike/aerospike-management-lib v1.8.1-0.20250829065008-0363517825bc h1:/vlU9v4xNL/e0Lpa+OXixHLqZQedvsiK385H7rMWOlk=
github.com/aerospike/aerospike-management-lib v1.8.1-0.20250829065008-0363517825bc/go.mod h1:RNKlkSnppiaBaLEdAiCeBv68M+odPR5JR+ziO0NfaHQ=
github.com/aerospike/aerospike-management-lib v1.8.1-0.20251029081729-d5f8b09e1080 h1:9KqMRrlFJ3hx1BuKqhWWedr3ZMYWxaEX9G1Dq1JxZhE=
github.com/aerospike/aerospike-management-lib v1.8.1-0.20251029081729-d5f8b09e1080/go.mod h1:RNKlkSnppiaBaLEdAiCeBv68M+odPR5JR+ziO0NfaHQ=
github.com/aerospike/backup-go v0.5.1 h1:8ryLV0nOoo3Zn7LRV1kQABFnYgg1V0r9ZJJOL22FBs0=
github.com/aerospike/backup-go v0.5.1/go.mod h1:+RJdOaVCG6jQlhoNIJrzQgZnJ/HEBPfAiPGdv3YYzyg=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/cluster/scripts/initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ done
{{- if .WorkDir }}
# Create required directories.
DEFAULT_WORK_DIR="/workdir/filesystem-volumes{{.WorkDir}}"
REQUIRED_DIRS=("smd" "usr/udf/lua" "xdr")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We weren’t updating these scripts anymore. right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, not for the new changes.

REQUIRED_DIRS=("smd" "usr/udf/lua")

for d in ${REQUIRED_DIRS[*]}; do
TO_CREATE="$DEFAULT_WORK_DIR/$d"
Expand Down
16 changes: 0 additions & 16 deletions internal/webhook/v1/aerospikecluster_mutating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ func updateRacksAerospikeConfigFromGlobal(asLog logr.Logger, cluster *asdbv1.Aer

func setDefaultAerospikeConfigs(asLog logr.Logger,
configSpec asdbv1.AerospikeConfigSpec, rackID *int, cluster *asdbv1.AerospikeCluster) error {
config := configSpec.Value

// namespace conf
if err := setDefaultNsConf(asLog, configSpec, cluster.Spec.RackConfig.Namespaces, rackID); err != nil {
return err
Expand All @@ -320,13 +318,6 @@ func setDefaultAerospikeConfigs(asLog logr.Logger,
return err
}

// xdr conf
if _, ok := config["xdr"]; ok {
if err := setDefaultXDRConf(asLog, configSpec); err != nil {
return err
}
}

// escape LDAP configuration
return escapeLDAPConfiguration(configSpec)
}
Expand Down Expand Up @@ -713,13 +704,6 @@ func setDefaultLoggingConf(
return nil
}

func setDefaultXDRConf(
_ logr.Logger, _ asdbv1.AerospikeConfigSpec,
) error {
// Nothing to update for now
return nil
}

func setDefaultsInConfigMap(
_ logr.Logger, baseConfigs, defaultConfigs map[string]interface{},
) error {
Expand Down
44 changes: 0 additions & 44 deletions test/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2271,26 +2271,6 @@ func negativeDeployClusterValidationTest(
Expect(DeployCluster(k8sClient, ctx, aeroCluster)).Should(HaveOccurred())
},
)

It(
"InvalidxdrConfig: should fail for invalid xdr config. mountPath for digestlog not present in storage",
func() {
aeroCluster := createDummyAerospikeCluster(
clusterNamespacedName, 1,
)
namespaceConfig :=
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyNamespace].([]interface{})[0].(map[string]interface{})

if _, ok := namespaceConfig["storage-engine"].(map[string]interface{})["devices"]; ok {
aeroCluster.Spec.Storage = asdbv1.AerospikeStorageSpec{}
aeroCluster.Spec.AerospikeConfig.Value["xdr"] = map[string]interface{}{
"enable-xdr": false,
"xdr-digestlog-path": "/opt/aerospike/xdr/digestlog 100G",
}
Expect(DeployCluster(k8sClient, ctx, aeroCluster)).Should(HaveOccurred())
}
},
)
},
)
},
Expand Down Expand Up @@ -2674,30 +2654,6 @@ func negativeUpdateClusterValidationTest(
Expect(err).Should(HaveOccurred())
},
)

It(
"InvalidxdrConfig: should fail for invalid xdr config. mountPath for digestlog not present in fileStorage",
func() {
aeroCluster, err := getCluster(
k8sClient, ctx,
clusterNamespacedName,
)
Expect(err).ToNot(HaveOccurred())

namespaceConfig :=
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyNamespace].([]interface{})[0].(map[string]interface{})
if _, ok := namespaceConfig["storage-engine"].(map[string]interface{})["devices"]; ok {
aeroCluster.Spec.AerospikeConfig.Value["xdr"] = map[string]interface{}{
"enable-xdr": false,
"xdr-digestlog-path": "randomPath 100G",
}
err = k8sClient.Update(
ctx, aeroCluster,
)
Expect(err).Should(HaveOccurred())
}
},
)
},
)
},
Expand Down
32 changes: 16 additions & 16 deletions test/cluster/dynamic_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe(
)
aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = append(
aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{}), getNonSCInMemoryNamespaceConfig("mem"))
aeroCluster.Spec.AerospikeConfig.Value["xdr"] = map[string]interface{}{
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr] = map[string]interface{}{
"dcs": []map[string]interface{}{
{
"name": "dc1",
Expand Down Expand Up @@ -135,8 +135,8 @@ var _ = Describe(
},
}

aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"] = append(
aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"].([]interface{}), dc)
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"] = append(
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"].([]interface{}), dc)

err = updateCluster(k8sClient, ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -165,7 +165,7 @@ var _ = Describe(

// Fetch and verify xdr section config
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
"xdr", aeroCluster.Name+"-0-0")
asdbv1.ConfKeyXdr, aeroCluster.Name+"-0-0")
Expect(err).ToNot(HaveOccurred())

Expect(conf["dcs"]).To(HaveLen(2))
Expand All @@ -182,8 +182,8 @@ var _ = Describe(
delete(aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyService].(map[string]interface{}), "proto-fd-max")
delete(aeroCluster.Spec.AerospikeConfig.Value["security"].(map[string]interface{}), "log")

aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"] =
aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"].([]interface{})[:1]
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"] =
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"].([]interface{})[:1]

err = updateCluster(k8sClient, ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -209,7 +209,7 @@ var _ = Describe(

// Fetch and verify xdr section config
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
"xdr", aeroCluster.Name+"-0-0")
asdbv1.ConfKeyXdr, aeroCluster.Name+"-0-0")
Expect(err).ToNot(HaveOccurred())

Expect(conf["dcs"]).To(HaveLen(1))
Expand Down Expand Up @@ -334,7 +334,7 @@ var _ = Describe(
aeroCluster := createDummyAerospikeCluster(
clusterNamespacedName, 2,
)
aeroCluster.Spec.AerospikeConfig.Value["xdr"] = map[string]interface{}{
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr] = map[string]interface{}{
"dcs": []map[string]interface{}{
{
"name": "dc1",
Expand Down Expand Up @@ -423,8 +423,8 @@ var _ = Describe(
},
}

aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"] = append(
aeroCluster.Spec.AerospikeConfig.Value["xdr"].(map[string]interface{})["dcs"].([]interface{}), dc)
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"] = append(
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(map[string]interface{})["dcs"].([]interface{}), dc)

err = updateClusterWithTO(k8sClient, ctx, aeroCluster, time.Minute*1)
Expect(err).To(HaveOccurred())
Expand Down Expand Up @@ -476,7 +476,7 @@ var _ = Describe(
},
},
)
aeroCluster.Spec.AerospikeConfig.Value["xdr"] = map[string]interface{}{
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr] = map[string]interface{}{
"dcs": []map[string]interface{}{
{
"name": "dc1",
Expand Down Expand Up @@ -973,7 +973,7 @@ func validateXDRContextDynamically(clusterNamespacedName types.NamespacedName,
dcFields := make(asconfig.Conf)

for confKey, val := range *flatServer {
if asconfig.ContextKey(confKey) != "xdr" {
if asconfig.ContextKey(confKey) != asdbv1.ConfKeyXdr {
continue
}

Expand Down Expand Up @@ -1030,7 +1030,7 @@ func validateXDRNSFieldsDynamically(ctx goctx.Context, flatServer, flatSpec *asc
newConf := asconfig.New(logger, &newSpec)
newMap := *newConf.ToMap()

aeroCluster.Spec.AerospikeConfig.Value["xdr"] = lib.DeepCopy(newMap["xdr"])
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr] = lib.DeepCopy(newMap[asdbv1.ConfKeyXdr])

return updateCluster(k8sClient, ctx, aeroCluster)
}
Expand All @@ -1057,11 +1057,11 @@ func validateXDRDCFieldsDynamically(ctx goctx.Context, flatServer, flatSpec *asc
newConf := asconfig.New(logger, &newSpec)
newMap := *newConf.ToMap()

aeroCluster.Spec.AerospikeConfig.Value["xdr"] = lib.DeepCopy(newMap["xdr"])
dcs := aeroCluster.Spec.AerospikeConfig.Value["xdr"].(lib.Stats)["dcs"].([]lib.Stats)
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr] = lib.DeepCopy(newMap[asdbv1.ConfKeyXdr])
dcs := aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(lib.Stats)["dcs"].([]lib.Stats)
delete(dcs[0], "namespaces")
delete(dcs[0], "node-address-ports")
aeroCluster.Spec.AerospikeConfig.Value["xdr"].(lib.Stats)["dcs"] = dcs
aeroCluster.Spec.AerospikeConfig.Value[asdbv1.ConfKeyXdr].(lib.Stats)["dcs"] = dcs

return updateCluster(k8sClient, ctx, aeroCluster)
}
Expand Down
26 changes: 0 additions & 26 deletions test/cluster/rack_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,32 +589,6 @@ var _ = Describe(
)
},
)

It(
"should fail for invalid xdr config. mountPath for digestlog not present in fileStorage",
func() {
aeroCluster := createDummyRackAwareAerospikeCluster(
clusterNamespacedName, 2,
)
namespaceConfig :=
aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{})[0].(map[string]interface{})
if _, ok :=
namespaceConfig["storage-engine"].(map[string]interface{})["devices"]; ok {
aeroCluster.Spec.Storage = asdbv1.AerospikeStorageSpec{}
aeroConfig := asdbv1.AerospikeConfigSpec{
Value: map[string]interface{}{
"xdr": map[string]interface{}{
"enable-xdr": false,
"xdr-digestlog-path": "/opt/aerospike/xdr/digestlog 100G",
},
},
}
aeroCluster.Spec.RackConfig.Racks[0].InputAerospikeConfig = &aeroConfig
Expect(DeployCluster(k8sClient, ctx, aeroCluster)).Should(HaveOccurred())
}
},
)
// Replication-factor can not be updated
},
)

Expand Down
2 changes: 1 addition & 1 deletion test/cluster/sample_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func deployClusterUsingFile(ctx context.Context, filePath string) (*asdbv1.Aeros
return aeroCluster, err
}

if !strings.Contains(filePath, "xdr") {
if !strings.Contains(filePath, asdbv1.ConfKeyXdr) {
baseName := strings.TrimSuffix(filepath.Base(filePath), "_cr.yaml")
aeroCluster.Name = strings.ReplaceAll(baseName, "_", "-")
}
Expand Down