Articles in this section

Setting config parameters with suffixes fails with "invalid_type" error on AKO managed Kubernetes cluster.

 

Issue

When a user tries to configure a namespace parameter such as default-ttl: 1D in the kubernetes Custom Resource(CR) yaml file and attempts to apply the change, kubectl throws an error stating the config is invalid type.


Example conf:

    namespaces:
      - name: test
        replication-factor: 2
        default-ttl: 1D

Error while applying the changes to the CR.yaml file - 

$ kubectl apply -f sample_cr.yaml

Error from server (Forbidden): error when applying patch:
:
Resource: "asdb.aerospike.com/v1, Resource=aerospikeclusters", GroupVersionKind: "asdb.aerospike.com/v1, Kind=AerospikeCluster"
Name: "aerocluster", Namespace: "aerospike"
for: "sample_cr.yaml": error when patching "sample_cr.yaml": admission webhook "vaerospikecluster.kb.io" denied the request: aerospikeConfig not valid: generated config not valid for version 8.1.2.0: config schema error [	{1D invalid_type (root).namespaces.0.default-ttl Invalid type. Expected: integer, given: string namespaces.0.default-ttl}
]

 

Cause:

The "invalid type" error above is thrown because AKO uses its own YAML format of aerospikeConfig and does NOT support any suffixes like below -

  • K(kib), M(Mib), G(Gib), T(Tib) - for file/data size parameters
  • S(sec), M(min), H(hour), D(day) - for any time period parameters

Instead, the values in spec.aerospikeConfig within the CR yaml file must be plain integers. See integer value formats for size and time value formats.

 

Solution:

In the spec.aerospikeConfig within the CR yaml, specify size parameters as byte counts in binary units, such as 1073741824 for 1 GiB and time parameters in the seconds, such as 86400 for 1 day. 

For example, 

default-ttl and nsup-period use seconds. The following configuration sets default-ttl to one day and nsup-period to two minutes:

namespaces:
  - name: test
    default-ttl: 86400
    nsup-period: 120
 

Set filesize: 1073741824 for 1 GiB:

namespaces:
  - name: test
    storage-engine:
      type: memory
      files:
        - /opt/aerospike/data/test.dat
      filesize: 1073741824

Refer the following documentation to understand the YAML config mappings and other limitations for an AKO managed Aerospike database running on Kubernetes - 

https://aerospike.com/docs/kubernetes/manage/configure/config-mapping/ 
https://aerospike.com/docs/kubernetes/install/limitations

 

Note: Outside an AKO-managed deployment, a directly authored aerospike.conf file can use KMG, or T suffixes for binary units.
 

 

 

Was this article helpful?
0 out of 0 found this helpful