Commit ca8b7788 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Remove dependence on flask restful.

parent 0f203b73
Pipeline #34262 passed with stages
in 1 minute and 23 seconds
from flask_restful import Resource
from flask import request as flaskRequest
import json
import subprocess
from re import match
from os import environ, listdir, path, getenv
from re import match
from shutil import rmtree
from tempfile import mkdtemp
from flask import request as flaskRequest
from flask.views import MethodView
from import app
class AutoDeploy(Resource):
class AutoDeploy(MethodView):
def post(self):
Deploy on k8s
import logging
from os import path, environ
from flasgger import Swagger
from flask import send_from_directory, redirect
from flask.logging import default_handler
from flask_restful import Api
from kubernetes import config
from os import path, environ
import logging
from kubernetes.config import ConfigException
from import app
from autodeploy_service_app.autodeploy import AutoDeploy
# TODO : maybe take that to a configuration (development vs pod running in
# k8s cluster)
# to be used when inside a kubernetes cluster
except BaseException:
except ConfigException:
# use .kube directory
# for local development
except BaseException:
except ConfigException:
app.logger.error('No kubernetes cluster defined')
environ['HELM_EXPERIMENTAL_OCI'] = '1'
# If app is started via gunicorn
......@@ -33,8 +33,6 @@ if __name__ != '__main__':
app.logger.removeHandler(default_handler)'Starting production server')
api = Api(app)
app.config['SWAGGER'] = {
'title': 'autodeploy-service',
'version': 'dev',
......@@ -65,7 +63,7 @@ def favicon():
api.add_resource(AutoDeploy, '/v1/autodeploy')
app.add_url_rule('/v1/autodeploy', view_func=AutoDeploy.view_func)
# If app is started with Flask
if __name__ == '__main__':
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment