This repository has been archived by the owner on Apr 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
96 lines (71 loc) · 2.21 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
SHELL=/bin/bash -o pipefail
REPO?=docker.io/kubevirt/kubevirt-operator
TAG?="latest"
GOLANG_FILES:=$(shell find . -name \*.go -print)
pkgs = $(shell go list ./... | grep -v /vendor/ )
dep:
dep ensure -v
wget -O kubevirt.yaml https://github.com/kubevirt/kubevirt/releases/download/v0.6.4/kubevirt.yaml
all: format dep compile build deploy
clean:
# Remove all files and directories ignored by git.
git clean -Xfd .
############
# Compile #
############
compile: kubevirt-operator
kubevirt-operator: $(GOLANG_FILES)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
-o $@ cmd/kubevirt-operator/main.go
##############
# Build #
##############
build: compile
docker build -t $(REPO):$(TAG) -f Dockerfile .
push:
docker push $(REPO):$(TAG)
##############
# OLM #
##############
olm:
oc create -f kubevirt-operator-configmap.yaml -f kubevirt-catalog-source.yaml
git clone -f https://github.com/kirankt/ember-csi-operator.git /tmp/ember-csi-operator
oc create -f /tmp/ember-csi-operator/deploy/olm-catalog/catalog-source.yml
oc create -f /tmp/ember-csi-operator/deploy/olm-catalog/configmap.yml
rm-olm:
oc delete -f kubevirt-operator-configmap.yaml -f kubevirt-catalog-source.yaml
##############
# CR #
##############
cr:
# Temporary Hack: Need to fix rbac
oc adm policy add-cluster-role-to-user -z kubevirt-operator cluster-admin
oc create -f deploy/cr.yaml
##############
# Deploy #
##############
setprivileges:
# Give the kubevirt operator user 'default' cluster-admin privileges
oc adm policy add-cluster-role-to-user cluster-admin -z default
deploy: setprivileges
# Deploy the app-operator
kubectl create -f deploy/rbac.yaml
kubectl create -f deploy/crd.yaml
kubectl create -f deploy/operator.yaml
# Create the operator resource (kubectl get apps)
kubectl create -f deploy/cr.yaml
##############
# Undeploy #
##############
undeploy:
# Undeploy the app-operator
kubectl delete -f deploy/crd.yaml --ignore-not-found
kubectl delete -f deploy/operator.yaml --ignore-not-found
kubectl delete -f deploy/rbac.yaml --ignore-not-found
##############
# Formatting #
##############
format: go-fmt
go-fmt:
go fmt $(pkgs)
.PHONY: dep all clean compile build push deploy undeploy format olm rm-olm cr