Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (67 loc) · 2.48 KB
/
Copy pathMakefile
File metadata and controls
82 lines (67 loc) · 2.48 KB
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
# Basic developer tasks for ferrvault-operator.
#
# This is intentionally minimal — kubebuilder-generated Makefiles pull in a
# large zoo of helper binaries we don't need yet. We'll add codegen, envtest,
# and release wiring as the project grows.
SHELL := /usr/bin/env bash
IMG ?= ghcr.io/ferrlabs/ferrvault-operator:dev
CHART_DIR := charts/ferrvault-operator
.PHONY: help
help:
@echo "Targets:"
@echo " fmt Run gofmt on all Go files."
@echo " lint Run golangci-lint."
@echo " test Run unit tests."
@echo " build Build the manager binary into bin/manager."
@echo " docker-build Build the container image as \$$IMG (default: $(IMG))."
@echo " install-crds Apply CRDs (rendered from the Helm chart) to the current context."
@echo " uninstall-crds Remove CRDs from the current kubectl context."
@echo " run Run the manager against the current kubectl context."
@echo " helm-lint Run 'helm lint' on charts/ferrvault-operator."
@echo " helm-template Render the chart and print to stdout (sanity check)."
@echo " helm-package Package the chart into dist/."
@echo " helm-install helm upgrade --install against the current context."
.PHONY: fmt
fmt:
gofmt -l -w .
.PHONY: lint
lint:
golangci-lint run
.PHONY: test
test:
go test -race -coverprofile=coverage.out ./...
.PHONY: build
build:
mkdir -p bin
CGO_ENABLED=0 go build -trimpath -o bin/manager ./cmd
.PHONY: docker-build
docker-build:
docker build -t $(IMG) .
# CRDs are owned by the Helm chart (the only source of truth). For a
# `make run`-style local dev loop we still need them applied — render them
# from the chart and pipe into kubectl instead of maintaining a duplicate set
# under config/.
.PHONY: install-crds
install-crds:
helm template ferrvault-operator $(CHART_DIR) --show-only templates/crd-*.yaml | kubectl apply -f -
.PHONY: uninstall-crds
uninstall-crds:
helm template ferrvault-operator $(CHART_DIR) --show-only templates/crd-*.yaml | kubectl delete --ignore-not-found -f -
.PHONY: run
run: build
./bin/manager --leader-elect=false
# --- Helm ---
.PHONY: helm-lint
helm-lint:
helm lint $(CHART_DIR)
.PHONY: helm-template
helm-template:
helm template ferrvault-operator $(CHART_DIR) --debug
.PHONY: helm-package
helm-package:
mkdir -p dist
helm package $(CHART_DIR) -d dist/
.PHONY: helm-install
helm-install:
helm upgrade --install ferrvault-operator $(CHART_DIR) \
--namespace ferrvault-operator-system --create-namespace