|
| 1 | +# It's necessary to set this because some environments don't link sh -> bash. |
| 2 | +SHELL := /bin/bash |
| 3 | + |
| 4 | +#----------------------------------------------------------------------------- |
| 5 | +# VERBOSE target |
| 6 | +#----------------------------------------------------------------------------- |
| 7 | + |
| 8 | +# When you run make VERBOSE=1 (the default), executed commands will be printed |
| 9 | +# before executed. If you run make VERBOSE=2 verbose flags are turned on and |
| 10 | +# quiet flags are turned off for various commands. Use V_FLAG in places where |
| 11 | +# you can toggle on/off verbosity using -v. Use Q_FLAG in places where you can |
| 12 | +# toggle on/off quiet mode using -q. Use S_FLAG where you want to toggle on/off |
| 13 | +# silence mode using -s... |
| 14 | +VERBOSE ?= 1 |
| 15 | +Q = @ |
| 16 | +Q_FLAG = -q |
| 17 | +QUIET_FLAG = --quiet |
| 18 | +V_FLAG = |
| 19 | +VERBOSE_FLAG = |
| 20 | +S_FLAG = -s |
| 21 | +X_FLAG = |
| 22 | +ifeq ($(VERBOSE),1) |
| 23 | + Q = |
| 24 | +endif |
| 25 | +ifeq ($(VERBOSE),2) |
| 26 | + Q = |
| 27 | + Q_FLAG = |
| 28 | + QUIET_FLAG = |
| 29 | + S_FLAG = |
| 30 | + V_FLAG = -v |
| 31 | + VERBOSE_FLAG = --verbose |
| 32 | + X_FLAG = -x |
| 33 | +endif |
| 34 | + |
| 35 | +EC=$(SHELL) -c '. ../../hack/examples-commons.sh && $$1' EC |
| 36 | +ifneq (,$(findstring n,$(MAKEFLAGS))) |
| 37 | +EC=: EC |
| 38 | +endif |
| 39 | +export HACK_YAMLS=../../hack/yamls |
| 40 | + |
| 41 | +.DEFAULT_GOAL := help |
| 42 | + |
| 43 | +## -- Utility targets -- |
| 44 | + |
| 45 | +## Print help message for all Makefile targets |
| 46 | +## Run `make` or `make help` to see the help |
| 47 | +.PHONY: help |
| 48 | +help: ## Credit: https://gist.github.com/prwhite/8168133#gistcomment-2749866 |
| 49 | + |
| 50 | + @printf "Usage:\n make <target>"; |
| 51 | + |
| 52 | + @awk '{ \ |
| 53 | + if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \ |
| 54 | + helpCommand = substr($$0, index($$0, ":") + 2); \ |
| 55 | + if (helpMessage) { \ |
| 56 | + printf "\033[36m%-20s\033[0m %s\n", \ |
| 57 | + helpCommand, helpMessage; \ |
| 58 | + helpMessage = ""; \ |
| 59 | + } \ |
| 60 | + } else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \ |
| 61 | + helpCommand = substr($$0, 0, index($$0, ":")); \ |
| 62 | + if (helpMessage) { \ |
| 63 | + printf "\033[36m%-20s\033[0m %s\n", \ |
| 64 | + helpCommand, helpMessage; \ |
| 65 | + helpMessage = ""; \ |
| 66 | + } \ |
| 67 | + } else if ($$0 ~ /^##/) { \ |
| 68 | + if (helpMessage) { \ |
| 69 | + helpMessage = helpMessage"\n "substr($$0, 3); \ |
| 70 | + } else { \ |
| 71 | + helpMessage = substr($$0, 3); \ |
| 72 | + } \ |
| 73 | + } else { \ |
| 74 | + if (helpMessage) { \ |
| 75 | + print "\n "helpMessage"\n" \ |
| 76 | + } \ |
| 77 | + helpMessage = ""; \ |
| 78 | + } \ |
| 79 | + }' \ |
| 80 | + $(MAKEFILE_LIST) |
| 81 | + |
| 82 | +## -- Cluster Admin targets -- |
| 83 | + |
| 84 | +.PHONY: install-service-binding-operator |
| 85 | +## Install the Service Binding Operator |
| 86 | +install-service-binding-operator: |
| 87 | + ${Q}${EC} install_service_binding_operator_source |
| 88 | + ${Q}${EC} install_service_binding_operator_subscription |
| 89 | + |
| 90 | +.PHONY: uninstall-service-binding-operator |
| 91 | +## Uninstall the Service Binding Operator |
| 92 | +uninstall-service-binding-operator: |
| 93 | + ${Q}-${EC} uninstall_service_binding_operator_subscription |
| 94 | + ${Q}-${EC} uninstall_service_binding_operator_source |
| 95 | + |
| 96 | +.PHONY: install-backing-db-operator |
| 97 | +## Install the Backing Service DB Operator |
| 98 | +install-backing-db-operator: |
| 99 | + ${Q}${EC} install_postgresql_operator_source |
| 100 | + ${Q}${EC} install_postgresql_operator_subscription |
| 101 | + |
| 102 | +.PHONY: uninstall-backing-db-operator |
| 103 | +## Uninstall the Backing Service DB Operator |
| 104 | +uninstall-backing-db-operator: |
| 105 | + ${Q}-${EC} uninstall_postgresql_operator_subscription |
| 106 | + ${Q}-${EC} uninstall_postgresql_operator_source |
| 107 | + |
| 108 | +.PHONY: install-serverless-operator |
| 109 | +## Install the Serverless Operator |
| 110 | +install-serverless-operator: |
| 111 | + ${Q}${EC} install_serverless_operator_subscription |
| 112 | + |
| 113 | +.PHONY: uninstall-serverless-operator |
| 114 | +## Uninstall the Serverless Operator |
| 115 | +uninstall-serverless-operator: |
| 116 | + ${Q}-${EC} uninstall_serverless_operator_subscription |
| 117 | + |
| 118 | +.PHONY: install-service-mesh-operator |
| 119 | +## Install the Service Mesh Operator |
| 120 | +install-service-mesh-operator: |
| 121 | + ${Q}${EC} install_service_mesh_operator_subscription |
| 122 | + |
| 123 | +.PHONY: uninstall-service-mesh-operator |
| 124 | +## Uninstall the Service Mesh Operator |
| 125 | +uninstall-service-mesh-operator: |
| 126 | + ${Q}-${EC} uninstall_service_mesh_operator_subscription |
| 127 | + |
| 128 | +.PHONY: install-all-operators |
| 129 | +## Install all the operators |
| 130 | +install-all-operators: install-backing-db-operator install-service-binding-operator install-serverless-operator install-service-mesh-operator |
| 131 | + |
| 132 | +.PHONY: uninstall-all-operators |
| 133 | +## Uninstall all the operators |
| 134 | +uninstall-all-operators: uninstall-backing-db-operator uninstall-service-binding-operator uninstall-serverless-operator uninstall-service-mesh-operator |
| 135 | + |
| 136 | +.PHONY: install-knative-serving |
| 137 | +## Install Knative Serving |
| 138 | +install-knative-serving: |
| 139 | + ${Q}${EC} install_knative_serving |
| 140 | + |
| 141 | +.PHONY: uninstall-knative-serving |
| 142 | +## Uninstall Knative Serving |
| 143 | +uninstall-knative-serving: |
| 144 | + ${Q}-${EC} uninstall_knative_serving |
| 145 | + |
| 146 | +.PHONY: install-quarkus-native-s2i-builder |
| 147 | +## Install ubi-quarkus-native-s2i builder |
| 148 | +install-quarkus-native-s2i-builder: |
| 149 | + ${Q}${EC} install_ubi_quarkus_native_s2i_builder_image |
| 150 | + |
| 151 | +.PHONY: install-all |
| 152 | +## Install all the operators, Knative Serving and the Quarkus native s2i builder image |
| 153 | +install-all: install-all-operators install-knative-serving install-quarkus-native-s2i-builder |
| 154 | + |
| 155 | +## -- Application Developer targets -- |
| 156 | + |
| 157 | +.PHONY: create-project |
| 158 | +## Create the OpenShift project/namespace |
| 159 | +create-project: |
| 160 | + ${Q}-${EC} create_project |
| 161 | + |
| 162 | +.PHONY: delete-project |
| 163 | +## Delete the OpenShift project/namespace |
| 164 | +delete-project: |
| 165 | + ${Q}${EC} delete_project |
| 166 | + |
| 167 | +.PHONY: create-backing-db-instance |
| 168 | +## Create the Backing Service Database |
| 169 | +create-backing-db-instance: |
| 170 | + ${Q}${EC} install_postgresql_db_instance |
| 171 | + |
| 172 | +.PHONY: set-labels-on-knative-app |
| 173 | +## Set binding labels on the knative application |
| 174 | +set-labels-on-knative-app: |
| 175 | + ${Q}oc label services.serving.knative.dev knative-app connects-to=postgres environment=demo --overwrite |
| 176 | + |
| 177 | +.PHONY: create-service-binding-request |
| 178 | +## Create the Service Binding Request |
| 179 | +create-service-binding-request: |
| 180 | + ${Q}oc apply -f service-binding-request.yaml |
0 commit comments