Ejemplo n.º 1
0
def get_config():  # noqa: E501
    """
    Gets the config for logging in into accounts

    :rtype: json
        {
            'url': '',
            'realm': '',
            'clientId': ''
        }
    """
    accounts_app = applications.get_configuration('accounts')
    return {
        'url': urljoin(accounts_app.get_public_address(), 'auth'),
        'realm': CloudharnessConfig.get_namespace(),
        'clientId': accounts_app['webclient']['id']
    }
Ejemplo n.º 2
0
import kubernetes

import yaml
import os
from pathlib import Path

from cloudharness import log

# TODO handle group

version = 'v1alpha1'

# determine the namespace of the current app and run the workflow in that namespace
from cloudharness.utils.config import CloudharnessConfig as conf

namespace = conf.get_namespace()


# --- Api functions ---    `

def get_api_client():
    configuration = get_configuration()
    api_instance = kubernetes.client.CoreV1Api(kubernetes.client.ApiClient(get_configuration()))
    return api_instance


def get_configuration():
    try:
        configuration = kubernetes.config.load_incluster_config()
    except:
        log.warning('Kubernetes cluster configuration not found. Trying local configuration')
Ejemplo n.º 3
0
def get_auth_realm():
    return conf.get_namespace()