forked from kadalu/kadalu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
105 lines (94 loc) · 4.01 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
.PHONY: help build-grpc build-containers gen-manifest pylint prepare-release release
DOCKER_USER?=kadalu
KADALU_VERSION?=latest
help:
@echo " make build-grpc - To generate grpc Python Code"
@echo " make build-containers - To create server, csi and Operator containers"
@echo " make gen-manifest - To generate manifest files to deploy"
@echo " make pylint - To validate all Python code with Pylint"
@echo " make prepare-release - Generate Manifest file and build containers for specific version and latest"
@echo " make release - Publish the built container images"
build-grpc:
python3 -m grpc_tools.protoc -I./csi/protos --python_out=csi --grpc_python_out=csi ./csi/protos/csi.proto
build-containers:
DOCKER_USER=${DOCKER_USER} KADALU_VERSION=${KADALU_VERSION} bash build.sh
gen-manifest:
@echo "Generating manifest files, run the following commands"
@echo
@mkdir -p manifests
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=${KADALU_VERSION} \
python3 extras/scripts/gen_manifest.py manifests/kadalu-operator.yaml
@echo "kubectl create -f manifests/kadalu-operator.yaml"
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=${KADALU_VERSION} \
OPENSHIFT=1 \
python3 extras/scripts/gen_manifest.py manifests/kadalu-operator-openshift.yaml
@echo
@echo "In the case of OpenShift, deploy Kadalu Operator by running "
@echo "the following command"
@echo
@echo "Note: Security Context Constraints can be applied only by admins, "
@echo 'Run `oc login -u system:admin` to login as admin'
@echo
@echo "oc create -f manifests/kadalu-operator-openshift.yaml"
pylint:
@cp lib/kadalulib.py csi/
@cp lib/kadalulib.py server/
@cp lib/kadalulib.py operator/
@cp server/kadalu_quotad/quotad.py server/
@pylint --disable=W0511 -s n lib/kadalulib.py
@pylint --disable=W0511 -s n server/glusterfsd.py
@pylint --disable=W0511 -s n server/quotad.py
@pylint --disable=W0511 -s n server/server.py
@pylint --disable=W0511 -s n server/shd.py
@pylint --disable=W0511 -s n csi/controllerserver.py
@pylint --disable=W0511 -s n csi/identityserver.py
@pylint --disable=W0511 -s n csi/main.py
@pylint --disable=W0511 -s n csi/nodeserver.py
@pylint --disable=W0511 -s n csi/volumeutils.py
@pylint --disable=W0511 -s n operator/main.py
@pylint --disable=W0511 -s n extras/scripts/gen_manifest.py
@rm csi/kadalulib.py
@rm server/kadalulib.py
@rm operator/kadalulib.py
@rm server/quotad.py
ifeq ($(KADALU_VERSION), latest)
prepare-release:
@echo "KADALU_VERSION can't be latest for release"
else
prepare-release:
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=${KADALU_VERSION} \
$(MAKE) gen-manifest
@cp manifests/kadalu-operator.yaml \
manifests/kadalu-operator-${KADALU_VERSION}.yaml
@cp manifests/kadalu-operator-openshift.yaml \
manifests/kadalu-operator-openshift-${KADALU_VERSION}.yaml
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=latest \
$(MAKE) gen-manifest
@echo "Generated manifest file. Version: ${KADALU_VERSION}"
@echo "Building containers(Version: ${KADALU_VERSION}).."
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=${KADALU_VERSION} \
$(MAKE) build-containers
@echo "Building containers(Version: latest).."
@DOCKER_USER=${DOCKER_USER} KADALU_VERSION=latest \
$(MAKE) build-containers
endif
pypi-build:
echo ${KADALU_VERSION} > cli/VERSION
cd cli; rm -rf dist; python3 setup.py sdist;
@cp lib/kadalulib.py server/kadalu_quotad/
echo ${KADALU_VERSION} > server/VERSION
cd server; rm -rf dist; python3 setup.py sdist;
pypi-upload: pypi-build
cd cli; twine upload --username kadalu dist/*
cd server; twine upload --username kadalu dist/*
ifeq ($(KADALU_VERSION), latest)
release: prepare-release
else
release: prepare-release pypi-upload
docker push ${DOCKER_USER}/kadalu-operator:${KADALU_VERSION}
docker push ${DOCKER_USER}/kadalu-csi:${KADALU_VERSION}
docker push ${DOCKER_USER}/kadalu-server:${KADALU_VERSION}
docker push ${DOCKER_USER}/kadalu-operator:latest
docker push ${DOCKER_USER}/kadalu-csi:latest
docker push ${DOCKER_USER}/kadalu-server:latest
endif