2024-07-18 08:25:52 +00:00
|
|
|
MANDATORY = $(shell printenv MANDATORY) K8S_CONTEXT HELM_CHART_NAME HELM_CHART_PATH HELM_VALUES_FILE K8S_NAMESPACE
|
2022-11-03 08:48:22 +00:00
|
|
|
# helm
|
|
|
|
#
|
2022-12-23 13:48:22 +00:00
|
|
|
# deploys helm charts on k8s via helm
|
2022-12-08 09:34:34 +00:00
|
|
|
#
|
2022-11-03 08:48:22 +00:00
|
|
|
start-helm:
|
2022-12-23 13:48:22 +00:00
|
|
|
@- echo "\n### starting deployment with helm"
|
2022-11-03 08:48:22 +00:00
|
|
|
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
2022-12-07 13:55:36 +00:00
|
|
|
@ kubectl config use-context $(K8S_CONTEXT)
|
2022-12-23 13:48:22 +00:00
|
|
|
|
2023-03-07 15:55:15 +00:00
|
|
|
ifdef TEST_MODE
|
|
|
|
@- echo "Testing chart with 'helm template --debug'"
|
2023-09-21 10:28:56 +00:00
|
|
|
@ envsubst < ${HELM_VALUES_FILE} | helm template ${HELM_CHART_NAME} ${HELM_CHART_PATH} --debug --values -
|
2023-03-07 15:55:15 +00:00
|
|
|
endif
|
|
|
|
|
2023-06-14 08:59:43 +00:00
|
|
|
ifdef NAMESPACE
|
2023-09-21 10:45:18 +00:00
|
|
|
@ $(eval K8S_NAMESPACE = $(NAMESPACE))
|
2023-06-14 08:59:43 +00:00
|
|
|
endif
|
2023-09-15 06:44:44 +00:00
|
|
|
|
2024-02-15 08:57:49 +00:00
|
|
|
ifdef HELM_REPO_URL
|
|
|
|
@- echo "Helm Repo: $(HELM_REPO_URL)"
|
|
|
|
@ helm repo add $(HELM_CHART_NAME) $(HELM_REPO_URL)
|
|
|
|
@- helm repo update $(HELM_CHART_NAME)
|
|
|
|
endif
|
|
|
|
|
2023-09-15 06:44:44 +00:00
|
|
|
ifdef DEBUG_MODE
|
|
|
|
@- echo "\n### deploying helm chart with --debug flag"
|
|
|
|
@- echo "-- DEBUG DEPLOYMENT --------------------"
|
|
|
|
@- echo " "
|
|
|
|
@- echo "Namespace: $(K8S_NAMESPACE)"
|
|
|
|
@- echo "Helm Chart: $(HELM_CHART_PATH)"
|
2024-02-15 08:57:49 +00:00
|
|
|
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
|
2023-09-15 06:44:44 +00:00
|
|
|
@- echo "Values File: $(HELM_VALUES_FILE)"
|
|
|
|
@- echo " "
|
|
|
|
@- echo "----------------------------------"
|
|
|
|
|
2024-02-15 08:57:49 +00:00
|
|
|
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --debug --wait --values - --version "$(HELM_CHART_VERSION)"
|
2023-09-15 06:44:44 +00:00
|
|
|
|
|
|
|
else
|
2023-06-14 08:59:43 +00:00
|
|
|
|
2022-11-03 08:48:22 +00:00
|
|
|
@- echo "\n### deploying helm chart"
|
2022-12-23 13:48:22 +00:00
|
|
|
@- echo "-- DEPLOYMENT --------------------"
|
|
|
|
@- echo " "
|
2023-06-26 14:45:10 +00:00
|
|
|
@- echo "Namespace: $(K8S_NAMESPACE)"
|
2022-12-23 13:48:22 +00:00
|
|
|
@- echo "Helm Chart: $(HELM_CHART_PATH)"
|
2024-02-15 08:57:49 +00:00
|
|
|
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
|
2022-12-23 13:48:22 +00:00
|
|
|
@- echo "Values File: $(HELM_VALUES_FILE)"
|
|
|
|
@- echo " "
|
|
|
|
@- echo "----------------------------------"
|
|
|
|
|
2024-02-15 08:57:49 +00:00
|
|
|
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --wait --values - --version "$(HELM_CHART_VERSION)"
|
2022-12-23 13:48:22 +00:00
|
|
|
|
2023-09-15 06:44:44 +00:00
|
|
|
endif
|
2023-03-07 15:55:15 +00:00
|
|
|
|
|
|
|
|
2022-11-03 08:48:22 +00:00
|
|
|
pull-helm:
|
2023-09-21 10:18:08 +00:00
|
|
|
# nop
|