julienkosinski.github.io

Operator Custom Resource Reference Guide

Custom resources are extensions of the Kubernetes API.

A resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind; for example, the built-in pods resource contains a collection of Pod objects. A Custom Resource is an extension of the Kubernetes API, many core Kubernetes functions are now built using custom resources, making Kubernetes more modular. Cluster admins can update custom resources independently of the cluster itself. Once a custom resource is installed, users can create and access its objects using kubectl, just as they do for built-in resources like Pods.

The CustomResourceDefinition API resource allows you to define custom resources. Defining a CRD object creates a new custom resource with a name and schema that you specify. The Kubernetes API serves and handles the storage of your custom resource. Every resource is build from KGV that stands for Group Version Resource and this is what drives the Kubernetes API Server structure. The OpensearchCLuster CRD is representing an Opensearch cluster.

Our CRD is Defined by kind: OpenSearchCluster,group: opensearch.opster.io and version v1.

Name Type Description Required
apiVersion string opensearch.opster.io/v1 true
kind string OpenSearchCluster true
metadata object Refer to the Kubernetes API documentation for the fields of the `metadata` field. true
spec object ClusterSpec defines the desired state of OpenSearchSpec true
status object OpensearchClusterStatus defines the observed state of ClusterStatus. include ComponentsStatus that saves and share necessary state of the operator components. true

OpensearchCluster.spec

ClusterSpec defines the desired state of OpensearchCluster

</table>

GeneralConfig

GeneralConfig defines global Opensearch cluster configuration
Name Type Description Required
general object Opensearch general configuration true
Dashboards object Opensearch-dashboards configuration false
confMgmt object Config object to enable additional OpensearchOperator features/components false
security object Defined security reconciler configuration false
nodePools []object List of objects that define the different nodePools in an OpensearchCluster. Each nodePool represents a group of nodes with the same opensearch roles and resources. Each nodePool is deployed as a Kubernetes StatefulSet. Together they form the opensearch cluster. true
</table>

Dashboards

Dashboards defines Opensearch-Dashboard configuration and deployment
Name Type Description Required default
httpPort int32 http exposure port false 9200
vendor string Vendor distribution to use for the cluster, currently only opensearch is supported false opensearch
version string Version of opensearch to deploy false latest
ServiceAccount string k8s service account name false cluster name
ServiceName string Name to use for the k8s service to expose the cluster internally false cluster name
SetVMMaxMapCount bool will add VMmaxMapCount false
additionalConfig string Added extra items to opensearch.yml string
</table>

NodePools

Every NodePool is defining different Opensearch Nodes StatefulSet
Name Type Description Required default
enable bool if true, will deploy Opensearch-dashboards with the cluster false false
replicas int defines Opensearch-Dashboards deployment's replicas true 1
resources corev1.ResourceRequirements Define Opensearch-Dashboard resources false Default Opensearch-dashboard resources
version string Opensearch-dashboards version false latest
Tls DashboardsTlsConfig defining Dashbaord TLS configuration false false
</table>
Name Type Description Required default
component string statefulset name - will create $cluster-name-$component STS true -
replicas int defines NodePool deployment's replicas true 1
diskSize string nodePool data disk size true -
NodeSelector map[string]string add NodeSelector to nodePool false -
Tls DashboardsTlsConfig defining Dashbaord TLS configuration false false
resources corev1.ResourceRequirements Define NodePool resources false
roles []string List of OpenSearch roles to assign to the nodePool true -
JVM string JVM args. Use this to define heap size (recommendation: Set to half of memory request) false -Xmx512M -Xms512M
Affinity corev1.Affinity add affinity to nodePool false -
Tolerations []corev1.Toleration add toleration to nodePool false -