Esempio 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.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']
Esempio n. 2
0
    def test_load_provisioner(self, user):
        user.save()
        provisioner = Provisioner(
            user.namespace,
            name='Manual provisioner',
            state='OK',
            engine='kqueen.engines.ManualEngine',
            parameters={},
            created_at=datetime.utcnow().replace(microsecond=0),
            owner=user)
        provisioner.save()

        loaded = Provisioner.load(user.namespace, provisioner.id)

        assert loaded.get_dict(True) == provisioner.get_dict(True)
Esempio n. 3
0
    def setup(self):
        create_kwargs_provisioner = {
            'name': 'Testing manual',
            'engine': 'kqueen.engines.ManualEngine'
        }

        prov = Provisioner(**create_kwargs_provisioner)
        prov.save(check_status=False)

        create_kwargs_cluster = {
            'name': 'Testing cluster for manual provisioner',
            'provisioner': prov,
            'state': 'deployed',
            'kubeconfig': yaml.load(open('kubeconfig_localhost', 'r').read()),
        }

        self.cluster = Cluster.create(**create_kwargs_cluster)
        self.engine = ManualEngine(cluster=self.cluster)
Esempio n. 4
0
def cluster():
    """Create cluster with manual provisioner."""
    _uuid = uuid.uuid4()

    prov = Provisioner(
        name='Fixtured provisioner',
        engine='kqueen.engines.ManualEngine',
    )
    prov.save(check_status=False)

    create_kwargs = {
        'id': _uuid,
        'name': 'Name for cluster {}'.format(_uuid),
        'provisioner': prov,
        'state': 'deployed',
        'kubeconfig': yaml.load(open('kubeconfig_localhost', 'r').read()),
    }

    return Cluster.create(**create_kwargs)
Esempio n. 5
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.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)
Esempio n. 6
0
    except:
        raise Exception('Adding admin user failed')

    # AWS + Jenkins
    try:
        provisioner = Provisioner(
            id=uuid_provisioner_jenkins,
            name='Jenkins provisioner to AWS',
            state='OK',
            engine='kqueen.engines.JenkinsEngine',
            parameters={
                'username': '******',
                'password': '******'
            }
        )
        provisioner.save(check_status=False)
    except:
        raise Exception('Adding AWS provisioner failed')


    try:
        cluster = Cluster(
            id=uuid_jenkins,
            name='AWS Calico SM 33',
            state='OK',
            provisioner=provisioner,
            kubeconfig=yaml.load(requests.get(kubeconfig_url).text),
        )
        cluster.save()
    except:
        raise Exception('Adding AWS cluster failed')