From 704bc9dbeafae70c35979cd07549cdc9bf301e8c 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 256cf054..21eaa8e2 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 d461a6e2..d02ac0e8 100644 --- a/charts/opensearch-dashboards/values.yaml +++ b/charts/opensearch-dashboards/values.yaml @@ -278,6 +278,8 @@ plugins: enabled: false installList: [] # - example-fake-plugin-downloadable-url + removeList: [] + # - securityDashboards # ServiceMonitor Configuration for Prometheus # Enabling this option will create a ServiceMonitor resource that allows Prometheus to scrape metrics from the OpenSearch service. diff --git a/charts/opensearch/templates/statefulset.yaml b/charts/opensearch/templates/statefulset.yaml index 3ce437fc..d87e4724 100644 --- a/charts/opensearch/templates/statefulset.yaml +++ b/charts/opensearch/templates/statefulset.yaml @@ -365,6 +365,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 e305c4e4..9703c9dc 100644 --- a/charts/opensearch/values.yaml +++ b/charts/opensearch/values.yaml @@ -491,6 +491,8 @@ plugins: enabled: false installList: [] # - example-fake-plugin + removeList: [] + # - opensearch-ml # -- Array of extra K8s manifests to deploy extraObjects: []