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 |
ClusterSpec defines the desired state of OpensearchCluster
Name | Type | Description | Required |
---|---|---|---|
general | object | Opensearch general configuration | true |
Bootstrap | object | Bootstrap pod configuration | false |
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 |
initHelper | object | InitHelper image configuration | false |
GeneralConfig defines global Opensearch cluster configuration
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 | |
labels | map[string]string | add user defined labels to nodePool | false | - |
env | []corev1.Env | add user defined environment variables to nodePool | false | - |
DefaultRepo | string | Default image repository to use | ||
keystore | []opsterv1.KeystoreValue | List of objects that define secret values that will populate the opensearch keystore. | false | - |
Bootstrap defines Opensearch bootstrap pod configuration
Name | Type | Description | Required | default | |
---|---|---|---|---|---|
resources | corev1.ResourceRequirements | Define Opensearch bootstrap pod resources | false | - | |
tolerations | []corev1.Toleration | add toleration to bootstrap pod | false | - | |
nodeSelector | map[string]string | Add NodeSelector to bootstrap pod | false | - | |
affinity | corev1.Affinity | add affinity to bootstrap pod | false | - | |
jvm | string | JVM args. Use this to define heap size | false | -Xmx512M -Xms512M |
Dashboards defines Opensearch-Dashboard configuration and deployment
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 |
env | []corev1.Env | add user defined environment variables to dashboard app | false | - |
image | string | Define Opensearch-dashboards image | false | - |
imagePullPolicy | corev1.PullPolicy | Define Opensearch-dashboards image pull policy | false | - |
imagePullSecrets | corev1.LocalObjectReference | Define Opensearch-dashboards image pull secrets | false | - |
tolerations | []corev1.Toleration | Adds toleration to dashboard pods | false | - |
nodeSelector | map[string]string | Adds NodeSelector to dashboard pods | false | - |
affinity | corev1.Affinity | Adds affinity to dashboard pods | false | - |
Every NodePool is defining different Opensearch Nodes StatefulSet
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 | - |
topologySpreadConstraints | []corev1.TopologySpreadConstraint | add topology spread contraints to nodePool | false | - |
InitHelperConfig defines global Opensearch InitHelper image configuration
Name | Type | Description | Required | default |
---|---|---|---|---|
image | string | Define InitHelper image | false | public.ecr.aws/opsterio/busybox |
imagePullPolicy | corev1.PullPolicy | Define InitHelper image pull policy | false | - |
version | string | Version of InitHelper (busybox) image to deploy | false | 1.27.2-buildx |
Every Keystore Value defines a secret to pull secrets from.
Name | Type | Description | Required | default |
---|---|---|---|---|
secret | corev1.LocalObjectReference | Define secret that contains key value pairs | true | - |
keyMappings | map | Define key mappings from secret to keystore entry. Example: "old: new" creates a keystore entry "new" with the value from the secret entry "old". When a map is provided, only the specified keys are loaded from the secret, so use "key: key" to load a key that should not be renamed. | false | - |