Skip to content

Opensearch

The Opni operator integrates the Opensearch Operator. If an OpenSearchCluster resource is created then Opni will create the Opensearch cluster e.g.

apiVersion: opensearch.opster.io/v1
kind: OpenSearchCluster
metadata:
  name: opni
  namespace: opni-system
spec:
  # Add fields here
  general:
    httpPort: 9200
    vendor: opensearch
    version: 1.2.3
    serviceName: os-svc
    setVMMaxMapCount: true
  confMgmt:
    autoScaler: false
    monitoring: false
  dashboards:
    enable: true
    version: 1.2.0
    replicas: 1
  nodePools:
  - component: master
    replicas: 3
    diskSize: 32
    resources:
      requests:
        cpu: 500m
        memory: 1Gi
      limits:
        memory: 1Gi
    roles:
    - master
    persistence:
      emptyDir: {}
  - component: nodes
    replicas: 2
    diskSize: 32
    resources:
      requests:
        cpu: 500m
        memory: 2Gi
      limits:
        memory: 2Gi
    jvm: "-Xmx1G -Xms1G"
    roles:
    - data
    persistence:
      emptyDir: {}

The Opensearch cluster can then be referenced by Opni. The Opni controller will also create indices and configuration in the Opensearch cluster.

example.yaml

apiVersion: opni.io/v1beta2
kind: OpniCluster
metadata:
  name: example
  namespace: opni
spec:
  opensearch:
    externalOpensearch:
      name: opni
      namespace: opni-system

Note

The following Opensearch configuration is deprecated and will be removed in a future version

Alternatively the deployment of the Opensearch cluster can be defined as a subsection of the OpniCluster resource. It deploys an Opensearch cluster and Dashboards for visualization.

example.yaml

apiVersion: opni.io/v1beta2
kind: OpniCluster
metadata:
  name: example
  namespace: opni
spec:
  opensearch:
    version: 1.13.2
    workloads:
      master:
        resources:
          requests:
            memory: 1Gi
          limits:
            memory: 1Gi
      data:
        replicas: 2
        resources:
          requests:
            memory: 2Gi
          limits:
            memory: 2Gi

Custom Resource Specs

OpensearchSpec

Field Required Type Description
externalOpensearch No OpensearchClusterRef A reference to an OpenSearchCluster resource. If this is not present Opni will create an Opensearch cluster based on the rest of the spec
version No string Version of the Opendistro image to use. Defaults to latest
workloads No OpensearchWorkloadSpec Configure the Opensearchsearch cluster components
defaultRepo No string Image repo to use for Opensearchsearch images. Defaults to docker.io/amazon
image No ImageSpec Explicit configuration for the Opensearchsearch image
kibanaImage No ImageSpec Explicit configuration for the Kibana image
persistence No PersistenceSpec Configure the persistence for Opensearchsearch data
configSecret No LocalObjectReference Reference to a secret containing logging.yml with the Opensearchsearch logging config
adminPasswordFrom No SecretKeySelector Secret key selector pointing to the admin password to use. If not set a password will be autogenerated and stored in the password key in a secret called opni-es-password

OpensearchWorkloadSpec

Field Required Type Description
master OpensearchWorkloadOptions Configuration for the Opensearchsearch master node StatefulSet
data OpensearchWorkloadOptions Configuration for the Opensearchsearch data node StatefulSet
client OpensearchWorkloadOptions Configuration for the Opensearchsearch client node Deployment
kibana OpensearchWorkloadOptions Configuration for the Kibana Deployment

OpensearchWorkloadOptions

Field Required Type Description
replicas No int Number of replicas to deploy. Defaults to 1
resources No ResourceRequirements Resources for the workload. The resources are used to calculate the Java memory options. If a memory limit exists this is used, if there is a memory request but no limit that is used, otherwise the Java optioms default to a heap size of 512MB
affinity No Affinity Affinity settings for the workload pods
nodeSelector No map NodeSelector for the workload pods. If this exists it will override the globalNodeSelector
tolerations No Toleration array Tolerations for the workload. These will be combined with the globalTolerations (if any)

ImageSpec

Field Required Type Description
image No string Explicit CRI image to use
imagePullPolicy No string Image pull policy. One of Always, Never, IfNotPresent. Defaults to IfNotPresent
imagePullSecrets No LocalObjectReference array List of secrets in the same namespace to use for pulling the image

PersistenceSpec

Field Required Type Description
enabled No bool Whether persistent storage is enabled. Defaults to false
storageClassName No string If persistent storage is enabled, the name of the StorageClass to use. If not set will use the default StorageClass
accessModes No string array An array of the access modes the volume supports
request No string The size of the volume to request. Defaults to 10Gi

OpensearchClusterRef

Field Required Type Description
name Yes string The name of the OpenSearchCluster object
namespace Yes string The namespace of the OpenSearchCluster object