Skip to content

Commit 59a3201

Browse files
committed
Add Make targets that push to development clusters
1 parent c2e49b5 commit 59a3201

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
IMAGE ?= localhost/postgres-operator:latest
23
PGMONITOR_DIR ?= hack/tools/pgmonitor
34
PGMONITOR_VERSION ?= v5.2.1
45
QUERIES_CONFIG_DIR ?= hack/tools/queries
@@ -44,7 +45,7 @@ notes: ## List known issues and future considerations
4445
.PHONY: clean
4546
clean: ## Clean resources
4647
clean: clean-deprecated
47-
rm -f bin/postgres-operator
48+
rm -f bin/postgres-operator image.tar
4849
rm -rf licenses/*/
4950
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
5051
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
@@ -133,14 +134,25 @@ deploy-dev: createnamespaces
133134

134135
.PHONY: build
135136
build: ## Build a postgres-operator image
136-
$(BUILDAH) build --tag localhost/postgres-operator \
137+
$(BUILDAH) build --tag '$(IMAGE)' \
137138
--label org.opencontainers.image.authors='Crunchy Data' \
138139
--label org.opencontainers.image.description='Crunchy PostgreSQL Operator' \
139140
--label org.opencontainers.image.revision='$(shell git rev-parse HEAD)' \
140141
--label org.opencontainers.image.source='https://github.com/CrunchyData/postgres-operator' \
141142
--label org.opencontainers.image.title='Crunchy PostgreSQL Operator' \
142143
.
143144

145+
build-k3d: image.tar ; $(or $(K3D),k3d) image import $<
146+
build-kind: image.tar ; $(or $(KIND),kind) load image-archive $<
147+
build-minikube: image.tar ; $(or $(MINIKUBE),minikube) image load $<
148+
149+
image.tar: build
150+
set -x && \
151+
case '$(BUILDAH)' in \
152+
*docker*) $(BUILDAH) image save '--output=$@' '$(IMAGE)' ;; \
153+
*) $(BUILDAH) push '$(IMAGE)' 'oci-archive:$@:$(IMAGE)' ;; \
154+
esac
155+
144156
##@ Test
145157

146158
.PHONY: check

0 commit comments

Comments
 (0)