first take on kubectl apply with multi file manifests
This commit is contained in:
parent
974a33ad5a
commit
96fa48f775
20
k8s.mk
20
k8s.mk
|
@ -4,13 +4,31 @@
|
||||||
|
|
||||||
MANDATORY-k8s = K8S_CONTEXT
|
MANDATORY-k8s = K8S_CONTEXT
|
||||||
|
|
||||||
|
k8s_fetch_manifest = \
|
||||||
|
if [ $(1) == "http*" ]; then \
|
||||||
|
curl -o $(2) $(1) \
|
||||||
|
else \
|
||||||
|
cp $(1) $(2) \
|
||||||
|
fi
|
||||||
|
|
||||||
start-k8s:
|
start-k8s:
|
||||||
@- echo "\n### starting deployment with k8s"
|
@- echo "\n### starting deployment with k8s"
|
||||||
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
|
||||||
@ kubectl config use-context $(K8S_CONTEXT)
|
@ kubectl config use-context $(K8S_CONTEXT)
|
||||||
|
|
||||||
@- echo "\n### run kubectl apply -f kubernetes.yaml and secrets.yaml"
|
@- echo "\n### run kubectl apply -f kubernetes.yaml and secrets.yaml"
|
||||||
@ cat kubernetes.yaml secrets.yaml | envsubst | kubectl apply -f -
|
@- 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
|
||||||
|
|
||||||
pull-k8s:
|
pull-k8s:
|
||||||
# nop
|
# nop
|
||||||
|
|
Loading…
Reference in New Issue