-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.26 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=chatgpt-k8s-controller
BIN_DIR=bin
IMAGE_NAME=uucloud/chatgpt-k8s-contronller
.PHONY: all build clean test docker-build docker-push deploy
all: test build
gen:
@echo "Clean generated..."
rm -rf ./pkg/generated
@echo "Generate code..."
./hack/update-codegen.sh
build:
@echo "Building binary..."
CGO_ENABLED=0 $(GOBUILD) -o $(BIN_DIR)/$(BINARY_NAME)
clean:
@echo "Cleaning up..."
$(GOCLEAN)
rm -rf $(BIN_DIR)
test:
@echo "Running tests..."
$(GOTEST) -v ./...
docker-build:
@echo "Building Docker image..."
docker build -t $(IMAGE_NAME) .
docker-push:
@echo "Pushing Docker image..."
docker push $(IMAGE_NAME):latest
deploy:
@echo "Deploying to Kubernetes..."
kubectl apply -f artifacts/clusterrole.yaml
kubectl apply -f artifacts/serviceaccount.yaml
kubectl apply -f artifacts/clusterrolebinding.yaml
kubectl apply -f artifacts/crd.yaml
kubectl apply -f artifacts/manager.yaml
undeploy:
@echo "Undeploying..."
kubectl delete -f artifacts/manager.yaml
kubectl delete -f artifacts/clusterrolebinding.yaml
kubectl delete -f artifacts/clusterrole.yaml
kubectl delete -f artifacts/serviceaccount.yaml
kubectl delete -f artifacts/crd.yaml