Exemplo n.º 1
0
def main() -> None:
    args = parse_args()
    soa_dir = args.soa_dir
    if args.verbose:
        logging.basicConfig(level=logging.DEBUG)
    else:
        # filter out unwanted zookeeper messages in the log
        logging.getLogger("kazoo").setLevel(logging.WARN)
        logging.basicConfig(level=logging.INFO)

    deploy_metrics = metrics_lib.get_metrics_interface("paasta")

    # system_paasta_config = load_system_paasta_config()
    kube_client = KubeClient()

    ensure_namespace(kube_client, namespace="paasta")
    setup_kube_succeeded = setup_kube_deployments(
        kube_client=kube_client,
        service_instances=args.service_instance_list,
        soa_dir=soa_dir,
        cluster=args.cluster or load_system_paasta_config().get_cluster(),
        rate_limit=args.rate_limit,
        metrics_interface=deploy_metrics,
    )
    sys.exit(0 if setup_kube_succeeded else 1)
Exemplo n.º 2
0
 def startup(self):
     self.is_leader = True
     self.log.info("This node is elected as leader {}".format(
         socket.getfqdn()))
     self.metrics = get_metrics_interface('paasta.deployd')
     leader_counter = self.metrics.create_counter(
         "leader_elections", paasta_cluster=self.config.get_cluster())
     leader_counter.count()
     QueueMetrics(
         self.inbox,
         self.instances_that_need_to_be_bounced_asap,
         self.config.get_cluster(),
         self.metrics,
     ).start()
     self.inbox.start()
     self.log.info("Starting all watcher threads")
     self.start_watchers()
     self.log.info(
         "All watchers started, now adding all services for initial bounce")
     self.add_all_services()
     self.log.info("Prioritising services that we know need a bounce...")
     if self.config.get_deployd_startup_oracle_enabled():
         self.prioritise_bouncing_services()
     self.log.info("Starting worker threads")
     self.start_workers()
     self.started = True
     self.log.info("Startup finished!")
     self.main_loop()
 def __init__(self) -> None:
     super().__init__()
     self.started = False
     self.daemon = True
     service_configuration_lib.disable_yaml_cache()
     self.config = load_system_paasta_config()
     self.setup_logging()
     self.metrics = get_metrics_interface("paasta.deployd")
     self.setup_instances_to_bounce()
     self.control = PaastaQueue("ControlQueue")
     self.marathon_clients = get_marathon_clients_from_config()