Exemplo n.º 1
0
 def k8s_bootup(self, args):
     cluster_config = cluster_object_model_generate_k8s(args.config_path)
     logger.info("Begin to initialize PAI k8s cluster.")
     cluster_util.maintain_cluster_k8s(cluster_config,
                                       option_name="deploy",
                                       clean=True)
     logger.info("Finish initializing PAI k8s cluster.")
Exemplo n.º 2
0
 def k8s_bootup(self, args):
     cluster_object_model_instance = cluster_object_model(args.config_path)
     com = cluster_object_model_instance.run()
     logger.info("Begin to initialize PAI k8s cluster.")
     cluster_util.maintain_cluster_k8s(com,
                                       option_name="deploy",
                                       clean=True)
     logger.info("Finish initializing PAI k8s cluster.")
Exemplo n.º 3
0
Arquivo: paictl.py Projeto: mmmika/pai
    def k8s_clean(self, args):
        # just use 'k8s-clean' for testing temporarily.
        cluster_object_model_instance = cluster_object_model(args.config_path)
        com = cluster_object_model_instance.run()
        logger.warning("--------------------------------------------------------")
        logger.warning("--------------------------------------------------------")
        logger.warning("----------     Dangerous Operation!!!    ---------------")
        logger.warning("------     Your k8s Cluster will be destroyed    -------")
        logger.warning("------     PAI service on k8s will be stopped    -------")
        logger.warning("--------------------------------------------------------")
        if args.force:
            logger.warning("--------------------------------------------------------")
            logger.warning("----------    ETCD data will be cleaned.    ------------")
            logger.warning("-----    If you wanna keep pai's user data.    ---------")
            logger.warning("-----         Please backup etcd data.         ---------")
            logger.warning("-----      And restore it after k8s-bootup     ---------")
            logger.warning("---     And restore it before deploy pai service    ----")
            logger.warning("--------------------------------------------------------")
        logger.warning("--------------------------------------------------------")
        logger.warning("----    Please ensure you wanna do this operator, ------")
        logger.warning("-------        after knowing all risk above.     -------")
        logger.warning("--------------------------------------------------------")
        logger.warning("--------------------------------------------------------")

        count_input = 0

        while True:
            user_input = raw_input("Do you want to continue this operation? (Y/N) ")
            if user_input == "N":
                return
            elif user_input == "Y":
                break
            else:
                print(" Please type Y or N.")
            count_input = count_input + 1
            if count_input == 3:
                logger.warning("3 Times.........  Sorry,  we will force stopping your operation.")
                return

        logger.info("Begin to clean up whole cluster.")
        cluster_util.maintain_cluster_k8s(com, option_name="clean", force=args.force, clean=True)
        logger.info("Clean up job finished")