Exemplo n.º 1
0
#-*- coding: utf-8 -*-
from flask import Blueprint, request, jsonify
from Modules import loging, tools, k8s_resource, db_op, produce
from flask import Flask
import time
from sqlalchemy import and_
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_pyfile('../conf/sql.conf')
DB = SQLAlchemy(app)
app.config.from_pyfile('../conf/redis.conf')
app.config.from_pyfile('../conf/docker.conf')
logging = loging.Error()
docke_registry = app.config.get('REGISTRY')
config, contexts, config_file = tools.k8s_conf()
config.load_kube_config(config_file, context=contexts[0])
page_deployment_deploy = Blueprint('deployment_deploy', __name__)


@page_deployment_deploy.route('/deployment_update', methods=['POST'])
def deployment_update():
    db_token = db_op.platform_token
    params = request.json
    new_replicas = None
    msg = "image build fail!"
    try:
        if params:
            if 'project' in params and 'version' in params and 'access_token' in params:
                token = params['access_token']
                project = params['project']
                version = params['version']
Exemplo n.º 2
0
class Form_k8s_contexts(Form):
    _, contexts, _ = tools.k8s_conf()
    select = SelectField(choices=[(context, context) for context in contexts],
                         id='contexts')