Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Isha Girdhar <isha.girdhar@oracle.com>
  • Loading branch information
IshaGirdhar committed Jun 2, 2023
1 parent 39290c9 commit 70db5da
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 55 deletions.
6 changes: 0 additions & 6 deletions charts/opensearch-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@ apiVersion: v2
name: opensearch-cluster
description: A Helm chart for OpenSearch Cluster
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.
version: 2.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 2.2.0
23 changes: 0 additions & 23 deletions charts/opensearch-cluster/README.md

This file was deleted.

46 changes: 23 additions & 23 deletions charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
bootstrap:
{{- if .Values.OpenSearchClusterSpec.bootstrap.additionalConfig }}
additionalConfig:
{{ toYaml .Values.OpenSearchClusterSpec.bootstrap.additionalConfig | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.bootstrap.additionalConfig | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.initHelper }}
Expand All @@ -25,7 +25,7 @@ spec:
{{- end }}
{{- if .Values.OpenSearchClusterSpec.initHelper.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.OpenSearchClusterSpec.initHelper.imagePullSecrets | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.initHelper.imagePullSecrets | nindent 6 }}
{{- end }}
{{- end }}
general:
Expand All @@ -42,19 +42,19 @@ spec:
serviceName: {{ .Values.OpenSearchClusterSpec.general.serviceName }}
{{- if .Values.OpenSearchClusterSpec.general.pluginsList }}
pluginsList:
{{ toYaml .Values.OpenSearchClusterSpec.general.pluginsList | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.general.pluginsList | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.general.keystore }}
keystore:
{{ toYaml .Values.OpenSearchClusterSpec.general.keystore | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.general.keystore | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.general.securityContext }}
securityContext:
{{ toYaml .Values.OpenSearchClusterSpec.general.securityContext | indent 6}}
{{ toYaml .Values.OpenSearchClusterSpec.general.securityContext | nindent 6}}
{{- end}}
{{- if .Values.OpenSearchClusterSpec.general.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.OpenSearchClusterSpec.general.podSecurityContext | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.general.podSecurityContext | nindent 6 }}
{{- end}}
{{- if .Values.OpenSearchClusterSpec.general.additionalVolumes }}
additionalVolumes:
Expand All @@ -67,7 +67,7 @@ spec:
{{- end }}
{{- if .Values.OpenSearchClusterSpec.general.additionalConfig }}
additionalConfig:
{{ toYaml .Values.OpenSearchClusterSpec.general.additionalConfig | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.general.additionalConfig | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards }}
dashboards:
Expand All @@ -81,26 +81,26 @@ spec:
replicas: {{ .Values.OpenSearchClusterSpec.dashboards.replicas }}
{{- if .Values.OpenSearchClusterSpec.dashboards.pluginsList }}
pluginsList:
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.pluginsList | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.pluginsList | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.basePath }}
basePath: {{ .Values.OpenSearchClusterSpec.dashboards.basePath }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.labels }}
labels: # Add any extra labels as key-value pairs here
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.labels | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.labels | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.annotations }}
annotations: # Add any extra annotations as key-value pairs here
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.annotations | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.annotations | nindent 6 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.opensearchCredentialsSecret }}
opensearchCredentialsSecret:
name: {{ .Values.OpenSearchClusterSpec.dashboards.opensearchCredentialsSecret.name }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.env }}
env:
{{- toYaml .Values.OpenSearchClusterSpec.dashboards.env | nindent 8 }}
{{- toYaml .Values.OpenSearchClusterSpec.dashboards.env | nindent 8 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.resources }}
resources:
Expand Down Expand Up @@ -142,11 +142,11 @@ spec:
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.securityContext }}
securityContext:
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.securityContext | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.securityContext | nindent 6 }}
{{- end}}
{{- if .Values.OpenSearchClusterSpec.dashboards.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.podSecurityContext | indent 6}}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.podSecurityContext | nindent 6}}
{{- end}}
{{- if .Values.OpenSearchClusterSpec.dashboards.additionalVolumes }}
additionalVolumes:
Expand All @@ -159,7 +159,7 @@ spec:
{{- end }}
{{- if .Values.OpenSearchClusterSpec.dashboards.additionalConfig }}
additionalConfig:
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.additionalConfig | indent 6 }}
{{ toYaml .Values.OpenSearchClusterSpec.dashboards.additionalConfig | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.confMgmt }}
Expand All @@ -175,22 +175,22 @@ spec:
diskSize: {{ $val.diskSize | quote }}
{{- if $val.NodeSelector }}
nodeSelector:
{{- toYaml $val.NodeSelector | nindent 8 }}
{{- toYaml $val.NodeSelector | nindent 8 }}
{{- end }}
{{- if $val.labels }}
labels: # Add any extra labels as key-value pairs here
{{ toYaml $val.labels | indent 8 }}
{{ toYaml $val.labels | nindent 8 }}
{{- end }}
{{- if $val.annotations }}
annotations: # Add any extra annotations as key-value pairs here
{{ toYaml $val.annotations | indent 8 }}
{{ toYaml $val.annotations | nindent 8 }}
{{- end }}
{{- if $val.priorityClassName }}
priorityClassName: {{ $val.priorityClassName }}
{{- end }}
{{- if $val.env }}
env:
{{- toYaml $val.env | nindent 8 }}
{{- toYaml $val.env | nindent 8 }}
{{- end }}
{{- if $val.resources }}
resources:
Expand All @@ -215,7 +215,7 @@ spec:
{{- end }}
{{- if $val.roles }}
roles:
{{ toYaml $val.roles | indent 6 }}
{{ toYaml $val.roles | nindent 6 }}
{{- end }}
{{- if $val.persistence }}
persistence:
Expand All @@ -229,15 +229,15 @@ spec:
{{- end }}
{{- if $val.persistence.pvc.accessModes }}
accessModes:
{{ toYaml $val.persistence.pvc.accessModes | indent 10 }}
{{ toYaml $val.persistence.pvc.accessModes | nindent 10 }}
{{- end }}
{{- else if eq (len $val.persistence.emptyDir) 0 }}
emptyDir: {}
{{- end }}
{{- end }}
{{- if $val.additionalConfig }}
additionalConfig:
{{ toYaml $val.additionalConfig | indent 8 }}
{{ toYaml $val.additionalConfig | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.security }}
Expand Down Expand Up @@ -270,11 +270,11 @@ spec:
{{- end }}
{{- if .Values.OpenSearchClusterSpec.security.tls.transport.adminDn }}
adminDn:
{{ toYaml .Values.OpenSearchClusterSpec.security.tls.transport.adminDn | indent 10 }}
{{ toYaml .Values.OpenSearchClusterSpec.security.tls.transport.adminDn | nindent 10 }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.security.tls.transport.nodesDn }}
nodesDn:
{{ toYaml .Values.OpenSearchClusterSpec.security.tls.transport.nodesDn | indent 10 }}
{{ toYaml .Values.OpenSearchClusterSpec.security.tls.transport.nodesDn | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.OpenSearchClusterSpec.security.tls.http }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch-cluster/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenSearchClusterSpec:
enabled: false
enabled: true
general:
httpPort: "9200"
version: 2.3.0
Expand Down
39 changes: 39 additions & 0 deletions docs/userguide/cluster-chart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# OpenSearch-k8s-operator

The Kubernetes [OpenSearch Operator](https://github.com/Opster/opensearch-k8s-operator) is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards.

## Install OpenSearchCluster Using Helm
The Operator can be easily installed using helm on any CNCF-certified Kubernetes cluster. Please refer to the [User Guide](https://github.com/Opster/opensearch-k8s-operator/blob/main/docs/userguide/main.md) for more information.
Once the operator is installed, OpenSearch cluster can be installed using helm in the same CNCF-certified Kubernetes cluster.

### OpenSearchCluster Installation Using Helm

#### Install Chart
```
helm install [RELEASE_NAME] opensearch-operator/opensearch-cluster
```
#### Uninstall Chart
```
helm uninstall [RELEASE_NAME]
```
#### Upgrade Chart
```
helm repo update
helm upgrade [RELEASE_NAME] opensearch-operator/opensearch-cluster
```

## Configuring OpenSearch Cluster
By default, the installation will deploy a node pool consisting of three master nodes with the dashboard enabled. For the entire configuration, check [helm chart values](../../charts/opensearch-cluster/values.yaml).

To further customize your OpenSearchCluster installation, you can utilize configuration overrides and modify your `values.yaml`, this allows you to tailor various aspects of the installation to meet your specific requirements.
For instance, if you need to change the httpPort to 9300, this can be achieved by setting `OpenSearchClusterSpec.general.httpPort` to `9300` in the [helm chart values](../../charts/opensearch-cluster/values.yaml).
```yaml
OpenSearchClusterSpec:
general:
httpPort: "9300"
version: 2.3.0
serviceName: "my-cluster"
```


8 changes: 7 additions & 1 deletion docs/userguide/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ A few notes on operator releases:

## Quickstart

After you have successfully installed the Operator, you can deploy your first OpenSearch cluster. This is done by creating an `OpenSearchCluster` custom object in Kubernetes.
After you have successfully installed the Operator, you can deploy your first OpenSearch cluster. This is done by creating an `OpenSearchCluster` custom object in Kubernetes or using Helm.

### Using Helm

OpenSearch cluster can be easily deployed using Helm. Follow the instructions in [Cluster Chart Guide](./cluster-chart.md) to install the cluster.

### Using Custom Object

Create a file `cluster.yaml` with the following content:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() {
})
})

// The cluster has been created using Helm outside of this test. This test verifies the presence of the resources after the cluster is created.
var _ = Describe("DeployWithHelm", Ordered, func() {
name := "opensearch-cluster"
namespace := "default"

When("creating a cluster", Ordered, func() {
When("cluster is created using helm", Ordered, func() {
It("should have 3 ready master pods", func() {
sts := appsv1.StatefulSet{}
Eventually(func() int32 {
Expand Down

0 comments on commit 70db5da

Please sign in to comment.