Skip to content

Commit

Permalink
allow initial_master_nodes to be disabled (opensearch-project#279)
Browse files Browse the repository at this point in the history
* allow initial_master_nodes to be disabled

Signed-off-by: Henning Surmeier <[email protected]>

* bump chart version

Signed-off-by: Henning Surmeier <[email protected]>

* set replicas to 1 if singleNode

Signed-off-by: Henning Surmeier <[email protected]>

* Describe `singleNode` in README

Signed-off-by: Henning Surmeier <[email protected]>

* set discovery.type env var if .singleNode is true

Signed-off-by: Henning Surmeier <[email protected]>

* always specify discovery.type

Signed-off-by: Henning Surmeier <[email protected]>

* Revert "always specify discovery.type"

This reverts commit 700d0a2.

Signed-off-by: Henning Surmeier <[email protected]>

Signed-off-by: Henning Surmeier <[email protected]>
Co-authored-by: Dhiraj Kumar Jain <[email protected]>
  • Loading branch information
hensur and TheAlgo authored Aug 26, 2022
1 parent 3fadc8b commit 0276f54
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
15 changes: 13 additions & 2 deletions charts/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
---
## [2.3.0]
## [2.4.1]
### Added
- Add "singleNode" feature to disable the "cluster.initial_master_nodes" env var
### Changed
### Deprecated
### Removed
### Fixed
### Security
---
## [2.4.0]
### Added
- Updated version to 2.4.0 and appVersion to "2.2.0".
### Changed
Expand Down Expand Up @@ -67,7 +76,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.4.0...HEAD

[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.4.1...HEAD
[2.4.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.4.0...opensearch-2.4.1
[2.4.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.3.0...opensearch-2.4.0
[2.3.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.2.0...opensearch-2.3.0
[2.2.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.1.0...opensearch-2.2.0
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch/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: 2.4.0
version: 2.4.1

# 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
1 change: 1 addition & 0 deletions charts/opensearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ helm uninstall my-release
| `replicas` | Kubernetes replica count for the StatefulSet (i.e. how many pods) | `3` |
| `resources` | Allows you to set the [resources][] for the StatefulSet | see [values.yaml][] |
| `roles` | A list of the specific node [roles][] for the `nodeGroup` | see [values.yaml][] |
| `singleNode` | If `discovery.type` in the opensearch configuration is set to `"single-node"`, this should be set to `true`. If `true`, replicas will be forced to `1`. | `false` |
| `schedulerName` | Name of the [alternate scheduler][] | `""` |
| `secretMounts` | Allows you easily mount a secret as a file inside the StatefulSet. Useful for mounting certificates and other secrets. See [values.yaml][] for an example | `[]` |
| `securityConfig` | Configure the opensearch security plugin. There are multiple ways to inject configuration into the chart, see [values.yaml][] details. | By default an insecure demonstration configuration is set. This **must** be changed before going to production. |
Expand Down
12 changes: 10 additions & 2 deletions charts/opensearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ spec:
selector:
matchLabels:
{{- include "opensearch.selectorLabels" . | nindent 6 }}
{{- if .Values.singleNode }}
replicas: 1
{{- else }}
replicas: {{ .Values.replicas }}
{{- end }}
podManagementPolicy: {{ .Values.podManagementPolicy }}
updateStrategy:
type: {{ .Values.updateStrategy }}
Expand Down Expand Up @@ -320,7 +324,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- if has "master" .Values.roles }}
{{- if (and (has "master" .Values.roles) (not .Values.singleNode)) }}
- name: cluster.initial_master_nodes
value: "{{ template "opensearch.endpoints" . }}"
{{- end }}
Expand All @@ -334,6 +338,10 @@ spec:
value: "{{ .Values.opensearchJavaOpts }}"
- name: node.roles
value: "{{ template "opensearch.roles" . }}"
{{- if .Values.singleNode }}
- name: discovery.type
value: "single-node"
{{- end }}
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 8 }}
{{- end }}
Expand Down Expand Up @@ -490,4 +498,4 @@ spec:
{{- else }}
{{ toYaml .Values.extraContainers | indent 6 }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/opensearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
clusterName: "opensearch-cluster"
nodeGroup: "master"

# If discovery.type in the opensearch configuration is set to "single-node",
# this should be set to "true"
# If "true", replicas will be forced to 1
singleNode: false

# The service that non master groups will try to connect to when joining the cluster
# This should be set to clusterName + "-" + nodeGroup for your master group
masterService: "opensearch-cluster-master"
Expand Down Expand Up @@ -47,6 +52,7 @@ config:
network.host: 0.0.0.0
# Setting network.host to a non-loopback address enables the annoying bootstrap checks. "Single-node" mode disables them again.
# Implicitly done if ".singleNode" is set to "true".
# discovery.type: single-node
# Start OpenSearch Security Demo Configuration
Expand Down

0 comments on commit 0276f54

Please sign in to comment.