Add fetching of qe deployments in config tool
This commit is contained in:
parent
2c61c87712
commit
3d4e43c8d1
24 changed files with 484 additions and 18 deletions
|
@ -3,9 +3,10 @@ import logging
|
|||
from flask import abort, request
|
||||
|
||||
from config_app.config_endpoints.api.suconfig_models_pre_oci import pre_oci_model as model
|
||||
from config_app.config_endpoints.api import resource, ApiResource, nickname, validate_json_request
|
||||
from config_app.config_endpoints.api import resource, ApiResource, nickname, validate_json_request, kubernetes_only
|
||||
from config_app.c_app import (app, config_provider, superusers, ip_resolver,
|
||||
instance_keys, INIT_SCRIPTS_LOCATION)
|
||||
instance_keys, INIT_SCRIPTS_LOCATION, IS_KUBERNETES)
|
||||
from config_app.config_util.k8sinterface import KubernetesAccessInterface
|
||||
|
||||
from data.database import configure
|
||||
from data.runmigration import run_alembic_migration
|
||||
|
@ -259,6 +260,24 @@ class SuperUserConfigValidate(ApiResource):
|
|||
return validate_service_for_config(service, validator_context)
|
||||
|
||||
|
||||
@resource('/v1/kubernetes/deployments/')
|
||||
class SuperUserKubernetesDeployment(ApiResource):
|
||||
""" Resource for fetching the status of config files and overriding them. """
|
||||
@kubernetes_only
|
||||
@nickname('scGetNumDeployments')
|
||||
def get(self):
|
||||
accessor = KubernetesAccessInterface()
|
||||
res = accessor.get_num_qe_pods()
|
||||
return res
|
||||
|
||||
@resource('/v1/superuser/config/kubernetes')
|
||||
class SuperUserKubernetesConfiguration(ApiResource):
|
||||
""" Resource for fetching the status of config files and overriding them. """
|
||||
@kubernetes_only
|
||||
@nickname('scSaveConfigToKube')
|
||||
def post(self):
|
||||
return config_provider.save_configuration_to_kubernetes()
|
||||
|
||||
|
||||
@resource('/v1/superuser/config/file/<filename>')
|
||||
class SuperUserConfigFile(ApiResource):
|
||||
|
|
Reference in a new issue