forked from GoogleCloudPlatform/marketplace-k8s-app-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcloud.Makefile
28 lines (21 loc) · 796 Bytes
/
gcloud.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ifndef __GCLOUD_MAKEFILE__
__GCLOUD_MAKEFILE__ := included
# Include this Makefile to automatically derive registry
# and target namespace from the current gcloud and kubectl
# configurations.
# This is for convenience over having to specifying the
# environment variables manually.
ifndef REGISTRY
# We replace ':' with '/' characters to support a now-deprecated
# projects format "google.com:my-project".
REGISTRY := gcr.io/$(shell gcloud config get-value project | tr ':' '/')
endif
ifndef NAMESPACE
NAMESPACE := $(shell kubectl config view -o jsonpath="{.contexts[?(@.name==\"$$(kubectl config current-context)\")].context.namespace}")
ifeq ($(NAMESPACE),)
NAMESPACE = default
endif
endif
$(info ---- REGISTRY = $(REGISTRY))
$(info ---- NAMESPACE = $(NAMESPACE))
endif