Ejemplo n.º 1
0
    def setup(self):
        _user = user()
        create_kwargs_provisioner = {
            'name': 'Testing manual',
            'engine': 'kqueen.engines.ManualEngine',
            'parameters': PROVISIONER_PARAMETERS,
            'owner': _user
        }

        prov = Provisioner(_user.namespace, **create_kwargs_provisioner)
        prov.state = config.get('PROVISIONER_OK_STATE')
        prov.save(check_status=False)

        self.create_kwargs_cluster = {
            'name': 'Testing cluster for manual provisioner',
            'provisioner': prov,
            'state': 'deployed',
            'kubeconfig': KUBECONFIG,
            'metadata': CLUSTER_METADATA,
            'owner': _user
        }

        self.cluster = Cluster.create(_user.namespace, **self.create_kwargs_cluster)
        self.engine = ManualEngine(cluster=self.cluster)

        # client setup
        self.auth_header = auth_header(self.client)
        self.namespace = self.auth_header['X-Test-Namespace']
Ejemplo n.º 2
0
def cluster():
    """Create cluster with manual provisioner."""
    _uuid = uuid.uuid4()
    _user = user()

    prov = Provisioner(_user.namespace,
                       name='Fixtured provisioner',
                       engine='kqueen.engines.ManualEngine',
                       owner=_user)
    prov.state = config.get('PROVISIONER_OK_STATE')
    prov.save(check_status=False)

    create_kwargs = {
        'id': _uuid,
        'name': 'Name for cluster {}'.format(_uuid),
        'provisioner': prov,
        'state': config.get('CLUSTER_UNKNOWN_STATE'),
        'kubeconfig': yaml.load(open('kubeconfig_localhost', 'r').read()),
        'created_at': datetime.datetime.utcnow().replace(microsecond=0),
        'owner': _user
    }

    return Cluster.create(_user.namespace, **create_kwargs)