From 42cdd4fdb684c1d1920530d1d28992a2db51a4e9 Mon Sep 17 00:00:00 2001 From: Jeromy Cannon Date: Wed, 25 Oct 2023 19:20:36 +0100 Subject: [PATCH 1/2] add minio operator to fullstack-cluster-setup and update makefile to leverage Signed-off-by: Jeromy Cannon --- charts/fullstack-cluster-setup/Chart.lock | 6 ++++ charts/fullstack-cluster-setup/Chart.yaml | 7 ++++ charts/fullstack-cluster-setup/values.yaml | 7 +++- dev/Makefile | 39 ++++++++++------------ dev/scripts/env.sh | 1 + dev/scripts/main.sh | 2 +- dev/temp/.gitignore | 3 +- 7 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 charts/fullstack-cluster-setup/Chart.lock diff --git a/charts/fullstack-cluster-setup/Chart.lock b/charts/fullstack-cluster-setup/Chart.lock new file mode 100644 index 000000000..83c2c6fe4 --- /dev/null +++ b/charts/fullstack-cluster-setup/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: operator + repository: https://operator.min.io/ + version: 5.0.7 +digest: sha256:2f7b3843ce9b2417b2db1a7af249a6c4d097cb13e65d557c0c80a55688e1a172 +generated: "2023-10-25T15:14:25.580221+01:00" diff --git a/charts/fullstack-cluster-setup/Chart.yaml b/charts/fullstack-cluster-setup/Chart.yaml index 7a8f796e9..9157fe2a3 100644 --- a/charts/fullstack-cluster-setup/Chart.yaml +++ b/charts/fullstack-cluster-setup/Chart.yaml @@ -22,3 +22,10 @@ version: 0.8.0 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "0.8.0" + +dependencies: + - name: operator + alias: minio-operator + version: 5.0.7 + repository: https://operator.min.io/ + condition: cloud.minio.enable diff --git a/charts/fullstack-cluster-setup/values.yaml b/charts/fullstack-cluster-setup/values.yaml index d22bdbb64..c79de1d8b 100644 --- a/charts/fullstack-cluster-setup/values.yaml +++ b/charts/fullstack-cluster-setup/values.yaml @@ -5,4 +5,9 @@ global: namespaceOverride: "" nameOverride: "" - fullnameOverride: "" \ No newline at end of file + fullnameOverride: "" + +# cloud configuration +cloud: + minio: + enable: false diff --git a/dev/Makefile b/dev/Makefile index c4a68c248..02357d3c9 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -28,6 +28,7 @@ CHART_DIR=$(PWD)/../charts/fullstack-deployment SCRIPT_NAME=direct-install.sh TMP_DIR=${SCRIPTS_DIR}/../temp +CLUSTER_SETUP_VALUES_FILE=${TMP_DIR}/cluster-values.yaml CHART_VALUES_FILES= # extra values # scripts @@ -59,14 +60,17 @@ uninstall-chart: update-helm-dependencies: helm dependency update ../charts/fullstack-deployment +.PHONY: init-shared +init-shared: + echo "# values override file for fullstack-cluster-setup" > ${CLUSTER_SETUP_VALUES_FILE} + .PHONY: deploy-shared -deploy-shared: update-helm-dependencies deploy-gateway-api deploy-prometheus-operator deploy-minio-operator-if-required +deploy-shared: init-shared update-helm-dependencies deploy-gateway-api deploy-prometheus-operator enable-minio-operator-if-required source "${SCRIPTS_DIR}/main.sh" && deploy_shared # run only after gateway-api CRDs are available .PHONY: destroy-shared destroy-shared: - -$(MAKE) source "${SCRIPTS_DIR}/main.sh" && destroy_shared - -$(MAKE) undeploy-minio-operator + source "${SCRIPTS_DIR}/main.sh" && destroy_shared -$(MAKE) destroy-prometheus-operator .PHONY: deploy-chart @@ -77,6 +81,7 @@ deploy-chart: .PHONY: destroy-chart destroy-chart: -$(MAKE) uninstall-chart + -$(MAKE) destroy-shared .PHONY: deploy-network deploy-network: deploy-chart @@ -193,30 +198,22 @@ destroy-telemetry-stack: -${MAKE} destroy-grafana-tempo ######################################### MinIO ################################# -.PHONY: deploy-minio-operator -deploy-minio-operator: - @echo ">> Deploying minio operator..."; \ - helm install --repo https://operator.min.io/ --namespace=minio-operator --create-namespace --version 5.0.7 minio-operator operator && \ - echo ">> Waiting for minio operator to be available (timeout 300s)..." && \ - kubectl --namespace=minio-operator wait --for=condition=Available --timeout=300s deployment.apps/minio-operator && \ - sleep 5 +.PHONY: enable-minio-operator +enable-minio-operator: + @echo ">> Enabling minio operator..."; \ + echo "cloud:" >> ${CLUSTER_SETUP_VALUES_FILE}; \ + echo " minio:" >> ${CLUSTER_SETUP_VALUES_FILE}; \ + echo " enable: true" >> ${CLUSTER_SETUP_VALUES_FILE}; .PHONY: is-minio-operator-installed is-minio-operator-installed: @echo ">> Checking for minio operator..."; \ - helm list --namespace=minio-operator | grep minio-operator &> /dev/null && { echo "Found minio operator."; exit 0; }; \ + kubectl get pods --all-namespaces | grep minio-operator &> /dev/null && { echo "Found minio operator."; exit 0; }; \ echo "Minio operator not found."; exit 1 -.PHONY: deploy-minio-operator-if-required -deploy-minio-operator-if-required: - @$(MAKE) is-minio-operator-installed || $(MAKE) deploy-minio-operator - - -.PHONY: undeploy-minio-operator -undeploy-minio-operator: - echo ">> Deleting minio operator..." && \ - helm delete --namespace=minio-operator minio-operator - +.PHONY: enable-minio-operator-if-required +enable-minio-operator-if-required: + @$(MAKE) is-minio-operator-installed || $(MAKE) enable-minio-operator ######################################### Helm Chart Test ################################# .PHONY: helm-test diff --git a/dev/scripts/env.sh b/dev/scripts/env.sh index 5f4447a8f..c0a883295 100644 --- a/dev/scripts/env.sh +++ b/dev/scripts/env.sh @@ -78,6 +78,7 @@ function setup() { SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" readonly SCRIPT_DIR readonly TMP_DIR="${SCRIPT_DIR}/../temp" +readonly CLUSTER_SETUP_VALUES_FILE="${TMP_DIR}/cluster-values.yaml" load_env_file USER="${USER:-changeme}" diff --git a/dev/scripts/main.sh b/dev/scripts/main.sh index 14bf367a3..35424dda9 100644 --- a/dev/scripts/main.sh +++ b/dev/scripts/main.sh @@ -46,7 +46,7 @@ function deploy_fullstack_cluster_setup_chart() { echo "-----------------------------------------------------------------------------------------------------" local count=$(helm list --all-namespaces -q | grep -c "fullstack-cluster-setup") if [[ $count -eq 0 ]]; then - helm install -n "${NAMESPACE}" "fullstack-cluster-setup" "${SETUP_CHART_DIR}" + helm install -n "${NAMESPACE}" "fullstack-cluster-setup" "${SETUP_CHART_DIR}" --values "${CLUSTER_SETUP_VALUES_FILE}" else echo "fullstack-cluster-setup chart is already installed" echo "" diff --git a/dev/temp/.gitignore b/dev/temp/.gitignore index 698fd8b08..bf7dc154c 100644 --- a/dev/temp/.gitignore +++ b/dev/temp/.gitignore @@ -1,2 +1,3 @@ *.txt -*.xml \ No newline at end of file +*.xml +*.yaml \ No newline at end of file From 6f419d7ba3c3df5f3289947782ab997efc2bfd2e Mon Sep 17 00:00:00 2001 From: Jeromy Cannon Date: Wed, 25 Oct 2023 19:45:45 +0100 Subject: [PATCH 2/2] helm dependency update ../charts/fullstack-cluster-setup Signed-off-by: Jeromy Cannon --- dev/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/Makefile b/dev/Makefile index 02357d3c9..c72716906 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -59,6 +59,7 @@ uninstall-chart: .PHONY: update-helm-dependencies update-helm-dependencies: helm dependency update ../charts/fullstack-deployment + helm dependency update ../charts/fullstack-cluster-setup .PHONY: init-shared init-shared: