Merge branch 'SYS-5450' into 'master'
SYS-5450: add initial kustomize and helm targets See merge request pub/make-deploy!1
This commit is contained in:
commit
4f82a3aeb5
29
Makefile
29
Makefile
|
@ -1,12 +1,13 @@
|
|||
.PHONY: self-update create-contexts deploy upload pull start stop restart
|
||||
|
||||
-include secrets.mk
|
||||
include config.mk
|
||||
include make-deploy/copy.mk
|
||||
include make-deploy/docker.mk
|
||||
include make-deploy/k8s.mk
|
||||
include make-deploy/cron.mk
|
||||
include make-deploy/kustomize.mk
|
||||
include make-deploy/helm.mk
|
||||
|
||||
include config.mk
|
||||
include secrets.mk
|
||||
.PHONY: self-update create-contexts deploy upload pull start stop restart
|
||||
|
||||
self-update:
|
||||
@- git submodule update --remote
|
||||
|
@ -14,31 +15,45 @@ self-update:
|
|||
deploy: upload pre-deploy pre-local pull start post-local post-deploy
|
||||
|
||||
pre-deploy:
|
||||
ifdef DEPLOY_HOSTS
|
||||
@- echo "\n### running pre-deploy script(s)"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh pre-deploy.sh; sh pre-deploy_$(host).sh"; \
|
||||
)
|
||||
|
||||
endif
|
||||
|
||||
post-deploy:
|
||||
ifdef DEPLOY_HOSTS
|
||||
@- echo "\n### running post-deploy script(s)"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh post-deploy.sh; sh post-deploy_$(host).sh"; \
|
||||
)
|
||||
endif
|
||||
|
||||
pre-local:
|
||||
ifneq (,$(wildcard pre-local.sh))
|
||||
@- echo "\n### running pre-local script"
|
||||
@- sh ./pre-local.sh
|
||||
|
||||
else
|
||||
@- echo "\n### no pre-local script found"
|
||||
endif
|
||||
|
||||
post-local:
|
||||
ifneq (,$(wildcard post-local.sh))
|
||||
@- echo "\n### running post-local script"
|
||||
@- sh ./post-local.sh
|
||||
|
||||
else
|
||||
@- echo "\n### no post-local script found"
|
||||
endif
|
||||
|
||||
upload:
|
||||
ifdef DEPLOY_HOSTS
|
||||
@- echo "\n### uploading files"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
ssh $(SSH_USER)@$(host) "mkdir -p $(DEPLOY_PATH)/$(DEPLOY_NAME)"; \
|
||||
rsync -rav --exclude '*~' --exclude '.git*' . $(SSH_USER)@$(host):$(DEPLOY_PATH)/$(DEPLOY_NAME); \
|
||||
)
|
||||
endif
|
||||
|
||||
pull: pull-$(DEPLOY_TYPE)
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# helm
|
||||
#
|
||||
# deploys helm charts on k8s via helmfile
|
||||
|
||||
start-helm:
|
||||
@- echo "\n### starting deployment with helmfile"
|
||||
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
||||
@- kubectl config use-context $(K8S_CONTEXT)
|
||||
|
||||
@- echo "\n### generating imagePullSecrets"
|
||||
@- imagePullSecrets.sh
|
||||
|
||||
@- echo "\n### deploying helm chart"
|
||||
@- helmfile --file helmfile.yaml apply --suppress-secrets
|
||||
|
||||
pull-helm:
|
||||
# nop
|
|
@ -0,0 +1,60 @@
|
|||
# kustomize
|
||||
#
|
||||
# this uses kustomize to install stuff on k8s
|
||||
|
||||
start-kustomize:
|
||||
@- echo "\n### starting deployment with kustomize"
|
||||
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
||||
@- kubectl config use-context $(K8S_CONTEXT)
|
||||
|
||||
@- echo "\n### generating imagePullSecrets"
|
||||
@- imagePullSecretsOut.sh > kustomize/base/imagepullsecrets.yaml
|
||||
|
||||
@- echo "\n### editing kustomizations"
|
||||
|
||||
ifdef KUSTOMIZE_EDIT_NAMESPACE
|
||||
@- echo "\n### setting namespace to $(K8S_NAMESPACE)"
|
||||
@- cd $(KUSTOMIZE_FOLDER) && kustomize edit set namespace $(K8S_NAMESPACE)
|
||||
endif
|
||||
|
||||
# actual deployment is happening here
|
||||
@- echo "\n### applying kustomizations"
|
||||
@- cd $(KUSTOMIZE_FOLDER) && kubectl apply -k .
|
||||
|
||||
pull-kustomize:
|
||||
# nop
|
||||
|
||||
#TODO: implement annotation
|
||||
# ifeq ($KUSTOMIZE_EDIT),annotation)
|
||||
# @- $(kustomize edit set annotation .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement buildmetadata
|
||||
# ifeq ($KUSTOMIZE_EDIT),buildmetadata)
|
||||
# @- $(kustomize edit set buildmetadata .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement image
|
||||
# ifeq ($KUSTOMIZE_EDIT),image)
|
||||
# @- $(kustomize edit set image .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement label
|
||||
# ifeq ($KUSTOMIZE_EDIT),label)
|
||||
# @- $(kustomize edit set label .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement nameprefix
|
||||
# ifeq ($KUSTOMIZE_EDIT),nameprefix)
|
||||
# @- $(kustomize edit set nameprefix .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement namesuffix
|
||||
# ifeq ($KUSTOMIZE_EDIT),namesuffix)
|
||||
# @- $(kustomize edit set namesuffix .....)
|
||||
# endif
|
||||
|
||||
#TODO: implement replicas
|
||||
# ifeq ($KUSTOMIZE_EDIT),replicas)
|
||||
# @- $(kustomize edit set replicas .....)
|
||||
# endif
|
Loading…
Reference in New Issue