@@ -17,6 +17,7 @@ REGISTRY_TAG ?= latest
17
17
DOWNLOAD_RHCOS ?= true
18
18
KUBECTL ?= kubectl
19
19
IFACE ?= eth0
20
+ GREP ?= grep
20
21
PODMAN ?= podman
21
22
DOCKER_CONF ?= $(CURDIR ) /docker-config
22
23
DOCKER_AUTH_FILE ?= ${DOCKER_CONF}/auth.json
@@ -139,50 +140,82 @@ push-containers: push-api-container push-agent-container
139
140
deploy-vsphere-simulator :
140
141
$(KUBECTL ) apply -f ' deploy/k8s/vcsim.yaml'
141
142
142
- deploy-on-kind :
143
- sed " s|@MIGRATION_PLANNER_AGENT_IMAGE@|$( MIGRATION_PLANNER_AGENT_IMAGE) |g; \
144
- s|@INSECURE_REGISTRY@|$(INSECURE_REGISTRY)|g; \
145
- s|@MIGRATION_PLANNER_API_IMAGE_PULL_POLICY@|$(MIGRATION_PLANNER_API_IMAGE_PULL_POLICY)|g; \
146
- s|@MIGRATION_PLANNER_API_IMAGE@|$(MIGRATION_PLANNER_API_IMAGE)|g; \
147
- s|@PERSISTENT_DISK_DEVICE@|$(PERSISTENT_DISK_DEVICE)|g" \
148
- deploy/k8s/migration-planner.yaml.template > deploy/k8s/migration-planner.yaml
149
- $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f 'deploy/k8s/*-service.yaml'
150
- $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f 'deploy/k8s/*-secret.yaml'
151
- config_server=$$(ip addr show ${IFACE}| grep -oP '(?<=inet\s)\d+\.\d+\.\d+\.\d+'); \
152
- migration_planner_image_url=$$(ip addr show ${IFACE}| grep -oP '(?<=inet\s)\d+\.\d+\.\d+\.\d+'); \
153
- $(KUBECTL) create secret generic migration-planner-secret -n "${MIGRATION_PLANNER_NAMESPACE}" --from-literal=migration_planner_image_url=http://$$migration_planner_image_url --from-literal=config_server=http://$$config_server:7443 --from-literal=config_server_ui=https://$$config_server_ui/migrate/wizard || true
154
- $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f deploy/k8s/
155
-
156
- deploy-on-openshift :
157
- sed " s|@MIGRATION_PLANNER_AGENT_IMAGE@|$( MIGRATION_PLANNER_AGENT_IMAGE) |g; \
158
- s|@INSECURE_REGISTRY@|$(INSECURE_REGISTRY)|g; \
159
- s|@MIGRATION_PLANNER_API_IMAGE_PULL_POLICY@|$(MIGRATION_PLANNER_API_IMAGE_PULL_POLICY)|g; \
160
- s|@MIGRATION_PLANNER_API_IMAGE@|$(MIGRATION_PLANNER_API_IMAGE)|g; \
161
- s|@PERSISTENT_DISK_DEVICE@|$(PERSISTENT_DISK_DEVICE)|g" \
162
- deploy/k8s/migration-planner.yaml.template > deploy/k8s/migration-planner.yaml
163
- sed 's|@MIGRATION_PLANNER_UI_IMAGE@|$(MIGRATION_PLANNER_UI_IMAGE)|g' deploy/k8s/migration-planner-ui.yaml.template > deploy/k8s/migration-planner-ui.yaml
164
- ls deploy/k8s | awk '/secret|service/' | xargs -I {} oc apply -n ${MIGRATION_PLANNER_NAMESPACE} -f deploy/k8s/{}
165
- oc create route edge planner --service=migration-planner-ui -n ${MIGRATION_PLANNER_NAMESPACE} || true
166
- oc expose service migration-planner-agent -n ${MIGRATION_PLANNER_NAMESPACE} --name planner-agent || true
167
- oc expose service migration-planner-image -n ${MIGRATION_PLANNER_NAMESPACE} --name planner-image || true
168
- config_server=$$(oc get route planner-agent -o jsonpath='{.spec.host}'); \
169
- migration_planner_image_url=$$(oc get route planner-image -o jsonpath='{.spec.host}'); \
170
- config_server_ui=$$(oc get route planner -o jsonpath='{.spec.host}'); \
171
- oc create secret generic migration-planner-secret -n ${MIGRATION_PLANNER_NAMESPACE} --from-literal=migration_planner_image_url=http://$$migration_planner_image_url --from-literal=config_server=http://$$config_server --from-literal=config_server_ui=https://$$config_server_ui/migrate/wizard || true
172
- ls deploy/k8s | awk '! /secret|service|template/' | xargs -I {} oc apply -n ${MIGRATION_PLANNER_NAMESPACE} -f deploy/k8s/{}
143
+ define service_template_values
144
+ MIGRATION_PLANNER_IMAGE=$(MIGRATION_PLANNER_API_IMAGE ) \n
145
+ MIGRATION_PLANNER_AGENT_IMAGE=$(MIGRATION_PLANNER_AGENT_IMAGE ) \n
146
+ MIGRATION_PLANNER_REPLICAS=1\n
147
+ IMAGE_TAG=latest\n
148
+ endef
149
+ export service_template_values
150
+
151
+ deploy/templates/service-template-values :
152
+ @echo $$ service_template_values > deploy/templates/service-template-values
153
+
154
+ define ui_template_values
155
+ MIGRATION_PLANNER_UI_IMAGE=$(MIGRATION_PLANNER_UI_IMAGE ) \n
156
+ MIGRATION_PLANNER_REPLICAS=1\n
157
+ IMAGE_TAG=latest\n
158
+ endef
159
+ export ui_template_values
160
+
161
+ deploy/templates/ui-template-values :
162
+ @echo $$ ui_template_values > deploy/templates/ui-template-values
163
+
164
+
165
+ deploy-on-openshift : deploy/templates/service-template-values deploy/templates/ui-template-values
166
+ # Deploy api resources
167
+ oc process -f deploy/templates/postgres-template.yml | oc apply -f -
168
+ openshift_base_url := $(shell oc whoami --show-server | sed -E 's~https?://api\.~~; s~:[0-9]+/?$$~~') ; \
169
+ openshift_project := $(shell oc project -q) ; \
170
+ oc process -f deploy/templates/service-template.yml --param-file deploy/templates/service-template-values \
171
+ -p MIGRATION_PLANNER_URL=http ://planner-agent-$(openshift_project ) .apps.$(openshift_base_url ) \
172
+ -p MIGRATION_PLANNER_UI_URL=http ://planner-ui-$(openshift_project ) .apps.$(openshift_base_url ) \
173
+ -p MIGRATION_PLANNER_IMAGE_URL=http ://planner-image-$(openshift_project ) .apps.$(openshift_base_url ) \
174
+ | oc apply -f -
175
+ # Deploy UI resources
176
+ oc process -f https://raw.githubusercontent.com/nirarg/migration-planner-ui/refs/heads/template-change/deploy/templates/ui-template.yml \
177
+ --param-file deploy/templates/ui-template-values | oc apply -f -
178
+ # Create Route
179
+ oc expose service migration-planner-agent --name planner-agent
180
+ oc expose service migration-planner-ui --name planner-ui
181
+ oc expose service migration-planner-image --name planner-image
182
+
183
+ delete-from-openshift : deploy/templates/service-template-values deploy/templates/ui-template-values
184
+ oc process -f https://raw.githubusercontent.com/nirarg/migration-planner-ui/refs/heads/template-change/deploy/templates/ui-template.yml \
185
+ --param-file deploy/templates/ui-template-values | oc delete -f -
186
+ oc process -f deploy/templates/service-template.yml --param-file deploy/templates/service-template-values \
187
+ -p MIGRATION_PLANNER_URL="empty" \
188
+ -p MIGRATION_PLANNER_UI_URL="empty" \
189
+ | oc delete -f -
190
+ oc process -f deploy/templates/postgres-template.yml | oc delete -f -
191
+ oc delete route planner-agent planner-ui
192
+
193
+ deploy-on-kind : deploy/templates/service-template-values deploy/templates/ui-template-values
194
+ @deploy/templates/convert_template_to_manifests.sh deploy/templates/postgres-template.yml deploy/templates/postgres-manifest.yml; \
195
+ $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f deploy/templates/postgres-manifest.yml; \
196
+ @inet_ip=$$(ip addr show ${IFACE} | $(GREP) -oP '(?<=inet\s)\d+\.\d+\.\d+\.\d+'); \
197
+ deploy/templates/convert_template_to_manifests.sh deploy/templates/service-template.yml deploy/templates/service-manifest.yml deploy/templates/service-template-values \
198
+ -p MIGRATION_PLANNER_URL=http://$${inet_ip}:7443 \
199
+ -p MIGRATION_PLANNER_UI_URL=http://$${inet_ip}:3333 \
200
+ -p MIGRATION_PLANNER_IMAGE_URL=http://$${inet_ip}:11443; \
201
+ $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f deploy/templates/service-manifest.yml
202
+
203
+ delete-from-kind : deploy/templates/service-template-values deploy/templates/ui-template-values
204
+ @inet_ip=$$(ip addr show ${IFACE} | $(GREP ) -oP '(?<=inet\s ) \d +\.\d +\.\d +\.\d +' ); \
205
+ deploy/templates/convert_template_to_manifests.sh deploy/templates/service-template.yml deploy/templates/service-manifest.yml deploy/templates/service-template-values \
206
+ -p MIGRATION_PLANNER_URL=http://$$ {inet_ip}:7443 \
207
+ -p MIGRATION_PLANNER_UI_URL=http://$$ {inet_ip}:3333 \
208
+ -p MIGRATION_PLANNER_IMAGE_URL=http://$$ {inet_ip}:11443; \
209
+ $(KUBECTL) delete -n "${MIGRATION_PLANNER_NAMESPACE}" -f deploy/templates/service-manifest.yml; \
210
+ deploy/templates/convert_template_to_manifests.sh deploy/templates/postgres-template.yml deploy/templates/postgres-manifest.yml; \
211
+ $(KUBECTL) apply -n "${MIGRATION_PLANNER_NAMESPACE}" -f deploy/templates/postgres-manifest.yml
173
212
174
213
deploy-local-obs :
175
214
@podman play kube --network host deploy/observability.yml
176
215
177
216
undeploy-local-obs :
178
217
@podman kube down deploy/observability.yml
179
218
180
- undeploy-on-openshift :
181
- oc delete route planner || true
182
- oc delete route planner-agent || true
183
- oc delete secret migration-planner-secret || true
184
- oc delete -f deploy/k8s || true
185
-
186
219
bin :
187
220
mkdir -p bin
188
221
0 commit comments