forked from andaok/salt-kube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (83 loc) · 3.55 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
SHELL := /bin/bash
GIT_SHA = $(shell git log --pretty=oneline | head -n1 | cut -c1-8)
PACKAGE = "salt_config-$(GIT_SHA).tgz"
SHASUM = $(shell test `uname` == 'Darwin' && echo shasum -a 256 || echo sha256sum)
env := "local"
KUBE_VERSION := "1.14.1"
DOCKER_VERSION := "18.06.3"
FLANNEL_VERSION := "0.11.0"
ETCD_VERSION := "3.3.12"
VAULT_VERSION := "1.1.1"
all: formulas
@mkdir -p dist
@rsync -a ./salt/$(env) ./dist/salt/ --delete
@rsync -a ./_grains/ ./dist/salt/$(env)/_grains/ --delete
@rsync -a ./_macros/ ./dist/salt/$(env)/_macros/ --delete
@rsync -a ./_states/ ./dist/salt/$(env)/_states/ --delete
@rsync -a ./_modules/ ./dist/salt/$(env)/_modules/ --delete
@rsync -a ./_runners/ ./dist/_runners/ --delete
@rsync -a ./reactor/ ./dist/reactor/ --delete
@rsync -a ./formulas/ ./dist/formulas/ --delete
@rsync -a ./pillar/$(env) ./dist/pillar/ --delete
@echo "copy local install file to ./dist. Enjoy!"
@rsync -a tests/binaries/kube-apiserver dist/formulas/kube-apiserver/files
@rsync -a tests/binaries/kube-controller-manager dist/formulas/kube-controller-manager/files
@rsync -a tests/binaries/kube-scheduler dist/formulas/kube-scheduler/files
@rsync -a tests/binaries/kubectl dist/formulas/kubectl/files
@rsync -a tests/binaries/kube-proxy dist/formulas/kube-proxy/files
@rsync -a tests/binaries/kubelet dist/formulas/kubelet/files
@rsync -a tests/binaries/etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz dist/formulas/etcd/files
@rsync -a tests/binaries/docker-$(DOCKER_VERSION)-ce.tgz dist/formulas/docker/files
@rsync -a tests/binaries/flannel-v$(FLANNEL_VERSION)-linux-amd64.tar.gz dist/formulas/kube-cni/flannel/files
@rsync -a tests/binaries/vault_$(VAULT_VERSION)_linux_amd64.zip dist/formulas/vault/files
@echo $(GIT_SHA) > ./dist/SHA
@find ./dist -type f | sort | xargs $(SHASUM) | sed "s;./dist;/srv;" > MANIFEST
@$(SHASUM) MANIFEST | cut -d\ -f1 > MANIFEST.sha256
@mv MANIFEST* ./dist/
@echo "Salt $(env) env is ready in ./dist. Enjoy!"
localinstall:
@cp -f tests/binaries/kube-apiserver dist/formulas/kube-apiserver/files
@cp -f tests/binaries/kube-controller-manager dist/formulas/kube-controller-manager/files
@cp -f tests/binaries/kube-scheduler dist/formulas/kube-scheduler/files
@cp -f tests/binaries/kubectl dist/formulas/kubectl/files
@cp -f tests/binaries/kube-proxy dist/formulas/kube-proxy/files
@cp -f tests/binaries/kubelet dist/formulas/kubelet/files
@cp -f tests/binaries/etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz dist/formulas/etcd/files
@cp -f tests/binaries/vault_$(VAULT_VERSION)_linux_amd64.zip dist/formulas/vault/files
@cp -f tests/binaries/flannel-v$(FLANNEL_VERSION)-linux-amd64.tar.gz dist/formulas/kube-cni/flannel/files
lint:
@tests/lint.sh
test: clean all lint
@true
package: clean all
@tar czf $(PACKAGE) ./dist/
@mv -f $(PACKAGE) ./dist
@echo "Package ./dist/$(PACKAGE) is ready."
clean:
@echo -n "Removing vagrant VMs..."
@vagrant destroy -f
@echo "DONE"
@echo -n "Removing ./dist directory..."
@rm -rf dist
@echo "DONE"
coverage:
@tests/coverage.sh
download:
@echo -n 'Download the binaries package to ./tests/binaries directory...'
@tests/download.sh
init: all
vagrant up
sleep 10
vagrant ssh salt -c "sudo salt salt state.sls salt.master"
sleep 20
vagrant ssh salt -c "sudo salt \* state.sls salt.minion"
sleep 20
vagrant ssh salt -c "sudo salt salt state.sls caserver.initca"
sleep 15
vagrant ssh salt -c "sudo salt \* saltutil.sync_all"
sleep 15
vagrant ssh salt -c "sudo salt salt state.sls caserver"
sleep 15
vagrant ssh salt -c "sudo salt \* mine.update"
sleep 10
vagrant ssh salt -c "sudo salt \* state.apply -l debug"