Ejemplo n.º 1
0
from collections import OrderedDict
from flask_babel import format_datetime
from kqueen_ui.api import get_kqueen_client
from kqueen_ui.config import current_config

try:
    from secrets import choice
except ImportError:
    from random import choice

import string

config = current_config()


def status_for_cluster_detail(_status):
    status = {}
    podcount = 0
    images = []

    _persistent_volumes = {}
    if 'persistent_volumes' in _status:
        for pv in _status['persistent_volumes']:
            pv_storage_class = pv['spec'].pop('storage_class_name', '-')
            pv_host_path = pv['spec'].pop('host_path', '-')
            pv_capacity = pv['spec'].pop('capacity', {}).get('storage', '-')
            pv_access_modes = ', '.join(pv['spec'].pop('access_modes', []))
            pv_reclaim_policy = pv['spec'].pop(
                'persistent_volume_reclaim_policy', '-')
            pv_claim_ref = pv['spec'].pop('claim_ref', {})
            # deduce storage driver from the remaining spec keys
Ejemplo n.º 2
0
from collections import OrderedDict
from flask import request
from kqueen_ui.api import get_kqueen_client
from kqueen_ui.auth import is_authorized
from kqueen_ui.config import current_config
from urllib.parse import urlsplit

config = current_config().to_dict()

CLUSTER_STATE_MAP = {
    config['CLUSTER_OK_STATE']: 'mdi-cloud-check',
    config['CLUSTER_ERROR_STATE']: 'mdi-cloud-off-outline',
    config['CLUSTER_PROVISIONING_STATE']: 'loading-icon',
    config['CLUSTER_DEPROVISIONING_STATE']: 'mdi-cloud-sync',
    config['CLUSTER_RESIZING_STATE']: 'loading-icon',
    config['CLUSTER_UNKNOWN_STATE']: 'mdi-alert-outline'
}

PROVISIONER_STATE_MAP = {
    config['PROVISIONER_OK_STATE']: 'mdi-checkbox-marked-circle-outline',
    config['PROVISIONER_ERROR_STATE']: 'mdi-close-circle-outline',
    config['PROVISIONER_UNKNOWN_STATE']: 'mdi-alert-circle-outline'
}

USER_STATE_MAP = {
    'Active': 'mdi-checkbox-marked-circle-outline',
    'Disabled': 'mdi-close-circle-outline'
}


def cluster_status_icon(status):