This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
88 lines (72 loc) · 2.61 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
ORG=integreatly
NAMESPACE=rhsso
CONSUMER_NAMESPACES=${NAMESPACE}
PROJECT=keycloak-operator
REG=quay.io
SHELL=/bin/bash
TAG=v1.10.2
PKG=github.com/integr8ly/keycloak-operator
TEST_DIRS?=$(shell sh -c "find $(TOP_SRC_DIRS) -name \\*_test.go -exec dirname {} \\; | sort | uniq")
TEST_POD_NAME=keycloak-operator-test
COMPILE_TARGET=./tmp/_output/bin/$(PROJECT)
OPERATOR_SDK_BINARY=operator-sdk
.PHONY: setup/dep
setup/dep:
@echo Installing dep
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
@echo setup complete
.PHONY: setup/travis
setup/travis:
@echo Installing Operator SDK
@curl -Lo ${OPERATOR_SDK_BINARY} https://github.com/operator-framework/operator-sdk/releases/download/v0.0.7/operator-sdk-v0.0.7-x86_64-linux-gnu && chmod +x ${OPERATOR_SDK_BINARY} && sudo mv ${OPERATOR_SDK_BINARY} /usr/local/bin/
.PHONY: code/run
code/run:
export CONSUMER_NAMESPACES=${CONSUMER_NAMESPACES}
@${OPERATOR_SDK_BINARY} up local --namespace=${NAMESPACE} --operator-flags="--resync=10"
.PHONY: code/compile
code/compile:
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o=$(COMPILE_TARGET) ./cmd/keycloak-operator
.PHONY: code/gen
code/gen:
${OPERATOR_SDK_BINARY} generate k8s
@go generate ./...
.PHONY: code/check
code/check:
@diff -u <(echo -n) <(gofmt -d `find . -type f -name '*.go' -not -path "./vendor/*"`)
.PHONY: code/fix
code/fix:
@gofmt -w `find . -type f -name '*.go' -not -path "./vendor/*"`
.PHONY: image/build
image/build: code/compile
@${OPERATOR_SDK_BINARY} build ${REG}/${ORG}/${PROJECT}:${TAG}
.PHONY: image/push
image/push:
docker push ${REG}/${ORG}/${PROJECT}:${TAG}
.PHONY: image/build/push
image/build/push: image/build image/push
.PHONY: image/build/test
image/build/test:
${OPERATOR_SDK_BINARY} build --enable-tests ${REG}/${ORG}/${PROJECT}:${TAG}
.PHONY: test/unit
test/unit:
@echo Running tests:
go test -v -race -cover ./pkg/...
.PHONY: test/e2e
test/e2e:
kubectl apply -f deploy/test-e2e-pod.yaml -n ${PROJECT}
${SHELL} ./scripts/stream-pod ${TEST_POD_NAME} ${PROJECT}
.PHONY: cluster/prepare
cluster/prepare:
-kubectl apply -f deploy/crds/
-oc new-project $(NAMESPACE)
-kubectl create --insecure-skip-tls-verify -f deploy/rbac.yaml -n $(NAMESPACE)
.PHONY: cluster/clean
cluster/clean:
-kubectl delete role keycloak-operator -n $(NAMESPACE)
-kubectl delete rolebinding default-account-keycloak-operator -n $(NAMESPACE)
-kubectl delete crd keycloaks.aerogear.org
-kubectl delete namespace $(NAMESPACE)
.PHONY: cluster/create/examples
cluster/create/examples:
-kubectl create -f deploy/examples/keycloak.json -n $(NAMESPACE)
-kubectl create -f deploy/examples/keycloakRealm.json -n $(NAMESPACE)