Skip to content

Commit

Permalink
Merge pull request #3 from hasura/ndc-elasticsearch-and-connector-envs
Browse files Browse the repository at this point in the history
Add ndc-elasticsearch connector.  Require connector ENVs
  • Loading branch information
tomhasura authored Oct 28, 2024
2 parents b500e3a + 512108b commit b844883
Show file tree
Hide file tree
Showing 23 changed files with 408 additions and 25 deletions.
11 changes: 6 additions & 5 deletions CONNECTORS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ndc-connector-oracle
ndc-connector-phoenix
ndc-graphql
ndc-mongodb
ndc-nodejs-lambda
ndc-connector-oracle
ndc-connector-phoenix
ndc-elasticsearch
ndc-graphql
ndc-mongodb
ndc-nodejs-lambda
ndc-postgres
2 changes: 1 addition & 1 deletion charts/ndc-connector-oracle/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v2024.10.22
version: v2024.10.28

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 2 additions & 2 deletions charts/ndc-connector-oracle/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: {{ printf "%s-secret" (include "common.name" .) }}
namespace: {{ template "common.namespace" $ }}
data:
HASURA_SERVICE_TOKEN_SECRET: {{ .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET | b64enc | quote }}
JDBC_URL: {{ .Values.connectorEnvVars.JDBC_URL | b64enc | quote }}
HASURA_SERVICE_TOKEN_SECRET: {{ required "Error: .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET is required!" .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET | b64enc | quote }}
JDBC_URL: {{ required "Error: .Values.connectorEnvVars.JDBC_URL is required!" .Values.connectorEnvVars.JDBC_URL | b64enc | quote }}
{{- if .Values.observability.enabled }}
otel-collector-config.yaml: {{ (tpl .Values.otel.config .) | b64enc | quote }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/ndc-connector-phoenix/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v2024.10.22
version: v2024.10.28

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 2 additions & 2 deletions charts/ndc-connector-phoenix/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: {{ printf "%s-secret" (include "common.name" .) }}
namespace: {{ template "common.namespace" $ }}
data:
HASURA_SERVICE_TOKEN_SECRET: {{ .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET | b64enc | quote }}
JDBC_URL: {{ .Values.connectorEnvVars.JDBC_URL | b64enc | quote }}
HASURA_SERVICE_TOKEN_SECRET: {{ required "Error: .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET is required!" .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET | b64enc | quote }}
JDBC_URL: {{ required "Error: .Values.connectorEnvVars.JDBC_URL is required!" .Values.connectorEnvVars.JDBC_URL | b64enc | quote }}
{{- if .Values.observability.enabled }}
otel-collector-config.yaml: {{ (tpl .Values.otel.config .) | b64enc | quote }}
{{- end }}
29 changes: 29 additions & 0 deletions charts/ndc-elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: ndc-elasticsearch
description: (DDN) A Helm chart for deploying ndc-elasticsearch

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v2024.10.28

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "3.0.0"

dependencies:
- name: common
version: 0.0.6
repository: oci://us-west1-docker.pkg.dev/hasura-ee/helm-charts
80 changes: 80 additions & 0 deletions charts/ndc-elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Ndc-elasticsearch Helm Chart

This chart deploys the ndc-elasticsearch connector. Refer to the pre-requisites section [here](../../README.md#get-started)

## Install Chart

See all [configuration](#parameters) below.

```bash
# EXAMPLES:

# helm template and apply manifests via kubectl (example)
helm template <release-name> \
--set image.repository="my_repo/ndc-elasticsearch" \
--set image.tag="my_custom_image_tag" \
--set connectorEnvVars.ELASTICSEARCH_URL="elasticsearch_url" \
--set connectorEnvVars.ELASTICSEARCH_USERNAME="elasticsearch_username" \
--set connectorEnvVars.ELASTICSEARCH_PASSWORD="elasticsearch_password" \
--set connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET="token" \
--set dataPlane.id="data_plane_id" \
--set dataPlane.key="data_plane_key" \
hasura-ddn/ndc-elasticsearch | kubectl apply -f-

# helm upgrade --install (pass configuration via command line)
helm upgrade --install <release-name> \
--set image.repository="my_repo/ndc-elasticsearch" \
--set image.tag="my_custom_image_tag" \
--set connectorEnvVars.ELASTICSEARCH_URL="elasticsearch_url" \
--set connectorEnvVars.ELASTICSEARCH_USERNAME="elasticsearch_username" \
--set connectorEnvVars.ELASTICSEARCH_PASSWORD="elasticsearch_password" \
--set connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET="token" \
--set dataPlane.id="data_plane_id" \
--set dataPlane.key="data_plane_key" \
hasura-ddn/ndc-elasticsearch
```

## Connector ENV Inputs

| Name | Description | Value |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET` | Hasura Service Token Secret (Required) | `""` |
| `connectorEnvVars.ELASTICSEARCH_URL` | The comma-separated list of Elasticsearch host addresses for connection (Required) | `""` |
| `connectorEnvVars.ELASTICSEARCH_USERNAME` | The username for authenticating to the Elasticsearch cluster (Required) | `""` |
| `connectorEnvVars.ELASTICSEARCH_PASSWORD` | The password for the Elasticsearch user account (Required) | `""` |
| `connectorEnvVars.ELASTICSEARCH_API_KEY` | The Elasticsearch API key for authenticating to the Elasticsearch cluster (Optional) | `""` |
| `connectorEnvVars.ELASTICSEARCH_CA_CERT_PATH` | The path to the Certificate Authority (CA) certificate for verifying the Elasticsearch server's SSL certificate (Optional) | `""` |
| `connectorEnvVars.ELASTICSEARCH_INDEX_PATTERN` | The pattern for matching Elasticsearch indices, potentially including wildcards, used by the connector (Optional) | `""` |
| `connectorEnvVars.ELASTICSEARCH_DEFAULT_RESULT_SIZE` | The default query size when no limit is applied. Defaults to 10,000 (Optional) | `""` |


## Additional Parameters

| Name | Description | Value |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `namespace` | Namespace to deploy to | `"default"` |
| `image.repository` | Image repository containing custom created ndc-elasticsearch | `""` |
| `image.tag` | Image tag to use for custom created ndc-elasticsearch | `""` |
| `image.pullPolicy` | Image pull policy | `Always` |
| `image.otelCollectorRepository` | OTEL collector image repository | `otel/opentelemetry-collector` |
| `image.otelCollectorTag` | OTEL collector image tag | `0.104.0` |
| `observability.enabled` | Deploy OTEL collector as sidecar | `true` |
| `dataPlane.id` | Data Plane ID (Required when observability.enabled is set to true) | `""` |
| `dataPlane.key` | Data Plane Key (Required when observability.enabled is set to true) | `""` |
| `controlPlane.otlpEndpoint` | OTEL endpoint under Hasura | `"https://gateway.otlp.hasura.io:443"` |
| `controlPlane.oauthTokenEndpoint` | Oauth Token URL | `"https://ddn-oauth.pro.hasura.io/oauth2/token"` |
| `extraVolumes` | Optionally specify extra list of additional volumes for the ndc-elasticsearch pod | `[]` |
| `extraContainers` | Optionally specify extra list of additional containers for the ndc-elasticsearch pod | `[]` | |
| `resources` | Resource requests and limits of ndc-elasticsearch container | `{}` |
| `env` | Env variable section for ndc-elasticsearch | `[]` |
| `replicas` | Replicas setting for pod | `1` |
| `wsInactiveExpiryMins` | To be documented | `1` |
| `securityContext` | Define privilege and access control settings for a Pod or Container | `{}` |
| `healthChecks.enabled` | Enable health check for ndc-elasticsearch container | `false` |
| `healthChecks.livenessProbePath` | Health check liveness Probe path ndc-elasticsearch container | `"/healthz"` |
| `healthChecks.readinessProbePath` | Health check readiness Probe path ndc-elasticsearch container | `"/healthz"` |
| `hpa.enabled` | Enable HPA for ndc-elasticsearch. Ensure metrics cluster is configured when enabling | `false` |
| `hpa.minReplicas` | minReplicas setting for HPA | `2` |
| `hpa.maxReplicas` | maxReplicas setting for HPA | `4` |
| `hpa.metrics.resource.name` | Resource name to autoscale on | `` |
| `hpa.metrics.resource.target.averageUtilization` | Utilization target on specific resource type | `` |
22 changes: 22 additions & 0 deletions charts/ndc-elasticsearch/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Ndc-elasticsearch Helm Chart Deployment

1. Deployment Information:
- Release Name: {{ .Release.Name }}
- Namespace: {{ template "common.namespace" . }}
- Chart Name: {{ .Chart.Name }}
- Chart Version: {{ .Chart.Version }}

2. Service Information:
- Service Name: {{ template "common.name" . }}
- Service Port: {{ .Values.httpPort }}

3. Useful Commands:
- Check the Deployment Status:
helm status {{ .Release.Name }}

- Get Detailed Information about the Deployment:
helm get all {{ .Release.Name }}

4. Clean Up:
- To uninstall/delete the deployment, run:
helm uninstall {{ .Release.Name }}
2 changes: 2 additions & 0 deletions charts/ndc-elasticsearch/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# deployment.yaml
{{- template "common.deployment" . -}}
2 changes: 2 additions & 0 deletions charts/ndc-elasticsearch/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
16 changes: 16 additions & 0 deletions charts/ndc-elasticsearch/templates/imagepullsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if ((.Values.global).dataPlane).deployImagePullSecret -}}
{{- with .Values.secrets }}
{{- if .imagePullSecret -}}
---
apiVersion: v1
kind: Secret
metadata:
name: hasura-image-pull
namespace: {{ template "common.namespace" $ }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: |
{{- toJson .imagePullSecret | b64enc | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
25 changes: 25 additions & 0 deletions charts/ndc-elasticsearch/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-secret" (include "common.name" .) }}
namespace: {{ template "common.namespace" $ }}
data:
HASURA_SERVICE_TOKEN_SECRET: {{ required "Error: .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET is required!" .Values.connectorEnvVars.HASURA_SERVICE_TOKEN_SECRET | b64enc | quote }}
ELASTICSEARCH_URL: {{ required "Error: .Values.connectorEnvVars.ELASTICSEARCH_URL is required!" .Values.connectorEnvVars.ELASTICSEARCH_URL | b64enc | quote }}
ELASTICSEARCH_USERNAME: {{ required "Error: .Values.connectorEnvVars.ELASTICSEARCH_USERNAME is required!" .Values.connectorEnvVars.ELASTICSEARCH_USERNAME | b64enc | quote }}
ELASTICSEARCH_PASSWORD: {{ required "Error: .Values.connectorEnvVars.ELASTICSEARCH_PASSWORD is required!" .Values.connectorEnvVars.ELASTICSEARCH_PASSWORD | b64enc | quote }}
{{- if .Values.connectorEnvVars.ELASTICSEARCH_API_KEY }}
ELASTICSEARCH_API_KEY: {{ .Values.connectorEnvVars.ELASTICSEARCH_API_KEY | b64enc | quote }}
{{- end }}
{{- if .Values.connectorEnvVars.ELASTICSEARCH_CA_CERT_PATH }}
ELASTICSEARCH_CA_CERT_PATH: {{ .Values.connectorEnvVars.ELASTICSEARCH_CA_CERT_PATH | b64enc | quote }}
{{- end }}
{{- if .Values.connectorEnvVars.ELASTICSEARCH_INDEX_PATTERN }}
ELASTICSEARCH_INDEX_PATTERN: {{ .Values.connectorEnvVars.ELASTICSEARCH_INDEX_PATTERN | b64enc | quote }}
{{- end }}
{{- if .Values.connectorEnvVars.ELASTICSEARCH_DEFAULT_RESULT_SIZE }}
ELASTICSEARCH_DEFAULT_RESULT_SIZE: {{ .Values.connectorEnvVars.ELASTICSEARCH_DEFAULT_RESULT_SIZE | b64enc | quote }}
{{- end }}
{{- if .Values.observability.enabled }}
otel-collector-config.yaml: {{ (tpl .Values.otel.config .) | b64enc | quote }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/ndc-elasticsearch/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# service.yaml
{{- template "common.service" . -}}
2 changes: 2 additions & 0 deletions charts/ndc-elasticsearch/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# serviceaccount.yaml
{{- template "common.serviceaccount" . -}}
Loading

0 comments on commit b844883

Please sign in to comment.