Discovery

The Stackable Operator for OpenSearch publishes a service discovery ConfigMap which exposes a client configuration bundle that allows access to the OpenSearch cluster.

The bundle includes the connection parameters to access the OpenSearch cluster. These parameters may be used by other operators or tools to configure their products with access to OpenSearch.

Example

Given the following OpenSearch cluster:

apiVersion: opensearch.stackable.tech/v1alpha1
kind: OpenSearchCluster
metadata:
  name: simple-opensearch  (1)
  namespace: stackable (2)
spec:
  clusterConfig:
    tls:
      serverSecretClass: tls (3)
  nodes:
    roleConfig:
      discoveryServiceListenerClass: external-unstable (4)
    roleGroups:
      cluster-manager:
        config:
          discoveryServiceExposed: true (5)
          nodeRoles:
            - cluster_manager
      data:
        config:
          discoveryServiceExposed: false (6)
          nodeRoles:
            - ingest
            - data
            - remote_cluster_client
1 The name of the OpenSearch cluster which is also the name of the created discovery ConfigMap.
2 The namespace of the cluster and the discovery ConfigMap.
3 Whether a serverSecretClass is set or not, determines the value of the OPENSEARCH_PROTOCOL key in the discovery ConfigMap.
4 The ListenerClass that is used for the discovery service.
5 The cluster-manager role group is exposed in the discovery service.
6 The data role group is not exposed in the discovery service.

The resulting discovery ConfigMap is stackable/simple-opensearch.

Contents

The stackable/simple-opensearch discovery ConfigMap contains the following fields where simple-opensearch represents the name and stackable the namespace of the cluster:

OPENSEARCH_HOSTNAME

Contains the hostname or IP of the service that references the exposed role groups.

In case, discoveryServiceListenerClass was set to cluster-internal, the following hostname will be set:

simple-opensearch.stackable.svc.cluster.local

If discoveryServiceListenerClass was set to external-unstable, the content could look like:

10.104.213.49
OPENSEARCH_PORT

Contains the port of the service that references the exposed role groups.

Depending on the discoveryServiceListenerClass, the port will be either the default HTTP port 9200 or a NodePort:

31315
OPENSEARCH_PROTOCOL

Contains either http or https, depending on whether a serverSecretClass is configured:

https
OPENSEARCH_HOSTS

Contains the URL of the service that references the exposed role groups.