forked from kiali/kiali-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (57 loc) · 2.65 KB
/
Makefile
File metadata and controls
68 lines (57 loc) · 2.65 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
# Needed for Travis - it won't like the version regex check otherwise
SHELL=/bin/bash
# Directories based on the root project directory
ROOTDIR=$(CURDIR)
OUTDIR=${ROOTDIR}/_output
# Identifies the current build.
VERSION ?= v1.19.0-SNAPSHOT
COMMIT_HASH ?= $(shell git rev-parse HEAD)
# Identifies the Kiali operator container image that will be built
OPERATOR_IMAGE_ORG ?= kiali
OPERATOR_CONTAINER_NAME ?= ${OPERATOR_IMAGE_ORG}/kiali-operator
OPERATOR_CONTAINER_VERSION ?= ${VERSION}
OPERATOR_QUAY_NAME ?= quay.io/${OPERATOR_CONTAINER_NAME}
OPERATOR_QUAY_TAG = ${OPERATOR_QUAY_NAME}:${OPERATOR_CONTAINER_VERSION}
# Determine if we should use Docker OR Podman - value must be one of "docker" or "podman"
DORP ?= docker
.PHONY: help
help: Makefile
@echo
@echo "Targets"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
## clean: Cleans _output
clean:
@rm -rf ${OUTDIR}
.download-operator-sdk-if-needed:
@if [ "$(shell which operator-sdk 2>/dev/null || echo -n "")" == "" ]; then \
mkdir -p "${OUTDIR}/operator-sdk-install" ;\
if [ -x "${OUTDIR}/operator-sdk-install/operator-sdk" ]; then \
echo "You do not have operator-sdk installed in your PATH. Will use the one found here: ${OUTDIR}/operator-sdk-install/operator-sdk" ;\
else \
echo "You do not have operator-sdk installed in your PATH. The binary will be downloaded to ${OUTDIR}/operator-sdk-install/operator-sdk" ;\
curl -L https://github.com/operator-framework/operator-sdk/releases/download/v0.17.0/operator-sdk-v0.17.0-$$(uname -m)-linux-gnu > "${OUTDIR}/operator-sdk-install/operator-sdk" ;\
chmod +x "${OUTDIR}/operator-sdk-install/operator-sdk" ;\
fi ;\
fi
.ensure-operator-sdk-exists: .download-operator-sdk-if-needed
@$(eval OP_SDK ?= $(shell which operator-sdk 2>/dev/null || echo "${OUTDIR}/operator-sdk-install/operator-sdk"))
@"${OP_SDK}" version
## build: Build Kiali operator container image.
build: .ensure-operator-sdk-exists
@echo Building container image for Kiali operator using operator-sdk
cd "${ROOTDIR}" && "${OP_SDK}" build --image-builder ${DORP} --image-build-args "--pull" "${OPERATOR_QUAY_TAG}"
## push: Pushes the operator image to quay.
push:
ifeq ($(DORP),docker)
@echo Pushing Kiali operator image using docker
docker push ${OPERATOR_QUAY_TAG}
else
@echo Pushing Kiali operator image using podman
podman push ${OPERATOR_QUAY_TAG}
endif
## generate-all-in-one: Creates the all-in-one yaml file that can be used to deploy the operator via kubectl apply.
generate-all-in-one:
@mkdir -p ${OUTDIR}
@OPERATOR_IMAGE_VERSION=$${OPERATOR_IMAGE_VERSION:-${VERSION}} \
${ROOTDIR}/deploy/merge-operator-yaml.sh --file ${OUTDIR}/kiali-operator-all-in-one.yaml