58 lines
1.8 KiB
Makefile
58 lines
1.8 KiB
Makefile
MANDATORY = $(shell printenv MANDATORY) K8S_CONTEXT HELM_CHART_NAME HELM_CHART_PATH HELM_VALUES_FILE K8S_NAMESPACE
|
|
# helm
|
|
#
|
|
# deploys helm charts on k8s via helm
|
|
#
|
|
start-helm:
|
|
@- echo "\n### starting deployment with helm"
|
|
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
|
@ kubectl config use-context $(K8S_CONTEXT)
|
|
|
|
ifdef TEST_MODE
|
|
@- echo "Testing chart with 'helm template --debug'"
|
|
@ envsubst < ${HELM_VALUES_FILE} | helm template ${HELM_CHART_NAME} ${HELM_CHART_PATH} --debug --values -
|
|
endif
|
|
|
|
ifdef NAMESPACE
|
|
@ $(eval K8S_NAMESPACE = $(NAMESPACE))
|
|
endif
|
|
|
|
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
|
|
|
|
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)"
|
|
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
|
|
@- echo "Values File: $(HELM_VALUES_FILE)"
|
|
@- echo " "
|
|
@- echo "----------------------------------"
|
|
|
|
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --debug --wait --values - --version "$(HELM_CHART_VERSION)"
|
|
|
|
else
|
|
|
|
@- echo "\n### deploying helm chart"
|
|
@- echo "-- DEPLOYMENT --------------------"
|
|
@- echo " "
|
|
@- echo "Namespace: $(K8S_NAMESPACE)"
|
|
@- echo "Helm Chart: $(HELM_CHART_PATH)"
|
|
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
|
|
@- echo "Values File: $(HELM_VALUES_FILE)"
|
|
@- echo " "
|
|
@- echo "----------------------------------"
|
|
|
|
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --wait --values - --version "$(HELM_CHART_VERSION)"
|
|
|
|
endif
|
|
|
|
|
|
pull-helm:
|
|
# nop
|