2022-11-18 14:25:23 +00:00
|
|
|
# k8s
|
|
|
|
#
|
|
|
|
# deploys k8s
|
|
|
|
|
2022-12-20 14:26:27 +00:00
|
|
|
MANDATORY-k8s = K8S_CONTEXT
|
|
|
|
|
2023-09-20 08:57:44 +00:00
|
|
|
k8s_fetch_manifest = \
|
|
|
|
if [ $(1) == "http*" ]; then \
|
|
|
|
curl -o $(2) $(1) \
|
|
|
|
else \
|
|
|
|
cp $(1) $(2) \
|
|
|
|
fi
|
|
|
|
|
2022-11-18 14:25:23 +00:00
|
|
|
start-k8s:
|
|
|
|
@- echo "\n### starting deployment with k8s"
|
|
|
|
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
2022-12-21 10:27:58 +00:00
|
|
|
@ kubectl config use-context $(K8S_CONTEXT)
|
2022-11-18 14:25:23 +00:00
|
|
|
|
|
|
|
@- echo "\n### run kubectl apply -f kubernetes.yaml and secrets.yaml"
|
2023-09-20 08:57:44 +00:00
|
|
|
@- cat kubernetes.yaml secrets.yaml >_manifest.yaml
|
|
|
|
|
|
|
|
ifdef K8S_MANIFESTS
|
|
|
|
@- $(foreach file,$(K8S_MANIFESTS), \
|
|
|
|
$(call k8s_fetch_manifest($(file),"_tmpfile.yaml")); \
|
|
|
|
cat _tmpfile.yaml >>_manifest.yaml; \
|
|
|
|
rm _tmpfile.yaml; \
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
@ cat _manifest.yaml | envsubst | kubectl apply -f -
|
|
|
|
@- rm _manifest.yaml
|
2022-11-18 14:25:23 +00:00
|
|
|
|
|
|
|
pull-k8s:
|
|
|
|
# nop
|
|
|
|
|