-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
81 lines (61 loc) · 2.82 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
# include the bingo binary variables. This enables the bingo versions to be
# referenced here as make variables. For example: $(GOLANGCI_LINT)
include .bingo/Variables.mk
# set the default target here, because the include above will automatically set
# it to the first defined target
.DEFAULT_GOAL := default
default: all
VERSION ?= v0.0.1
CRD_DIR := $(shell pwd)/deploy/crds
# REGISTRY_BASE
# defines the container registry and organization for the bundle and operator container images.
REGISTRY_BASE_OPENSHIFT = quay.io/rhobs
REGISTRY_BASE ?= $(REGISTRY_BASE_OPENSHIFT)
# Image URL to use all building/pushing image targets
IMG ?= $(REGISTRY_BASE)/multicluster-observability-addon:$(VERSION)
.PHONY: deps
deps: go.mod go.sum
go mod tidy
go mod download
go mod verify
$(CRD_DIR)/observability.openshift.io_clusterlogforwarders.yaml:
@mkdir -p $(CRD_DIR)
@curl https://raw.githubusercontent.com/openshift/cluster-logging-operator/release-6.0/bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml > $(CRD_DIR)/observability.openshift.io_clusterlogforwarders.yaml
$(CRD_DIR)/opentelemetry.io_opentelemetrycollectors.yaml:
@mkdir -p $(CRD_DIR)
@curl https://raw.githubusercontent.com/open-telemetry/opentelemetry-operator/v0.100.1/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml > $(CRD_DIR)/opentelemetry.io_opentelemetrycollectors.yaml
$(CRD_DIR)/opentelemetry.io_instrumentations.yaml:
@mkdir -p $(CRD_DIR)
@curl https://raw.githubusercontent.com/open-telemetry/opentelemetry-operator/v0.100.1/bundle/manifests/opentelemetry.io_instrumentations.yaml > $(CRD_DIR)/opentelemetry.io_instrumentations.yaml
.PHONY: install-crds
install-crds: $(CRD_DIR)/observability.openshift.io_clusterlogforwarders.yaml $(CRD_DIR)/opentelemetry.io_opentelemetrycollectors.yaml $(CRD_DIR)/opentelemetry.io_instrumentations.yaml
.PHONY: fmt
fmt: $(GOFUMPT) ## Run gofumpt on source code.
find . -type f -name '*.go' -not -path '**/fake_*.go' -exec $(GOFUMPT) -w {} \;
.PHONY: lint
lint: $(GOLANGCI_LINT) ## Run golangci-lint on source code.
$(GOLANGCI_LINT) run --timeout=5m ./...
.PHONY: lint-fix
lint-fix: $(GOLANGCI_LINT) ## Attempt to automatically fix lint issues in source code.
$(GOLANGCI_LINT) run --fix --timeout=5m ./...
.PHONY: test
test:
go test -v ./internal/...
.PHONY: addon
addon: deps fmt ## Build addon binary
go build -o bin/multicluster-observability-addon main.go
.PHONY: oci-build
oci-build: ## Build the image
podman build -t ${IMG} .
.PHONY: oci-push
oci-push: ## Push the image
podman push ${IMG}
.PHONY: oci
oci: oci-build oci-push
.PHONY: addon-deploy
addon-deploy: $(KUSTOMIZE) install-crds
cd deploy && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build ./deploy | kubectl apply -f -
.PHONY: addon-undeploy
addon-undeploy: $(KUSTOMIZE) install-crds
$(KUSTOMIZE) build ./deploy | kubectl delete -f -