add operator
This commit is contained in:
50
Makefile
Normal file
50
Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
# Image URL to use all building/pushing image targets
|
||||
IMG ?= localhost:5000/monitor
|
||||
CONTROLLER_GEN = bin/controller-gen
|
||||
|
||||
CI_COMMIT ?= $(shell git rev-parse --short HEAD)
|
||||
CI_BRANCH ?= $(shell git describe --tags)
|
||||
LDFLAGS = -s -w -X 'main.version=$(CI_BRANCH)' -X 'main.commit=$(CI_COMMIT)'
|
||||
|
||||
all: build
|
||||
|
||||
##@ Development
|
||||
|
||||
manifests: $(CONTROLLER_GEN) ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
|
||||
$(CONTROLLER_GEN) rbac:roleName=role crd webhook paths=./pkg/...
|
||||
|
||||
generate: $(CONTROLLER_GEN) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
|
||||
$(CONTROLLER_GEN) object paths=./pkg/apis/...
|
||||
|
||||
fmt: ## Run go fmt against code.
|
||||
go fmt ./...
|
||||
|
||||
vet: ## Run go vet against code.
|
||||
go vet ./...
|
||||
|
||||
##@ Build
|
||||
|
||||
build: generate ## Build manager binary.
|
||||
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "$(LDFLAGS)" -o bin/manager -v cmd/main.go
|
||||
|
||||
run: generate
|
||||
go run cmd/main.go
|
||||
|
||||
dockerx:
|
||||
# docker buildx create --use --driver-opt network=host
|
||||
docker buildx build --platform linux/amd64,linux/arm64 --build-arg "LDFLAGS=$(LDFLAGS)" -t $(IMG) --push .
|
||||
|
||||
docker:
|
||||
docker build --network host -t $(IMG) --build-arg TARGETARCH=$(shell go env GOARCH) --build-arg "LDFLAGS=$(LDFLAGS)" .
|
||||
docker push $(IMG)
|
||||
docker rmi $(IMG)
|
||||
|
||||
install: manifests
|
||||
kubectl kustomize config | kubectl create -f -
|
||||
|
||||
clean:
|
||||
kubectl kustomize config | kubectl delete --ignore-not-found=true -f -
|
||||
|
||||
$(CONTROLLER_GEN): ## Download controller-gen locally if necessary.
|
||||
@[ -f $@ ] || GOBIN=$(shell pwd)/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.4
|
||||
Reference in New Issue
Block a user