Exemple #1
0
def get_arg_parser():
    """Create the parser for the command-line args."""
    parser = configargparse.getArgumentParser()
    parser.add_argument("--longhelp",
                        help="Print out configuration details",
                        action="store_true")
    parser.add_argument("--marathon",
                        "-m",
                        nargs="+",
                        env_var='MARATHON_URL',
                        help="[required] Marathon endpoint, eg. -m " +
                        "http://marathon1:8080 http://marathon2:8080")
    parser.add_argument("--hostname",
                        env_var='F5_CC_BIGIP_HOSTNAME',
                        help="F5 BIG-IP hostname")
    parser.add_argument("--username",
                        env_var='F5_CC_BIGIP_USERNAME',
                        help="F5 BIG-IP username")
    parser.add_argument("--password",
                        env_var='F5_CC_BIGIP_PASSWORD',
                        help="F5 BIG-IP password")
    parser.add_argument("--partition",
                        env_var='F5_CC_PARTITIONS',
                        help="[required] Only generate config for apps which"
                        " match the specified partition."
                        " Can use this arg multiple times to"
                        " specify multiple partitions",
                        action="append",
                        default=list())
    parser.add_argument("--health-check",
                        "-H",
                        env_var='F5_CC_USE_HEALTHCHECK',
                        help="If set, respect Marathon's health check "
                        "statuses before adding the app instance into "
                        "the backend pool.",
                        action="store_true")
    parser.add_argument("--marathon-ca-cert",
                        env_var='F5_CC_MARATHON_CA_CERT',
                        help="CA certificate for Marathon HTTPS connections")
    parser.add_argument('--sse-timeout',
                        "-t",
                        type=int,
                        env_var='F5_CC_SSE_TIMEOUT',
                        default=30,
                        help='Marathon event stream timeout')
    parser.add_argument('--verify-interval',
                        "-v",
                        type=int,
                        env_var='F5_CC_VERIFY_INTERVAL',
                        default=30,
                        help="Interval at which to verify "
                        "the BIG-IP configuration.")
    parser.add_argument("--version",
                        help="Print out version information and exit",
                        action="store_true")

    parser = set_logging_args(parser)
    parser = set_marathon_auth_args(parser)
    return parser
Exemple #2
0
def get_arg_parser():
    parser = argparse.ArgumentParser(
        description="Zero-downtime deployment orchestrator for marathon-lb",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--longhelp",
                        help="Print out configuration details",
                        action="store_true")
    parser.add_argument("--marathon",
                        "-m",
                        help="[required] Marathon endpoint, eg. -m " +
                        "http://marathon1:8080")
    parser.add_argument("--marathon-lb",
                        "-l",
                        help="[required] Marathon-lb stats endpoint, eg. -l " +
                        "http://marathon-lb.marathon.mesos:9090")

    parser.add_argument("--json", "-j", help="[required] App JSON")
    parser.add_argument("--dry-run",
                        "-d",
                        help="Perform a dry run",
                        action="store_true")
    parser.add_argument("--force",
                        "-f",
                        help="Perform deployment un-prompted",
                        action="store_true")
    parser.add_argument("--step-delay",
                        "-s",
                        help="Delay (in seconds) between each successive"
                        " deployment step",
                        type=int,
                        default=5)
    parser.add_argument("--initial-instances",
                        "-i",
                        help="Initial number of app instances to launch."
                        " If this number is greater than total number of"
                        " existing instances, then this will be overridden"
                        " by the latter number",
                        type=int,
                        default=1)
    parser.add_argument("--linear-increase",
                        help="Instead of scaling the new app by factor 0.5 if"
                        " its existing instances and going to the new target"
                        " in a single final step if it meets or surpasses the"
                        " number of old instances, continously scale the new"
                        " app by this number.",
                        type=int,
                        default=0)
    parser.add_argument("--resume",
                        "-r",
                        help="Resume from a previous deployment",
                        action="store_true")
    parser.add_argument("--max-wait",
                        "-w",
                        help="Maximum amount of time (in seconds) to wait"
                        " for HAProxy to drain connections",
                        type=int,
                        default=300)
    parser.add_argument("--new-instances",
                        "-n",
                        help="Number of new instances to replace the existing"
                        " instances. This is for having instances of both blue"
                        " and green at the same time",
                        type=int,
                        default=0)
    parser.add_argument("--complete-cur",
                        "-c",
                        help="Change hybrid app entirely to"
                        " current (new) app's instances",
                        action="store_true")
    parser.add_argument("--complete-prev",
                        "-p",
                        help="Change hybrid app entirely to"
                        " previous (old) app's instances",
                        action="store_true")
    parser.add_argument("--pre-kill-hook",
                        help="A path to an executable (such as a script) "
                        "which will be called before killing any tasks marked "
                        "for draining at each step. The script will be called "
                        "with 3 arguments (in JSON): the old app definition, "
                        "the list of tasks which will be killed, "
                        "and the new app definition. An exit "
                        "code of 0 indicates the deploy may continue. "
                        "If the hook returns a non-zero exit code, the deploy "
                        "will stop, and an operator must intervene.")
    parser = set_logging_args(parser)
    parser = set_marathon_auth_args(parser)
    return parser
Exemple #3
0
def get_arg_parser():
    parser = argparse.ArgumentParser(
        description="Zero-downtime deployment orchestrator for marathon-lb",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--longhelp",
                        help="Print out configuration details",
                        action="store_true"
                        )
    parser.add_argument("--marathon", "-m",
                        help="[required] Marathon endpoint, eg. -m " +
                             "http://marathon1:8080"
                        )
    parser.add_argument("--marathon-lb", "-l",
                        help="[required] Marathon-lb stats endpoint, eg. -l " +
                             "http://marathon-lb.marathon.mesos:9090"
                        )

    parser.add_argument("--json", "-j",
                        help="[required] App JSON"
                        )
    parser.add_argument("--dry-run", "-d",
                        help="Perform a dry run",
                        action="store_true"
                        )
    parser.add_argument("--force", "-f",
                        help="Perform deployment un-prompted",
                        action="store_true"
                        )
    parser.add_argument("--step-delay", "-s",
                        help="Delay (in seconds) between each successive"
                        " deployment step",
                        type=int, default=5
                        )
    parser.add_argument("--initial-instances", "-i",
                        help="Initial number of app instances to launch."
                        " If this number is greater than total number of"
                        " existing instances, then this will be overridden"
                        " by the latter number",
                        type=int, default=1
                        )
    parser.add_argument("--resume", "-r",
                        help="Resume from a previous deployment",
                        action="store_true"
                        )
    parser.add_argument("--max-wait", "-w",
                        help="Maximum amount of time (in seconds) to wait"
                        " for HAProxy to drain connections",
                        type=int, default=300
                        )
    parser.add_argument("--new-instances", "-n",
                        help="Number of new instances to replace the existing"
                        " instances. This is for having instances of both blue"
                        " and green at the same time",
                        type=int, default=0)
    parser.add_argument("--complete-cur", "-c",
                        help="Change hybrid app entirely to"
                        " current (new) app's instances", action="store_true")
    parser.add_argument("--complete-prev", "-p",
                        help="Change hybrid app entirely to"
                        " previous (old) app's instances", action="store_true")
    parser.add_argument("--pre-kill-hook",
                        help="A path to an executable (such as a script) "
                        "which will be called before killing any tasks marked "
                        "for draining at each step. The script will be called "
                        "with 3 arguments (in JSON): the old app definition, "
                        "the list of tasks which will be killed, "
                        "and the new app definition. An exit "
                        "code of 0 indicates the deploy may continue. "
                        "If the hook returns a non-zero exit code, the deploy "
                        "will stop, and an operator must intervene."
                        )
    parser = set_logging_args(parser)
    parser = set_marathon_auth_args(parser)
    return parser