Skip to content

Commit fdc9631

Browse files
committed
Deploy: added more charts/helm cfgs for OS.
1 parent 6d0bbf8 commit fdc9631

10 files changed

Lines changed: 69 additions & 102 deletions

File tree

deploy/Makefile

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,8 @@ REMOTE_SSH_KEY_ARG = $(if $(strip $(REMOTE_SSH_KEY)),-i $(REMOTE_SSH_KEY),)
1111
HELM_OPENSEARCH_RELEASE ?= cogstack-opensearch
1212
HELM_OPENSEARCH_NAMESPACE ?= cogstack
1313
HELM_OPENSEARCH_CHART ?= ./charts/opensearch
14-
HELM_OPENSEARCH_CONFIG_FILE ?= ../services/elasticsearch/config/opensearch.yml
15-
HELM_OPENSEARCH_LOG4J_FILE ?= ../services/elasticsearch/config/log4j2_opensearch.properties
16-
HELM_DASHBOARDS_CONFIG_FILE ?= ../services/kibana/config/opensearch.yml
17-
HELM_OPENSEARCH_ENV_FILE ?= ./elasticsearch.env
18-
HELM_OPENSEARCH_USERS_ENV_FILE ?= ../security/env/users_elasticsearch.env
19-
HELM_OPENSEARCH_CERTS_ENV_FILE ?= ../security/env/certificates_elasticsearch.env
20-
HELM_OPENSEARCH_SECURITY_DIR ?= ../security/es_roles/opensearch
21-
HELM_OPENSEARCH_SET_FILES = --set-file configFiles.opensearchRaw=$(HELM_OPENSEARCH_CONFIG_FILE) \
22-
--set-file configFiles.log4jRaw=$(HELM_OPENSEARCH_LOG4J_FILE) \
23-
--set-file configFiles.dashboardsRaw=$(HELM_DASHBOARDS_CONFIG_FILE) \
24-
--set-file envFile.raw=$(HELM_OPENSEARCH_ENV_FILE) \
25-
--set-file usersEnvFile.raw=$(HELM_OPENSEARCH_USERS_ENV_FILE) \
26-
--set-file certificatesEnvFile.raw=$(HELM_OPENSEARCH_CERTS_ENV_FILE) \
27-
--set-file securityFiles.configRaw=$(HELM_OPENSEARCH_SECURITY_DIR)/config.yml \
28-
--set-file securityFiles.internalUsersRaw=$(HELM_OPENSEARCH_SECURITY_DIR)/internal_users.yml \
29-
--set-file securityFiles.rolesRaw=$(HELM_OPENSEARCH_SECURITY_DIR)/roles.yml \
30-
--set-file securityFiles.rolesMappingRaw=$(HELM_OPENSEARCH_SECURITY_DIR)/roles_mapping.yml
14+
HELM_OPENSEARCH_VALUES_FILE ?= ./helm/opensearch.values.yaml
15+
HELM_OPENSEARCH_VALUES_ARG = -f $(HELM_OPENSEARCH_VALUES_FILE)
3116

3217
define WITH_ENV
3318
set -a && source ./export_env_vars.sh;
@@ -89,11 +74,11 @@ load-env: ## Load variables from export_env_vars.sh in a subshell
8974
show-env: ## Print sorted environment variables after loading export_env_vars.sh
9075
${WITH_ENV} >/dev/null 2>&1; printenv | sort
9176

92-
helm-template-opensearch: ## Render OpenSearch chart using shared services/security config files
93-
helm template $(HELM_OPENSEARCH_RELEASE) $(HELM_OPENSEARCH_CHART) $(HELM_OPENSEARCH_SET_FILES)
77+
helm-template-opensearch: ## Render OpenSearch chart using chart defaults plus ./helm/opensearch.values.yaml
78+
helm template $(HELM_OPENSEARCH_RELEASE) $(HELM_OPENSEARCH_CHART) $(HELM_OPENSEARCH_VALUES_ARG)
9479

95-
helm-install-opensearch: ## Install/upgrade OpenSearch chart using shared services/security config files
96-
helm upgrade --install $(HELM_OPENSEARCH_RELEASE) $(HELM_OPENSEARCH_CHART) $(HELM_OPENSEARCH_SET_FILES) --namespace $(HELM_OPENSEARCH_NAMESPACE) --create-namespace
80+
helm-install-opensearch: ## Install/upgrade OpenSearch chart using chart defaults plus ./helm/opensearch.values.yaml
81+
helm upgrade --install $(HELM_OPENSEARCH_RELEASE) $(HELM_OPENSEARCH_CHART) $(HELM_OPENSEARCH_VALUES_ARG) --namespace $(HELM_OPENSEARCH_NAMESPACE) --create-namespace
9782

9883

9984
remote-deploy-service: ## Deploy one or more services to a remote machine via SSH + docker compose

deploy/charts/README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,14 @@ This directory contains Helm charts owned by this repository's deployment layer.
1616
```bash
1717
# Render manifests
1818
helm template cogstack-opensearch ./deploy/charts/opensearch \
19-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
20-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
21-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
22-
--set-file envFile.raw=./deploy/elasticsearch.env \
23-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
24-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
25-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
26-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
27-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
28-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml
19+
-f ./deploy/helm/opensearch.values.yaml
2920

3021
# Install/upgrade
3122
helm upgrade --install cogstack-opensearch ./deploy/charts/opensearch \
32-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
33-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
34-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
35-
--set-file envFile.raw=./deploy/elasticsearch.env \
36-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
37-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
38-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
39-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
40-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
41-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml \
23+
-f ./deploy/helm/opensearch.values.yaml \
4224
--namespace cogstack --create-namespace
4325
```
4426

45-
The OpenSearch and Dashboards config files should come from `services/`, and the security files from `security/`, so Docker and Kubernetes use the same source files.
27+
The OpenSearch and Dashboards config files should come from `services/`, and the security and env files from `security/` and `deploy/`, so Docker and Kubernetes use the same source files.
28+
The values file is for cluster-specific overrides only; it does not need to repeat the shared YAML or env file paths.
4629
Only keys in `envFile.includeKeys`, `usersEnvFile.includeKeys`, and `certificatesEnvFile.includeKeys` are imported.

deploy/charts/opensearch/README.md

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,7 @@ kubectl create secret generic opensearch-certs \
7373

7474
```bash
7575
helm upgrade --install cogstack-opensearch ./deploy/charts/opensearch \
76-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
77-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
78-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
79-
--set-file envFile.raw=./deploy/elasticsearch.env \
80-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
81-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
82-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
83-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
84-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
85-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml \
76+
-f ./deploy/helm/opensearch.values.yaml \
8677
--namespace cogstack --create-namespace
8778
```
8879

@@ -102,27 +93,18 @@ helm upgrade --install cogstack-dashboards ./deploy/charts/opensearch \
10293

10394
```bash
10495
helm template cogstack-opensearch ./deploy/charts/opensearch \
105-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
106-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
107-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
108-
--set-file envFile.raw=./deploy/elasticsearch.env \
109-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
110-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
111-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
112-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
113-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
114-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml
96+
-f ./deploy/helm/opensearch.values.yaml
11597
```
11698

11799
## Notes
118100

119101
- Helm templates cannot read arbitrary `../../...` paths directly; `.Files.Get` only sees files packaged inside the chart.
120-
- In this repo, the chart `files/` entries are symlinked to the shared `services/` and `security/` sources so Docker and Kubernetes stay aligned.
121-
- The standard install/render commands still use `--set-file` explicitly to make the source-of-truth paths obvious at invocation time.
122-
- If you run Helm from `deploy/charts/opensearch`, the equivalent relative paths are `../../../services/...` and `../../../security/...`.
123-
- `envFile.raw` can be set from `deploy/elasticsearch.env`; the chart reads shared values from it (`ELASTICSEARCH_CLUSTER_NAME`, `ELASTICSEARCH_JAVA_OPTS` / `OPENSEARCH_JAVA_OPTS`, `KIBANA_SERVER_NAME`) and still generates Kubernetes-specific discovery and publish-host settings itself.
124-
- `usersEnvFile.raw` can be set from `security/env/users_elasticsearch.env` and feeds only the credential keys required by the enabled components.
125-
- `certificatesEnvFile.raw` can be set from `security/env/certificates_elasticsearch.env`; currently `ES_CLIENT_CERT_NAME` is used to resolve Dashboards cert secret keys (`<name>.pem` / `<name>.key`).
102+
- In this repo, the chart `files/` entries are symlinked to the shared `deploy/`, `services/`, and `security/` sources so Docker and Kubernetes stay aligned.
103+
- The standard install/render commands now use `-f ./deploy/helm/opensearch.values.yaml`; that file is for cluster-specific overrides only.
104+
- The shared `services/`, `security/`, and selected `deploy/` env files are consumed automatically by the chart defaults; you do not need to repeat those paths in the values file.
105+
- `envFile.raw` defaults to `deploy/elasticsearch.env` and can still be overridden; the chart reads only `ELASTICSEARCH_CLUSTER_NAME`, `ELASTICSEARCH_JAVA_OPTS` / `OPENSEARCH_JAVA_OPTS`, and `KIBANA_SERVER_NAME`, while pod IP and discovery hosts remain Kubernetes-specific.
106+
- `usersEnvFile.raw` defaults to `security/env/users_elasticsearch.env` and can still be overridden; only the credential keys required by the enabled components are imported.
107+
- `certificatesEnvFile.raw` defaults to `security/env/certificates_elasticsearch.env` and can still be overridden; currently `ES_CLIENT_CERT_NAME` is used to resolve Dashboards cert secret keys (`<name>.pem` / `<name>.key`).
126108
- `deploy/elasticsearch.env` shared values are used where they make sense on Kubernetes (`ELASTICSEARCH_CLUSTER_NAME`, `ELASTICSEARCH_JAVA_OPTS` / `OPENSEARCH_JAVA_OPTS`, `KIBANA_SERVER_NAME`), while pod IP and discovery hosts remain Kubernetes-specific.
127109
- By default, `certificates.opensearchNodeFiles[*]` maps pod ordinals `0/1/2` to repo-style node cert keys `elasticsearch-1/2/3`.
128110
- `opensearch.logPersistence` and `opensearch.performanceAnalyzerPersistence` default to PVC-backed storage to stay closer to the Docker Compose deployment.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../security/env/certificates_elasticsearch.env
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../deploy/elasticsearch.env
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../security/env/users_elasticsearch.env

deploy/charts/opensearch/templates/_helpers.tpl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ app.kubernetes.io/component: dashboards
7777
{{- define "cogstack-opensearch.parsedEnvFile" -}}
7878
{{- $root := . -}}
7979
{{- $envData := dict -}}
80-
{{- if $root.Values.envFile.raw -}}
81-
{{- $renderedEnv := tpl $root.Values.envFile.raw $root -}}
80+
{{- $rawEnv := $root.Values.envFile.raw | default ($root.Files.Get "files/deploy-elasticsearch.envfile") -}}
81+
{{- if $rawEnv -}}
82+
{{- $renderedEnv := tpl $rawEnv $root -}}
8283
{{- range $line := splitList "\n" $renderedEnv }}
8384
{{- $clean := trim (replace "\r" "" $line) -}}
8485
{{- if and $clean (not (hasPrefix "#" $clean)) -}}
@@ -110,8 +111,9 @@ app.kubernetes.io/component: dashboards
110111
{{- define "cogstack-opensearch.parsedUsersEnvFile" -}}
111112
{{- $root := . -}}
112113
{{- $usersData := dict -}}
113-
{{- if $root.Values.usersEnvFile.raw -}}
114-
{{- $renderedUsers := tpl $root.Values.usersEnvFile.raw $root -}}
114+
{{- $rawUsers := $root.Values.usersEnvFile.raw | default ($root.Files.Get "files/users-elasticsearch.envfile") -}}
115+
{{- if $rawUsers -}}
116+
{{- $renderedUsers := tpl $rawUsers $root -}}
115117
{{- range $line := splitList "\n" $renderedUsers }}
116118
{{- $clean := trim (replace "\r" "" $line) -}}
117119
{{- if and $clean (not (hasPrefix "#" $clean)) -}}
@@ -137,8 +139,9 @@ app.kubernetes.io/component: dashboards
137139
{{- define "cogstack-opensearch.parsedCertificatesEnvFile" -}}
138140
{{- $root := . -}}
139141
{{- $certData := dict -}}
140-
{{- if $root.Values.certificatesEnvFile.raw -}}
141-
{{- $renderedCerts := tpl $root.Values.certificatesEnvFile.raw $root -}}
142+
{{- $rawCerts := $root.Values.certificatesEnvFile.raw | default ($root.Files.Get "files/certificates-elasticsearch.envfile") -}}
143+
{{- if $rawCerts -}}
144+
{{- $renderedCerts := tpl $rawCerts $root -}}
142145
{{- range $line := splitList "\n" $renderedCerts }}
143146
{{- $clean := trim (replace "\r" "" $line) -}}
144147
{{- if and $clean (not (hasPrefix "#" $clean)) -}}

deploy/charts/opensearch/values.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ configFiles:
1212
dashboardsRaw: ""
1313

1414
envFile:
15-
# Pass deploy/elasticsearch.env via:
15+
# Optional override. If empty, chart falls back to files/deploy-elasticsearch.envfile.
16+
# Use:
1617
# --set-file envFile.raw=./deploy/elasticsearch.env
1718
raw: ""
1819
# Only these shared values are read from deploy/elasticsearch.env.
@@ -24,7 +25,8 @@ envFile:
2425
- KIBANA_SERVER_NAME
2526

2627
usersEnvFile:
27-
# Pass security/env/users_elasticsearch.env via:
28+
# Optional override. If empty, chart falls back to files/users-elasticsearch.envfile.
29+
# Use:
2830
# --set-file usersEnvFile.raw=./security/env/users_elasticsearch.env
2931
raw: ""
3032
# Only these keys are imported into the credentials Secret.
@@ -34,7 +36,8 @@ usersEnvFile:
3436
- KIBANA_PASSWORD
3537

3638
certificatesEnvFile:
37-
# Pass security/env/certificates_elasticsearch.env via:
39+
# Optional override. If empty, chart falls back to files/certificates-elasticsearch.envfile.
40+
# Use:
3841
# --set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env
3942
raw: ""
4043
# Only keys listed here are imported from certificates env.

deploy/helm/opensearch.values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Cluster-specific overrides for the OpenSearch Helm chart.
2+
#
3+
# Shared OpenSearch, Dashboards, security YAML, and selected env files are not
4+
# listed here: the chart already consumes the repo's canonical files from
5+
# deploy/, services/, and security/ via its bundled defaults.
6+
7+
certificates:
8+
opensearchSecretName: opensearch-certs
9+
dashboardsSecretName: opensearch-certs
10+
11+
# Uncomment to use a pre-created credentials Secret instead of chart defaults.
12+
# credentials:
13+
# create: false
14+
# existingSecret: opensearch-credentials
15+
16+
# Example storage overrides:
17+
# opensearch:
18+
# persistence:
19+
# storageClassName: standard
20+
# logPersistence:
21+
# storageClassName: standard
22+
# performanceAnalyzerPersistence:
23+
# storageClassName: standard
24+
# snapshotBackups:
25+
# enabled: true
26+
# data:
27+
# existingClaim: shared-es-data-backups
28+
# config:
29+
# existingClaim: shared-es-config-backups

docs/deploy/deployment.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,38 +70,17 @@ Quick usage:
7070
```bash
7171
# render manifests
7272
helm template cogstack-opensearch ./deploy/charts/opensearch \
73-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
74-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
75-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
76-
--set-file envFile.raw=./deploy/elasticsearch.env \
77-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
78-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
79-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
80-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
81-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
82-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml
73+
-f ./deploy/helm/opensearch.values.yaml
8374

8475
# install or upgrade
8576
helm upgrade --install cogstack-opensearch ./deploy/charts/opensearch \
86-
--set-file configFiles.opensearchRaw=./services/elasticsearch/config/opensearch.yml \
87-
--set-file configFiles.log4jRaw=./services/elasticsearch/config/log4j2_opensearch.properties \
88-
--set-file configFiles.dashboardsRaw=./services/kibana/config/opensearch.yml \
89-
--set-file envFile.raw=./deploy/elasticsearch.env \
90-
--set-file usersEnvFile.raw=./security/env/users_elasticsearch.env \
91-
--set-file certificatesEnvFile.raw=./security/env/certificates_elasticsearch.env \
92-
--set-file securityFiles.configRaw=./security/es_roles/opensearch/config.yml \
93-
--set-file securityFiles.internalUsersRaw=./security/es_roles/opensearch/internal_users.yml \
94-
--set-file securityFiles.rolesRaw=./security/es_roles/opensearch/roles.yml \
95-
--set-file securityFiles.rolesMappingRaw=./security/es_roles/opensearch/roles_mapping.yml \
77+
-f ./deploy/helm/opensearch.values.yaml \
9678
--namespace cogstack --create-namespace
9779
```
9880

9981
> The chart expects pre-created Kubernetes Secrets for TLS materials (see the chart README).
100-
> The `--set-file configFiles.*Raw=...` flags point Helm at the same OpenSearch and Dashboards config files used by Docker Compose.
101-
> The `--set-file envFile.raw=...` flag lets the chart read shared values from `deploy/elasticsearch.env` while still generating Kubernetes-specific discovery and publish-host settings itself.
102-
> The `--set-file usersEnvFile.raw=...` flag feeds only the credential keys required by the enabled chart components into the chart Secret.
103-
> The `--set-file certificatesEnvFile.raw=...` flag loads certificate metadata from `security/env/certificates_elasticsearch.env` (`ES_CLIENT_CERT_NAME` currently).
104-
> The `--set-file securityFiles.*Raw=...` flags use `security/es_roles/opensearch/*.yml` as the source of OpenSearch security config.
82+
> The chart already consumes the shared OpenSearch, Dashboards, and security YAML files automatically from this repo.
83+
> The values file is only for cluster-specific overrides such as secret names, storage classes, replicas, and snapshot PVC claims.
10584
10685
## 🧰 Makefile Command Overview
10786

0 commit comments

Comments
 (0)