-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (59 loc) · 2.68 KB
/
Copy pathMakefile
File metadata and controls
70 lines (59 loc) · 2.68 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
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
## Tool Versions
# Set the OPM version to use.
OPM_VERSION ?= v1.56.0
all: render-all-catalogs
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
## Location to install dependencies to
LOCALBIN := $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
.PHONY: opm
OPM_DL_URL = https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)
OPM = $(LOCALBIN)/opm-$(OPM_VERSION)
opm: $(LOCALBIN) opm-policy ## Download opm locally if necessary.
ifeq (,$(wildcard $(OPM)))
@{ \
set -e ;\
echo "Downloading OPM version $(OPM_VERSION)" ;\
curl -sSLo $(OPM) $(OPM_DL_URL)/$(OS)-$(ARCH)-opm ;\
chmod +x $(OPM) ;\
}
endif
.PHONY: opm-policy
POLICY_FILE = $(HOME)/.config/containers/policy.json
opm-policy:
ifeq (,$(wildcard $(POLICY_FILE)))
@{ \
set -e ;\
if ! test -f $(POLICY_FILE); then \
echo "Creating policy.json file at $(POLICY_FILE)"; \
mkdir -p $(dir $(POLICY_FILE)); \
echo '{ "default": [{"type": "insecureAcceptAnything"}] }' > $(POLICY_FILE); \
fi \
}
endif
.PHONY: render-postgresql-operator-catalog
render-postgresql-operator-catalog: opm ## Render the postgresql-operator catalog.
@echo "Rendering postgresql-operator catalog"
$(OPM) alpha render-template basic -o yaml ./veneer/percona-postgresql-operator.yaml > ./catalog/percona-postgresql-operator/catalog.yaml
.PHONY: render-psmdb-operator-catalog
render-psmdb-operator-catalog: opm ## Render the psmdb-operator catalog.
@echo "Rendering psmdb-operator catalog"
$(OPM) alpha render-template semver -o yaml ./veneer/percona-server-mongodb-operator.yaml > ./catalog/percona-server-mongodb-operator/catalog.yaml
.PHONY: render-pxc-operator-catalog
render-pxc-operator-catalog: opm ## Render the pxc-operator catalog.
@echo "Rendering pxc-operator catalog"
$(OPM) alpha render-template semver -o yaml ./veneer/percona-xtradb-cluster-operator.yaml > ./catalog/percona-xtradb-cluster-operator/catalog.yaml
.PHONY: render-ps-operator-catalog
render-ps-operator-catalog: opm ## Render the ps-operator catalog.
@echo "Rendering ps-operator catalog"
$(OPM) alpha render-template semver -o yaml ./veneer/percona-server-mysql-operator.yaml > ./catalog/percona-server-mysql-operator/catalog.yaml
PHONY: render-all-catalogs
TARGET_DEPS := render-postgresql-operator-catalog
TARGET_DEPS += render-psmdb-operator-catalog render-pxc-operator-catalog
TARGET_DEPS += render-ps-operator-catalog
render-all-catalogs: $(TARGET_DEPS) ## Render the vm-operator catalog