diff --git a/charts/opensearch-cluster/Chart.yaml b/charts/opensearch-cluster/Chart.yaml index 68600ae7c..6cfe8e2cf 100644 --- a/charts/opensearch-cluster/Chart.yaml +++ b/charts/opensearch-cluster/Chart.yaml @@ -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 diff --git a/charts/opensearch-cluster/README.md b/charts/opensearch-cluster/README.md deleted file mode 100644 index f7e612b60..000000000 --- a/charts/opensearch-cluster/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# 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 OpenSeachCluster 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 -``` \ No newline at end of file diff --git a/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml b/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml index ba27701bd..e727df19f 100644 --- a/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml +++ b/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml @@ -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 }} @@ -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: @@ -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: @@ -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: @@ -81,18 +81,18 @@ 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: @@ -100,7 +100,7 @@ spec: {{- 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: @@ -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: @@ -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 }} @@ -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: @@ -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: @@ -229,7 +229,7 @@ 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: {} @@ -237,7 +237,7 @@ spec: {{- end }} {{- if $val.additionalConfig }} additionalConfig: -{{ toYaml $val.additionalConfig | indent 8 }} + {{ toYaml $val.additionalConfig | nindent 8 }} {{- end }} {{- end }} {{- if .Values.OpenSearchClusterSpec.security }} @@ -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 }} diff --git a/charts/opensearch-cluster/values.yaml b/charts/opensearch-cluster/values.yaml index 1329f1982..a50c8e144 100644 --- a/charts/opensearch-cluster/values.yaml +++ b/charts/opensearch-cluster/values.yaml @@ -1,5 +1,5 @@ OpenSearchClusterSpec: - enabled: false + enabled: true general: httpPort: "9200" version: 2.3.0 diff --git a/docs/userguide/cluster-chart.md b/docs/userguide/cluster-chart.md new file mode 100644 index 000000000..f3980c9e6 --- /dev/null +++ b/docs/userguide/cluster-chart.md @@ -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" +``` + + diff --git a/docs/userguide/main.md b/docs/userguide/main.md index 0b4518e8e..eecb499ef 100644 --- a/docs/userguide/main.md +++ b/docs/userguide/main.md @@ -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: diff --git a/opensearch-operator/functionaltests/deploy_and_upgrade_test.go b/opensearch-operator/functionaltests/deploy_and_upgrade_test.go index 62cada19f..f27a0f012 100644 --- a/opensearch-operator/functionaltests/deploy_and_upgrade_test.go +++ b/opensearch-operator/functionaltests/deploy_and_upgrade_test.go @@ -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 {