-
Notifications
You must be signed in to change notification settings - Fork 142
Enable OpenSearch support in Jira Helm chart #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
amierzwicki
wants to merge
6
commits into
main
from
issue/DEVPROD-3811-support-for-opensearch-in-jira
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
813741a
DEVPROD-3811 Added support for OpenSearch for Jira.
amierzwicki e03b0a7
DEVPROD-3811 Improved tests
amierzwicki 8b34d51
Merge branch 'main' into issue/DEVPROD-3811-support-for-opensearch-in…
amierzwicki 532a015
DEVPROD-3811 Jira: Updated opensearch to 3.5.0
amierzwicki dfcbdb0
DEVPROD-3811 Corrected documentation.
amierzwicki 7cf4b31
DEVPROD-3811 Improved JiraOpenSearchTest
amierzwicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,5 +8,6 @@ nav: | |
| - bamboo | ||
| - bitbucket | ||
| - confluence | ||
| - jira | ||
| - logging | ||
| - ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| collapse_single_pages: false | ||
| nav: | ||
| - JIRA_OPENSEARCH.md | ||
| - ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Configuring OpenSearch for Jira | ||
|
|
||
| !!!info "Jira and Helm chart version" | ||
| OpenSearch is supported in Jira 11.0.0 and Helm chart 2.0.10 onwards. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo: OpenSearch went GA with Jira 11.2. |
||
|
|
||
| As Jira instances grow in size and scale, the default search engine, Lucene, may be slower to index and return search results. To address this, Jira Data Center offers an alternative search engine as an opt-in feature — OpenSearch. | ||
|
|
||
| ## Deploy OpenSearch Helm Chart with Jira | ||
|
|
||
| !!!warning "Support disclaimer" | ||
| Atlassian does not officially support OpenSearch Helm chart that can be installed with the Jira Helm release. Should you encounter any issues with the deployment, maintenance and upgrades, reach out to the [vendor](https://github.com/opensearch-project/helm-charts/tree/main/charts/opensearch){.external}. | ||
| Moreover, if you intend to deploy OpenSearch to a critical Kubernetes environment, make sure you follow all the best practices, i.e. deploy a multi node cluster, use taints and tolerations, affinity rules, sufficient resources requests, have DR and backup strategies etc. | ||
|
|
||
| ## Deploy with the default settings | ||
|
|
||
| To deploy OpenSearch Helm chart and automatically configure Jira to use it as a search platform, set the following in your Helm values file: | ||
|
|
||
| ```yaml | ||
| opensearch: | ||
| enabled: true | ||
| ``` | ||
| This will: | ||
|
|
||
| * auto-generate the initial OpenSearch admin password and create a Kubernetes secret with `OPENSEARCH_INITIAL_ADMIN_PASSWORD` key | ||
| * deploy [OpenSearch Helm chart](https://github.com/opensearch-project/helm-charts/tree/main/charts/opensearch){.external} to the target namespace with the default settings: single node, 1Gi memory/1 vCPU resources requests, 10Gi storage request | ||
| * configure Jira to use the deployed OpenSearch cluster by setting `ATL_SEARCH_PLATFORM=opensearch`, `ATL_OPENSEARCH_HTTP_URL=http://opensearch-cluster-master:9200`, `ATL_OPENSEARCH_USERNAME=admin` and `ATL_OPENSEARCH_PASSWORD` environment variables on the Jira container | ||
|
|
||
| ## Override OpenSearch Helm chart values | ||
|
|
||
| You can configure your OpenSearch cluster and the deployment options by overriding any values that the [Helm chart](https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml){.external} exposes. OpenSearch values must be nested under `opensearch` stanza in your Helm values file, for example: | ||
|
|
||
| ```yaml | ||
| opensearch: | ||
| singleNode: false | ||
| replicas: 5 | ||
| config: | ||
| opensearch.yml: | | ||
| cluster.name: opensearch-cluster | ||
| ``` | ||
|
|
||
| ## Use an existing OpenSearch secret | ||
|
|
||
| If you have a pre-created Kubernetes secret with the OpenSearch admin password, you can reference it instead of having the chart auto-generate one: | ||
|
|
||
| ```yaml | ||
| opensearch: | ||
| enabled: true | ||
| credentials: | ||
| createSecret: false | ||
| existingSecretRef: | ||
| name: my-opensearch-secret | ||
| ``` | ||
|
|
||
| The secret must contain a key named `OPENSEARCH_INITIAL_ADMIN_PASSWORD`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {{- if and .Values.opensearch.enabled .Values.opensearch.credentials.createSecret (empty .Values.opensearch.credentials.existingSecretRef.name) }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: opensearch-initial-password | ||
| labels: | ||
| {{- include "common.labels.commonLabels" . | nindent 4 }} | ||
| type: Opaque | ||
| data: | ||
| OPENSEARCH_INITIAL_ADMIN_PASSWORD: {{- include "opensearch.initial.admin.password" . | indent 4 }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| package test; | ||
|
|
||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.TestInfo; | ||
| import test.helm.Helm; | ||
| import test.model.Product; | ||
|
|
||
| import java.util.Base64; | ||
| import java.util.Map; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static test.jackson.JsonNodeAssert.assertThat; | ||
| import static test.model.Kind.Secret; | ||
|
|
||
| class JiraOpenSearchTest { | ||
|
|
||
| private static final Product JIRA = Product.jira; | ||
|
|
||
| private Helm helm; | ||
|
|
||
| @BeforeEach | ||
| void initHelm(TestInfo testInfo) { | ||
| helm = new Helm(testInfo); | ||
| } | ||
|
|
||
| @Test | ||
| void opensearch_statefulset_is_created_when_enabled() throws Exception { | ||
| final var resources = helm.captureKubeResourcesFromHelmChart(JIRA, Map.of( | ||
| "opensearch.enabled", "true" | ||
| )); | ||
| final var statefulSet = resources.getStatefulSet("opensearch-cluster-master"); | ||
| assertThat(statefulSet.getSpec()).isNotNull(); | ||
| } | ||
|
|
||
| @Test | ||
| void opensearch_secret_contains_valid_base64_password() throws Exception { | ||
| final var resources = helm.captureKubeResourcesFromHelmChart(JIRA, Map.of( | ||
| "opensearch.enabled", "true" | ||
| )); | ||
| final var secret = resources.get(Secret, "opensearch-initial-password"); | ||
| JsonNode password = secret.getConfigMapData().path("OPENSEARCH_INITIAL_ADMIN_PASSWORD"); | ||
| assertThat(password).isNotNull(); | ||
| assertDoesNotThrow(() -> { | ||
| Base64.getDecoder().decode(password.asText()); | ||
| }, "Password should be a valid Base64 encoded string"); | ||
| byte[] decodedPassword = Base64.getDecoder().decode(password.asText()); | ||
| assertEquals(40, decodedPassword.length, "The decoded password should have a length of 40 bytes."); | ||
| } | ||
|
|
||
| @Test | ||
| void opensearch_env_vars_are_set_with_default_credentials() throws Exception { | ||
| final var resources = helm.captureKubeResourcesFromHelmChart(JIRA, Map.of( | ||
| "opensearch.enabled", "true" | ||
| )); | ||
|
|
||
| final var statefulSet = resources.getStatefulSet(JIRA.getHelmReleaseName()); | ||
| final var env = statefulSet.getContainer().getEnv(); | ||
| env.assertHasValue("ATL_SEARCH_PLATFORM", "opensearch"); | ||
| env.assertHasValue("ATL_OPENSEARCH_HTTP_URL", "http://opensearch-cluster-master:9200"); | ||
| env.assertHasValue("ATL_OPENSEARCH_USERNAME", "admin"); | ||
| env.assertHasSecretRef("ATL_OPENSEARCH_PASSWORD", "opensearch-initial-password", "OPENSEARCH_INITIAL_ADMIN_PASSWORD"); | ||
| } | ||
|
|
||
| @Test | ||
| void opensearch_env_vars_use_existing_secret_when_configured() throws Exception { | ||
| final var resources = helm.captureKubeResourcesFromHelmChart(JIRA, Map.of( | ||
| "opensearch.enabled", "true", | ||
| "opensearch.credentials.existingSecretRef.name", "my-opensearch-secret" | ||
| )); | ||
|
|
||
| final var statefulSet = resources.getStatefulSet(JIRA.getHelmReleaseName()); | ||
| final var env = statefulSet.getContainer().getEnv(); | ||
| env.assertHasSecretRef("ATL_OPENSEARCH_PASSWORD", "my-opensearch-secret", "OPENSEARCH_INITIAL_ADMIN_PASSWORD"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: OpenSearch went GA with Jira 11.2.