Esempio n. 1
0
 def test_1(self):
     """
     Tests simple application create and delete
     """
     a1 = Application("testapp")
     a1.create()
     a1.delete()
Esempio n. 2
0
    def start(self):
        """
        Bring up platform using "platform-start.cfg" configuration from manifest directory
        :return:
        """
        # Generate kube-objects
        steps = self._config.steps
        self._load_kube_objects_from_steps(steps)

        if not self._cluster_config.get_cluster_provider().is_user_cluster():
            self._replacing = self._generate_replacing()
        else:
            self._replacing = self._generate_replacing_for_user_provisioned_cluster(
            )

        os.environ["AX_CLUSTER_NAME_ID"] = self._cluster_name_id
        logger.debug("Replacing ENVs: %s", self._replacing)

        # TODO: remove component's dependencies to AXOPS_EXT_DNS env (#32)
        # At this moment, we MUST separate first step due to the above dependency
        assert len(steps) >= 2, "Should have at least 1 step to create axops"
        self.create_objects(steps[0])
        self.create_objects(steps[1])
        self.create_objects(steps[2])

        # Prepare axops_eip
        if self._cluster_config.get_provider() not in ["minikube"]:
            self._set_ext_dns()

        info_bound = "=======================================================\n"
        img_namespace = "Image Namespace: {}\n".format(
            self._software_info.image_namespace)
        img_version = "Image Version: {}\n".format(
            self._software_info.image_version)
        start_info = "\n\n{}{}{}{}{}".format(
            info_bound, "Platform Up: Bringing up Argo services...\n",
            img_namespace, img_version, info_bound)
        logger.info(start_info)

        # Start rest of the objects
        for i in range(3, len(steps)):
            self.create_objects(steps[i])

        # update application namespace
        logger.info("Updating application managers")
        for app in Applications(client=self.kubectl).list():
            logger.info("--- updating {}".format(app))
            a = Application(app, client=self.kubectl)
            a.create(force_recreate=True)
        logger.info("Done updating application managers")

        # Upload version information to target cluster
        self._update_version()
        logger.info("\n\n%sCluster %s is up. Cluster is available at %s%s\n",
                    COLOR_GREEN, self._cluster_name_id, self.cluster_dns_name,
                    COLOR_NORM)
Esempio n. 3
0
 def test_2(self):
     """
     Test assertion when application name exists
     """
     a1 = Application("testapp")
     a2 = Application("testapp")
     a1.create()
     with self.assertRaises(AXKubeApiException):
         a2.create()
     a1.delete()
Esempio n. 4
0
File: rest.py Progetto: nuaays/argo
def axmon_application_create():
    """
    Create an application. If the application name already exists then
    this call will do nothing but also not report an exception. To find
    out if the application exists and its status, use the GET method.
    The body of the post must pass a dict with the following format:
    { 'name': 'somename' }
    The name value must be a DNS compatible name
    Returns:
        A json dict on success in the following format
        { 'result': 'ok' }
    """
    (applicationname, ) = _get_required_arguments('name')
    application = Application(applicationname)
    application.create()
    return jsonify(result="ok")