Skip to content

Configuration

Ashish Shinde edited this page Jul 11, 2020 · 33 revisions

Custom Resource Definition and Custom Resource

The operator CRD specifies the CR that the operator uses. The Aerospike cluster Custom Resource (CR) based on this CRD drives the deployment and management of Aerospike clusters. To create and deploy an Aerospike cluster, create a CR yaml file.

This custom resource can be edited later on to make any changes to the Aerospike cluster.

Example CR

A sample AerospikeCluster resource yaml file that sets up a persistent namespace and an in-memory namespace is below.

apiVersion: aerospike.com/v1alpha1
kind: AerospikeCluster
metadata:
  name: aerocluster
  namespace: aerospike

spec:
  size: 2
  build: aerospike/aerospike-server-enterprise:4.7.0.10

  storage:
    volumes:
      - path: /opt/aerospike
        storageClass: ssd
        volumeMode: filesystem
        sizeInGB: 1
      - path: /dev/nvme0n1
        storageClass: local-ssd
        volumeMode: block
        sizeInGB: 5
      - path: /dev/sdf
        storageClass: ssd
        volumeMode: block
        sizeInGB: 5

  multiPodPerHost: true

  aerospikeAccessControl:
    users:
      - name: admin
        secretName: auth-secret
        roles:
          - sys-admin
          - user-admin

  aerospikeConfigSecret:
    secretName: aerospike-secret
    mountPath:  /etc/aerospike/secret

  aerospikeConfig:
    service:
      feature-key-file: /etc/aerospike/secret/features.conf
    security:
      enable-security: true
    namespace:
      - name: test
        memory-size: 3000000000
        replication-factor: 2
        storage-engine:
          device:
            - /dev/nvme0n1	/dev/sdf

  resources:
    requests:
      memory: 2Gi
      cpu: 200m

Other sample Aerospike Cluster CR objects can be found here

Configuration

The initial part of the CR selects the CRD and the namespace to use for the Aerospike cluster.

apiVersion: aerospike.com/v1alpha1
kind: AerospikeCluster
metadata:
  name: aerocluster
  namespace: aerospike

Spec

The spec section provides the configuration for the cluster.

The fields are described below

Field Required Type Default Description
size Yes Integer The size/number of Aerospike node pods to run for this cluster.
build Yes String The official Aerospike Enterprise Server docker image to use for the node in the cluster.
resources Yes Structure Configures the memory and CPU to use for the Aerospike server container.
validationPolicy No Structure Configures the custom resource validation. See Validation Policy for details.
storage No Structure Required for persistent namespaces and for Aerospike work directory, unless the validation policy skips validating persistence of the work directory. See Storage for details.
multiPodPerHost Boolean Indicates if this configuration should run multiple pods per Kubernetes cluster host.
aerospikeConfigSecret No Structure The names of the Kubernetes secret containing files containing sensitive data like licenses, credentials, and certificates.See Aerospike Config Secret for details.
aerospikeAccessControl No Structure Required if Aerospike security is enabled. See Access Control for details
aerospikeConfig Yes Map A free form map confirming to the configuration schema for the deployed Aerospike server version. See Aerospike Config for details.

Validation Policy

This section configures the policy for validating the cluster CR.

The fields in this structure are

Field Required Type Default Description
skipWorkDirValidate No Boolean false If true skips validating that the Aerospike work directory is stored on a persistent volume.
skipXdrDlogFileValidate No Boolean false If true skips validating that the XDR digest log is stored on a persistent volume.

Storage

The storage section configures persistent volumes devices to provision and attach to the Aerospike cluster node container.

This section is required by default for persisting the Aerospike work directory. The working directory should be stored on a persistent storage to ensure pod restarts do not reset Aerospike server metadata files.

This section is also required for persisting Aerospike namespaces.

The fields in this structure are described below.

Field Required Type Default Description
filesystemVolumePolicy No Structure Volume policy for filesystem volumes
blockVolumePolicy No Structure Volume policy for block volumes
Volumes No List of Structure List of Volume devices to attach to Aerospike pods.

Volume Policy

Specifies persistent volumes policy to determine how new volumes are initialized.

The fields are

Field Required Type Default Description
initMethod No Enum none Controls how the volumes are initialized wht the persistent volume is attached the first time to a pod. Valid values are 'none', 'dd', 'blkdiscard', 'deleteFiles'

For filesystem volumes, initMethod can be 'none' or 'deleteFiles' For block volumes, initMethod can be 'none' or 'dd' or 'blkdiscard'

Volume

Describes a persistent volume to be attached to Aerospike devices.

The fields are

Field Required Type Default Description
path Yes String The path on the pod where this block volume or filesystem volume will be attached. For block volumes, this will be the device path. For filesystem volumes, this will be the mount point.
storageClass Yes String The name of the storage class to use.
volumeMode Yes Enum (filesystem. block) Specified the mode this volume should be created with. Filesystem mode creates a pre-formatted filesystem and mounts it at the specified path. Block mode creates a raw device and attaches it the device path specifed above.

| sizeInGB | Yes | Integer | | The size in GB (gigabytes) to provision for this device.|

Aerospike Access Control

Provides Aerospike access control configuration for the Aerospike cluster.

Field Required Type Default Description
roles No List of Structures A list of Role structures with an entry for each role.
users No List of Structures A list of User structures with an entry for each user. Required if Aerospike security is enabled.

If the Aerospike cluster has security enabled an entry for the "admin" user having at least "sys-admin" and "user-admin" roles is mandatory.

Aerospike Role

Configures roles to have in the Aerospike cluster.

Field Required Type Default Description
name Yes Strings The name of this role.

| privileges | Yes | List of Strings | | The privileges to grant this role. |

Aerospike User

Configures users to have for the aerospike cluster.

Field Required Type Default Description
name Yes Strings The name of this user.

| secretName | Yes | String | | The name of the secret containing this user's password. | | roles | Yes | List of Strings | | The roles to grant this user. |

Aerospike Config Secret

Configures the name of the secret to use and mount path to mount the secret files on the container.

Field Required Type Default Description
secretName Yes String The name of the secret
mountPath Yes String The path where the secret files will be mounted in the container.

Aerospike Config

Provides the Aerospike Server configuration to use for the server process. It is a yaml form for specifying the configuration in aerospike.conf file.

The schema depends on the Aerospike version deployed. Please check config-schemas for JSON schemas for all supported versions.

Next