-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (60 loc) · 2.35 KB
/
Makefile
File metadata and controls
72 lines (60 loc) · 2.35 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
#
# Directories.
#
# Full directory of where the Makefile resides
TOOLS_DIR ?= hack/tools
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/$(BIN_DIR))
GO_INSTALL := ./scripts/go_install.sh
#
# Binaries.
#
# Note: Need to use abspath so we can invoke these from subdirectories
KUSTOMIZE_VER := v5.3.0
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER))
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v5
.PHONY: all
all: build-helm-charts
YQ_VER := v4.35.2
YQ_BIN := yq
YQ := $(abspath $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER))
YQ_PKG := github.com/mikefarah/yq/v4
HELM_VER := v3.16.4
HELM_BIN := helm
HELM := $(abspath $(TOOLS_BIN_DIR)/$(HELM_BIN))
HELM_PLATFORM := linux-amd64
CLUSTERCTL_VER := v1.9.5
CLUSTERCTL_BIN := clusterctl
CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR)/$(CLUSTERCTL_BIN))
CLUSTERCTL_PLATFORM := linux-amd64
CONTAINER_ENGINE ?= docker
build-%-chart: $(YQ) $(KUSTOMIZE) $(CLUSTERCTL) $(HELM)
(export YQ=$(YQ) CLUSTERCTL=$(CLUSTERCTL) KUSTOMIZE=$(KUSTOMIZE) HELM=$(HELM); $(MAKE) -C ./charts $@)
build-helm-charts: $(YQ) $(KUSTOMIZE) $(CLUSTERCTL) $(HELM)
(export YQ=$(YQ) CLUSTERCTL=$(CLUSTERCTL) KUSTOMIZE=$(KUSTOMIZE) HELM=$(HELM); $(MAKE) -C ./charts build)
.PHONY: test-charts-crc
test-charts-crc:
$(MAKE) -C ./charts test-chart-crc
.PHONY: clean
clean:
rm -rf hack hack-docker out
.PHONY: build-docker
build-docker:
$(CONTAINER_ENGINE) --version|grep -q podman && MOUNT_FLAGS=",Z" ; \
$(CONTAINER_ENGINE) run --rm --interactive --workdir=/workspace --mount=type=bind,src=./,target=/workspace$${MOUNT_FLAGS} docker.io/library/golang:1.24.0 make build-helm-charts TOOLS_DIR=hack-docker/tools
$(KUSTOMIZE): # Build kustomize from tools folder.
CGO_ENABLED=0 GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KUSTOMIZE_PKG) $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
$(YQ):
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(YQ_PKG) $(YQ_BIN) ${YQ_VER}
$(HELM):
curl -L https://get.helm.sh/helm-$(HELM_VER)-$(HELM_PLATFORM).tar.gz -o $(HELM).tgz
tar xzf $(HELM).tgz --strip-components=1 -C $(TOOLS_BIN_DIR) $(HELM_PLATFORM)/helm
rm $(HELM).tgz
$(CLUSTERCTL):
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VER)/clusterctl-$(CLUSTERCTL_PLATFORM) -o $(CLUSTERCTL)
chmod a+x $(CLUSTERCTL)
.PHONY: lint
lint:
@for chart in $$(ls -1 charts/ | grep -v Makefile); do \
$(HELM) lint "./charts/$$chart"; \
done