Пример #1
0
def main(args=None):
    parser = cmd.get_parser()
    args = parser.parse_args(args)

    logging.basicConfig(
        format="%(asctime)s %(levelname)s: %(message)s",
        level=logging.DEBUG if args.debug else logging.INFO,
    )

    config_str = ", ".join(f"{k}={v}" for k, v in sorted(vars(args).items()))
    logger.info(f"Downscaler v{__version__} started with {config_str}")

    if args.dry_run:
        logger.info("**DRY-RUN**: no downscaling will be performed!")

    return run_loop(
        args.once,
        args.namespace,
        args.include_resources,
        args.upscale_period,
        args.downscale_period,
        args.default_uptime,
        args.default_downtime,
        args.exclude_namespaces,
        args.exclude_deployments,
        args.exclude_statefulsets,
        args.exclude_cronjobs,
        args.grace_period,
        args.interval,
        args.dry_run,
        args.downtime_replicas,
        args.deployment_time_annotation,
    )
Пример #2
0
def main(args=None):
    parser = cmd.get_parser()
    args = parser.parse_args(args)

    logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
                        level=logging.DEBUG if args.debug else logging.INFO)

    config_str = ', '.join(f'{k}={v}' for k, v in sorted(vars(args).items()))
    logger.info(f'Downscaler v{__version__} started with {config_str}')

    if args.dry_run:
        logger.info('**DRY-RUN**: no downscaling will be performed!')

    return run_loop(args.once, args.namespace, args.kind, args.default_uptime, args.default_downtime,
                    args.exclude_namespaces, args.exclude_deployments, args.exclude_statefulsets, args.grace_period,
                    args.interval, args.dry_run, args.downtime_replicas)
Пример #3
0
def main():
    parser = cmd.get_parser()
    args = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
                        level=logging.DEBUG if args.debug else logging.INFO)

    logger.info(f'Downscaler v{__version__} started with config {args}')

    if args.dry_run:
        logger.info('**DRY-RUN**: no downscaling will be performed!')

    return run_loop(args.once, args.namespace, args.kind, args.default_uptime,
                    args.default_downtime, args.exclude_namespaces,
                    args.exclude_deployments, args.exclude_statefulsets,
                    args.grace_period, args.interval, args.dry_run)
Пример #4
0
def test_parse_args():
    parser = get_parser()
    config = parser.parse_args(["--dry-run"])

    assert config.dry_run