|
| 1 | +# ---------------------------------------------------------------------------------------------------------------------- |
| 2 | +# Copyright (c) 2025, Oracle and/or its affiliates. |
| 3 | +# |
| 4 | +# Licensed under the Universal Permissive License v 1.0 as shown at |
| 5 | +# http://oss.oracle.com/licenses/upl. |
| 6 | +# |
| 7 | +CURRDIR := $(shell pwd) |
| 8 | +NAMESPACE ?= coherence-demo |
| 9 | +IMAGE_PREFIX ?= |
| 10 | +IMAGE_VERSION ?= 1.0.0 |
| 11 | +PLATFORM ?= linux/arm64 |
| 12 | +GO_IMAGE ?= $(IMAGE_PREFIX)polyglot-client-go:$(IMAGE_VERSION) |
| 13 | +PY_IMAGE ?= $(IMAGE_PREFIX)polyglot-client-py:$(IMAGE_VERSION) |
| 14 | +JS_IMAGE ?= $(IMAGE_PREFIX)polyglot-client-js:$(IMAGE_VERSION) |
| 15 | + |
| 16 | + |
| 17 | +# ====================================================================================================================== |
| 18 | +# Makefile targets start here |
| 19 | +# ====================================================================================================================== |
| 20 | + |
| 21 | +# ---------------------------------------------------------------------------------------------------------------------- |
| 22 | +# Display the Makefile help - this is a list of the targets with a description. |
| 23 | +# This target MUST be the first target in the Makefile so that it is run when running make with no arguments |
| 24 | +# ---------------------------------------------------------------------------------------------------------------------- |
| 25 | +help: ## Display this help. |
| 26 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 27 | + |
| 28 | + |
| 29 | +# ====================================================================================================================== |
| 30 | +# Build targets |
| 31 | +# ====================================================================================================================== |
| 32 | +##@ Build |
| 33 | + |
| 34 | +.PHONY: create-namespace |
| 35 | +create-namespace: ## Create the namespace |
| 36 | + kubectl create namespace $(NAMESPACE) || true |
| 37 | + |
| 38 | +.PHONY: delete-namespace |
| 39 | +delete-namespace: ## Delete the namespace |
| 40 | + kubectl delete namespace $(NAMESPACE) || true |
| 41 | + |
| 42 | +.PHONY: create-go-image |
| 43 | +create-go-image: ## Create the Go Docker image |
| 44 | + cd go && docker buildx build --platform $(PLATFORM) -t $(GO_IMAGE) . |
| 45 | + |
| 46 | +.PHONY: create-py-image |
| 47 | +create-py-image: ## Create the Python Docker image |
| 48 | + cd py && docker buildx build --platform $(PLATFORM) -t $(PY_IMAGE) . |
| 49 | + |
| 50 | +.PHONY: create-js-image |
| 51 | +create-js-image: ## Create the JavaScript Docker image |
| 52 | + cd js && docker buildx build --platform $(PLATFORM) -t $(JS_IMAGE) . |
| 53 | + |
| 54 | +.PHONY: kind-load-images |
| 55 | +kind-load-images: ## Load images into kind |
| 56 | + kind load docker-image $(GO_IMAGE) |
| 57 | + kind load docker-image $(PY_IMAGE) |
| 58 | + kind load docker-image $(JS_IMAGE) |
| 59 | + |
| 60 | +.PHONY: create-all-images |
| 61 | +create-all-images: create-go-image create-js-image create-py-image ## Create all images |
| 62 | + |
| 63 | +.PHONY: push-image |
| 64 | +push-image: ## Push the docker image |
| 65 | + docker push $(IMAGE_REGISTRY)/$(DOCS_IMAGE):$(DOCS_VERSION) |
| 66 | + |
| 67 | +# ====================================================================================================================== |
| 68 | +# Deploy targets |
| 69 | +# ====================================================================================================================== |
| 70 | +##@ Deploy |
| 71 | + |
| 72 | +.PHONY: deploy-operator |
| 73 | +deploy-operator: ## Deploy the Coherence Operator |
| 74 | + kubectl apply -f https://github.com/oracle/coherence-operator/releases/download/v3.4.3/coherence-operator.yaml |
| 75 | + |
| 76 | +.PHONY: undeploy-operator |
| 77 | +undeploy-operator: ## Undeploy the Coherence Operator |
| 78 | + kubectl delete -f https://github.com/oracle/coherence-operator/releases/download/v3.4.3/coherence-operator.yaml |
| 79 | + |
| 80 | +.PHONY: deploy-coherence |
| 81 | +deploy-coherence: ## Deploy the Coherence Cluster |
| 82 | + kubectl -n $(NAMESPACE) apply -f yaml/coherence-cluster.yaml |
| 83 | + sleep 5 |
| 84 | + kubectl -n $(NAMESPACE) get pods |
| 85 | + |
| 86 | +.PHONY: undeploy-coherence |
| 87 | +undeploy-coherence: ## Deploy the Coherence Cluster |
| 88 | + kubectl -n $(NAMESPACE) delete -f yaml/coherence-cluster.yaml |
| 89 | + |
| 90 | +.PHONY: deploy-go-client |
| 91 | +deploy-go-client: ## Deploy the Go client |
| 92 | + kubectl -n $(NAMESPACE) apply -f yaml/go-client.yaml |
| 93 | + |
| 94 | +.PHONY: undeploy-go-client |
| 95 | +undeploy-go-client: ## Undeploy the Go client |
| 96 | + kubectl -n $(NAMESPACE) delete -f yaml/go-client.yaml |
| 97 | + |
| 98 | +.PHONY: deploy-py-client |
| 99 | +deploy-py-client: ## Deploy the Python client |
| 100 | + kubectl -n $(NAMESPACE) apply -f yaml/py-client.yaml |
| 101 | + |
| 102 | +.PHONY: undeploy-py-client |
| 103 | +undeploy-py-client: ## Undeploy the Python client |
| 104 | + kubectl -n $(NAMESPACE) delete -f yaml/py-client.yaml |
| 105 | + |
| 106 | +.PHONY: deploy-js-client |
| 107 | +deploy-js-client: ## Deploy the JavaScript client |
| 108 | + kubectl -n $(NAMESPACE) apply -f yaml/js-client.yaml |
| 109 | + |
| 110 | +.PHONY: undeploy-js-client |
| 111 | +undeploy-js-client: ## Deploy the JavaScript client |
| 112 | + kubectl -n $(NAMESPACE) delete -f yaml/js-client.yaml |
| 113 | + |
| 114 | +.PHONY: deploy-all-clients |
| 115 | +deploy-all-clients: deploy-go-client deploy-js-client deploy-py-client ## Deploy all clients |
| 116 | + |
| 117 | +.PHONY: undeploy-all-clients |
| 118 | +undeploy-all-clients: undeploy-go-client undeploy-js-client undeploy-py-client ## Undeploy all clients |
0 commit comments