|
5 | 5 | GOBIN=$(shell go env GOBIN) |
6 | 6 | endif |
7 | 7 |
|
| 8 | +# Version of cron-operator (e.g. `v1.2.3`). |
| 9 | +VERSION ?= $(shell cat VERSION) |
| 10 | + |
8 | 11 | # Image registry (e.g. `docker.io`) |
9 | | -IMAGE_REGISTRY ?= docker.io |
| 12 | +IMAGE_REGISTRY ?= registry-cn-beijing.ack.aliyuncs.com |
10 | 13 | # Image repository (e.g. `my-repo/my-image`). |
11 | | -IMAGE_REPOSITORY ?= cron-operator |
12 | | -# Image tag (e.g. `latest`). |
13 | | -IMAGE_TAG ?= latest |
| 14 | +IMAGE_REPOSITORY ?= acs/cron-operator |
| 15 | +# Image tag (e.g. `latest` or `1.2.3`). |
| 16 | +IMAGE_TAG ?= $(shell sed 's/^v//g' VERSION) |
14 | 17 | # Image URL to use all building/pushing image targets |
15 | | -IMAGE ?= $(IMAGE_REPOSITORY):$(IMAGE_TAG) |
| 18 | +IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_REPOSITORY):$(IMAGE_TAG) |
| 19 | + |
| 20 | +# Cron operator chart directory. |
| 21 | +CRON_OPERATOR_CHART ?= charts/cron-operator |
| 22 | +# Helm release name. |
| 23 | +RELEASE_NAME ?= cron-operator |
| 24 | +# Helm release namespace. |
| 25 | +RELEASE_NAMESPACE ?= cron-operator |
16 | 26 |
|
17 | 27 | # CONTAINER_TOOL defines the container tool to be used for building images. |
18 | 28 | # Be aware that the target commands are only tested with Docker which is |
@@ -45,6 +55,9 @@ all: build |
45 | 55 | help: ## Display this help. |
46 | 56 | @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) |
47 | 57 |
|
| 58 | +.PHONY: print-% |
| 59 | +print-%: ; @echo $*=$($*) |
| 60 | + |
48 | 61 | ##@ Development |
49 | 62 |
|
50 | 63 | .PHONY: manifests |
@@ -162,6 +175,21 @@ helm-unittest: helm-unittest-plugin ## Run Helm chart unittests. |
162 | 175 | helm-docs: helm-docs-plugin ## Generates markdown documentation for helm charts from requirements and values files. |
163 | 176 | $(HELM_DOCS) --sort-values-order=file |
164 | 177 |
|
| 178 | +.PHONY: helm-upgrade |
| 179 | +helm-upgrade: ## Upgrade cron-operator helm chart release (install if not exists). |
| 180 | + $(HELM) upgrade $(RELEASE_NAME) $(CRON_OPERATOR_CHART) \ |
| 181 | + --install \ |
| 182 | + --namespace $(RELEASE_NAMESPACE) \ |
| 183 | + --create-namespace \ |
| 184 | + --wait \ |
| 185 | + --set image.registry=${IMAGE_REGISTRY} \ |
| 186 | + --set image.repository=${IMAGE_REPOSITORY} \ |
| 187 | + --set image.tag=${IMAGE_TAG} |
| 188 | + |
| 189 | +.PHONY: helm-uninstall |
| 190 | +helm-uninstall: ## Uninstall cron-operator helm chart release. |
| 191 | + $(HELM) uninstall $(RELEASE_NAME) --namespace $(RELEASE_NAMESPACE) |
| 192 | + |
165 | 193 | ##@ Deployment |
166 | 194 |
|
167 | 195 | ifndef ignore-not-found |
|
0 commit comments