diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c85d595b379a33bb8fa7ff52b2251b1ba1e752b..21d4de943f58b7a5145038c8c48dd0be456819af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.3.0] 2025-01-16 +### Added +- /liveness, /readiness endpoints +### Changed +- js code clean-up +- improve guidance text + ## [1.2.4] 2025-01-16 ### Fixed - summary after migration is listed and improved diff --git a/app/app.py b/app/app.py index 938d0977566dac1bdcd3657cfc6226e501f3a239..40143b33865ae831a1fbc4b5847977812de1b65f 100644 --- a/app/app.py +++ b/app/app.py @@ -1,4 +1,4 @@ -from flask import Flask, request, render_template, redirect, url_for, g, session +from flask import Flask, request, render_template, redirect, url_for, g, session, jsonify from datetime import datetime from models.box import Box from models.box_item import BoxItem @@ -86,21 +86,21 @@ def index(): for cloud testing and exploration purposes</a> only. <BR> We believe just fraction of personal projects actually <strong>need to be migrated</strong>. - This website helps you with the actual cloud migration. + This website helps you with the cloud workload migration. <BR> - Website uses external migration job processing executed in MU ICS Gitlab and enforces that only + Website uses external migration job processing executed in MU ICS Gitlab CI and enforces that only one migration can be executing at the time. - This is why your migration may wait in the CI queue log time before actually starting. + This is why your migration may wait in the CI queue long time before actually starting. <BR> - Please log on both clouds before continuing. + Please log on the both clouds before migration. You should identify in <a href="https://cloud.metacentrum.cz/" target="_blank" rel="noopener noreferrer"> G1 Metacentrum OpenStack cloud</a> what cloud resources need to be migrated and <a href="https://brno.openstack.cloud.e-infra.cz" target="_blank" rel="noopener noreferrer"> G2 Metacentrum OpenStack cloud</a> needs to be visited for automatic creation of your personal project. <BR> - After cloud migration, <strong>cloud user is responsible for deletion of the + After cloud workload migration, <strong>cloud user is responsible for deletion of the <a href="https://cloud.metacentrum.cz/" target="_blank" rel="noopener noreferrer">G1 Metacentrum OpenStack cloud</a> - project resources</strong>. Not released G1 cloud resources may be automatically removed 7 days after migration. + project resources</strong>. Not removed G1 cloud resources are monitored and may be automatically removed 7 days after migration. <BR> ''' for box in boxes: @@ -201,6 +201,17 @@ def get_pipeline_status(): gitlab_pipeline_status_data = gitlab_pipeline_status.json() return gitlab_pipeline_status_data['status'] +# Liveness endpoint: Checks if the application is alive +@app.route('/liveness', methods=['GET']) +def liveness(): + return jsonify({"status": "alive"}), 200 + +# Readiness endpoint: Checks if the application is functional +# atm /readiness logic does not call dependent services as it is considered heavy +@app.route('/readiness', methods=['GET']) +def readiness(): + return jsonify({"status": "ready"}), 200 + if __name__ == '__main__': # Optionally, configure the host and port app.run(debug=True) # Use debug=True for debugging during development diff --git a/app/static/js/migration.js b/app/static/js/migration.js index ae91865a14bab542572fc3ef6414eec77be352d3..384d2eeae9f5f693c7471aade9ea32aec366d5dc 100644 --- a/app/static/js/migration.js +++ b/app/static/js/migration.js @@ -3,14 +3,13 @@ url: '/api/pipeline-status', method: 'GET', success: function(data) { - //console.log("Fetched data: ", data); - //console.log("general-status-message: ", $('#general-status-message')); // Update the HTML content with the received data if($('.migration_box').last().find('input').val() != data){ $('.migration_box').children().last().find('input').val(data) } + // Show summary message if(data === 'success'){ - $('#general-status-message').text("Cloud migration pipeline has successfully finished. Evaluate functionality of (G2) migrated cloud resources and remove original (G1) cloud resources"); + $('#general-status-message').text("Cloud migration pipeline has successfully finished. Confirm functionality of (G2) migrated cloud resources and remove original (G1) cloud resources."); $('#general-status-message').show(); } else if(data === 'failed'){ $('#general-status-message').text("Cloud migration pipeline failed. Inspect logs of the CI Gitlab pipeline and re-run or contact us at cloud@metacentrum.cz. Re-running the cloud migrations may require new browser anonymous window." ); diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml index 24d65d836e9ca6f12b1ccbab1d42e1636beed501..d85e3a22a451478b5674cba73600c6ab7cfd862e 100644 --- a/kubernetes/deployment.yaml +++ b/kubernetes/deployment.yaml @@ -18,27 +18,40 @@ spec: containers: - name: cloud-migrations image: registry.gitlab.ics.muni.cz:443/cloud/cloud-migrations:latest - - env: - - name: CM_GUNICORN_LOGLEVEL - value: INFO - - name: CM_GUNICORN_ARGS - value: "" - - name: CM_GITLAB_PROJECT_ID - value: "0" - - name: CM_GITLAB_PROJECT_TOKEN - valueFrom: - secretKeyRef: - key: CM_GITLAB_PROJECT_TOKEN - name: cloud-migrations - - name: CM_OSTACK_SRC_OPENRC - valueFrom: - secretKeyRef: - key: CM_OSTACK_SRC_OPENRC - name: cloud-migrations - - name: CM_OSTACK_DST_OPENRC - valueFrom: - secretKeyRef: - key: CM_OSTACK_DST_OPENRC - name: cloud-migrations ports: - - containerPort: 8080 + - containerPort: &container_port 8080 + livenessProbe: + httpGet: + path: /liveness + port: *container_port + initialDelaySeconds: 5 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /readiness + port: *container_port + initialDelaySeconds: 10 + timeoutSeconds: 5 + - env: + - name: CM_GUNICORN_LOGLEVEL + value: INFO + - name: CM_GUNICORN_ARGS + value: "" + - name: CM_GITLAB_PROJECT_ID + value: "0" + - name: CM_GITLAB_PROJECT_TOKEN + valueFrom: + secretKeyRef: + key: CM_GITLAB_PROJECT_TOKEN + name: cloud-migrations + - name: CM_OSTACK_SRC_OPENRC + valueFrom: + secretKeyRef: + key: CM_OSTACK_SRC_OPENRC + name: cloud-migrations + - name: CM_OSTACK_DST_OPENRC + valueFrom: + secretKeyRef: + key: CM_OSTACK_DST_OPENRC + name: cloud-migrations +