-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
131 lines (108 loc) · 3.44 KB
/
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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
BUILDPATH = ${CURDIR}
EXENAME = main
.PHONY:makedir
makedir:
@if [ ! -d ${BUILDPATH}/bin ] ; then mkdir -p ${BUILDPATH}/bin ; fi
@if [ ! -d ${BUILDPATH}/pkg ] ; then mkdir -p ${BUILDPATH}/pkg ; fi
.PHONY:build
build:
@echo "Start building..."
go build -o bin/main server.go
.PHONY:clean
clean:
@echo "Cleaning..."
@rm -rf ${BUILDPATH}/bin/${EXENAME}
@rm -rf ${BUILDPATH}/pkg
.PHONY:run
run:
go run cmd/server.go
.PHONY:compose
compose:
@echo build docker image
docker-compose down --remove-orphans
docker-compose up
.PHONY:prune
prune:
@echo clean all that is not actively used
docker system prune -af
all: makedir build
.PHONY:update
update:
@echo "Updating..."
go get -t -u ./...
.PHONY:skaffold-run
skaffold-run:
@echo "Skaffold run"
skaffold run
.PHONY:skaffold-delete
skaffold-delete:
@echo "Skaffold run"
skaffold delete
.PHONY:kustomize-up
kustomize-up:
@echo "Kustomize"
kubectl apply -k deployments\kubernetes\
.PHONY:kustomize-down
kustomize-down:
@echo "Kustomize"
kubectl delete -k deployments\kubernetes\
.PHONY:kube-up
kube-up:
@echo "Kubernetes up"
kubectl create -f config/kubernetes/postgres-secret.yaml
kubectl describe secrets postgres-secret
kubectl apply -f config/kubernetes/postgres-configmap.yaml
kubectl apply -f config/kubernetes/postgres-db-pv.yaml
kubectl apply -f config/kubernetes/postgres-db-pvc.yaml
kubectl apply -f config/kubernetes/postgres-db-deployment.yaml
kubectl apply -f config/kubernetes/postgres-db-service.yaml
kubectl apply -f config/kubernetes/app-postgres-deployment.yaml
kubectl apply -f config/kubernetes/app-postgres-service.yaml
kubectl get pods
kubectl get services
kubectl get services fullstack-app-postgres
#Display information about the Deployment:
kubectl get deployments fullstack-app-postgres
kubectl describe deployments fullstack-app-postgres
#Create a Service object that exposes the deployment:
kubectl expose deployment fullstack-app-postgres --type=LoadBalancer --name=goginapi
#Display information about the Service:
kubectl get services goginapi
.PHONY:kube-down
kube-down:
@echo "Kubernetes down"
kubectl delete services goginapi
kubectl delete deployment fullstack-app-postgres
kubectl delete configmap postgres-config
kubectl delete persistentvolumeclaim postgres-pv-claim
kubectl delete persistentvolume postgres-pv-volume
kubectl delete secret postgres-secret
kubectl delete deployment --all
kubectl delete pods --all
.PHONY:kube-clean
kube-clean:
kubectl delete deployments --all
kubectl delete services --all
kubectl delete pods --all
kubectl delete daemonset --all
.PHONY:kube-dash-token
kube-dash-token:
@echo "Kubernetes dashboard token generate"
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
#kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | sls admin-user | ForEach-Object { $_ -Split '\s+' } | Select -First 1)
#http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
.PHONY:kube-dashboard
kube-dashboard:
@echo "Kubernetes dashboard"
kubectl proxy
.PHONY:helm-install
helm-install:
@echo "helm chart deploy"
helm lint
helm install goginapi helmchart
kubectl expose deployment goginapi-helmchart --type=LoadBalancer --name=goginapi
.PHONY:helm-delete
helm-delete:
@echo "helm chart delete"
helm list
helm delete goginapi