-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 2.14 KB
/
Copy pathMakefile
File metadata and controls
65 lines (49 loc) · 2.14 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
API_IMAGE=task-forge-api
API_TAG=latest
MONGO_IMAGE=mongo
MONGO_TAG=6.0
NAMESPACE=default
MONGO_PV=k8s/mongo/pv.yaml
MONGO_PVC=k8s/mongo/pvc.yaml
MONGO_DEPLOYMENT=k8s/mongo/deployment.yaml
MONGO_SERVICE=k8s/mongo/service.yaml
API_CONFIGMAP=k8s/api/configmap.yaml
API_DEPLOYMENT=k8s/api/deployment.yaml
API_SERVICE=k8s/api/service.yaml
build:
eval $$(minikube docker-env) && docker build --no-cache -t $(API_IMAGE):$(API_TAG) .
deploy: build
kubectl apply -f $(MONGO_PV) -n $(NAMESPACE)
kubectl apply -f $(MONGO_PVC) -n $(NAMESPACE)
kubectl apply -f $(MONGO_DEPLOYMENT) -n $(NAMESPACE)
kubectl apply -f $(MONGO_SERVICE) -n $(NAMESPACE)
@echo "waiting for deployment $(MONGO_IMAGE)-deployment to become available..."
@kubectl wait --for=condition=available --timeout=60s deployment/$(MONGO_IMAGE)-deployment -n $(NAMESPACE)
@echo "deployment $(MONGO_IMAGE)-deployment available."
kubectl apply -f $(API_CONFIGMAP) -n $(NAMESPACE)
kubectl apply -f $(API_DEPLOYMENT) -n $(NAMESPACE)
kubectl apply -f $(API_SERVICE) -n $(NAMESPACE)
restart:
kubectl rollout restart deployment $(API_IMAGE)-deployment -n $(NAMESPACE)
status:
kubectl get deployments -n $(NAMESPACE)
kubectl get pods -n $(NAMESPACE)
kubectl get services -n $(NAMESPACE)
port-forward:
@echo "waiting for deployment $(API_IMAGE)-deployment to become available..."
@kubectl wait --for=condition=available --timeout=60s deployment/$(API_IMAGE)-deployment -n $(NAMESPACE)
@echo "deployment $(API_IMAGE)-deployment available."
kubectl port-forward service/$(API_IMAGE)-service 8080:80 -n $(NAMESPACE)
stop-port-forward:
@pkill -f "kubectl port-forward" || true
stop-port-forward-q:
@pkill -q -f "kubectl port-forward" || true
clean:
kubectl delete -f $(API_SERVICE) -n $(NAMESPACE) || true
kubectl delete -f $(API_DEPLOYMENT) -n $(NAMESPACE) || true
kubectl delete -f $(API_CONFIGMAP) -n $(NAMESPACE) || true
kubectl delete -f $(MONGO_SERVICE) -n $(NAMESPACE) || true
kubectl delete -f $(MONGO_DEPLOYMENT) -n $(NAMESPACE) || true
kubectl delete -f $(MONGO_PVC) -n $(NAMESPACE) || true
kubectl delete -f $(MONGO_PV) -n $(NAMESPACE) || true
all: stop-port-forward-q deploy status port-forward