From 4f45f22f2e229e668e1e20a1f598259a850f88ac Mon Sep 17 00:00:00 2001 From: Yulong Ruan Date: Wed, 13 Mar 2024 16:25:59 +0800 Subject: [PATCH] add plugins.removeList to allow remove plugins resolved #383 Signed-off-by: Yulong Ruan --- charts/opensearch-dashboards/templates/deployment.yaml | 3 +++ charts/opensearch-dashboards/values.yaml | 2 ++ charts/opensearch/templates/statefulset.yaml | 6 ++++++ charts/opensearch/values.yaml | 2 ++ 4 files changed, 13 insertions(+) diff --git a/charts/opensearch-dashboards/templates/deployment.yaml b/charts/opensearch-dashboards/templates/deployment.yaml index f1d4916a..0103754b 100644 --- a/charts/opensearch-dashboards/templates/deployment.yaml +++ b/charts/opensearch-dashboards/templates/deployment.yaml @@ -169,6 +169,9 @@ spec: - | #!/usr/bin/bash set -e + {{- range $plugin := .Values.plugins.removeList }} + ./bin/opensearch-dashboards-plugin remove {{ $plugin }} + {{- end }} {{- range $plugin := .Values.plugins.installList }} ./bin/opensearch-dashboards-plugin install {{ $plugin }} {{- end }} diff --git a/charts/opensearch-dashboards/values.yaml b/charts/opensearch-dashboards/values.yaml index 524031b4..096c9c01 100644 --- a/charts/opensearch-dashboards/values.yaml +++ b/charts/opensearch-dashboards/values.yaml @@ -274,3 +274,5 @@ plugins: enabled: false installList: [] # - example-fake-plugin-downloadable-url + removeList: [] + # - securityDashboards diff --git a/charts/opensearch/templates/statefulset.yaml b/charts/opensearch/templates/statefulset.yaml index 72e14976..dff761dc 100644 --- a/charts/opensearch/templates/statefulset.yaml +++ b/charts/opensearch/templates/statefulset.yaml @@ -360,6 +360,12 @@ spec: #!/usr/bin/env bash set -euo pipefail + {{- range $plugin := .Values.plugins.removeList }} + if ./bin/opensearch-plugin list | grep -q {{ $plugin }}; then + ./bin/opensearch-plugin remove {{ $plugin }} + fi + {{- end }} + {{- range $plugin := .Values.plugins.installList }} ./bin/opensearch-plugin install -b {{ $plugin }} {{- end }} diff --git a/charts/opensearch/values.yaml b/charts/opensearch/values.yaml index 33737661..c6fd760d 100644 --- a/charts/opensearch/values.yaml +++ b/charts/opensearch/values.yaml @@ -489,6 +489,8 @@ plugins: enabled: false installList: [] # - example-fake-plugin + removeList: [] + # - opensearch-ml # -- Array of extra K8s manifests to deploy extraObjects: []