Open joapedu opened 1 month ago
o app.py
, por ser o arquivo principal do projeto deve ficar assim:
from flask import Flask
from monitor.pod_monitor import expose_metrics
from deployments.deploy_operations import create_deployment, scale_up, scale_down
from scale.autoscaler import monitor_and_scale
app = Flask(__name__)
@app.route("/status", methods=['GET'])
def status():
return expose_metrics()
@app.route("/scale-up", methods=['POST'])
def scale_up_pods():
return scale_up()
@app.route("/scale-down", methods=['POST'])
def scale_down_pods():
return scale_down()
@app.route("/deploy", methods=['POST'])
def create_deploy():
return create_deployment()
if __name__ == "__main__":
app.run(debug=True)
seguindo as boas práticas do Flask Framework devemos refatorar para esquematizar da seguinte forma: