) sub.set_defaults(func=lambda args: load_secret('sendgrid', args)) sub = subparsers.add_parser( 'load-zendesk', help='load the zendesk password into k8s from disk', formatter_class=argparse.ArgumentDefaultsHelpFormatter) sub.add_argument( 'path', type=str, help= 'path to directory that contains the password in a file named "zendesk"' ) sub.set_defaults(func=lambda args: load_secret('zendesk', args)) util.add_deployment_parsers(NAME, subparsers, default_container='smc-hub') sub = subparsers.add_parser( 'status', help= 'display status info about concurrent and blocked, based on recent logs' ) sub.add_argument("-t", "--tail", default=100, type=int, help="how far back to go in log") sub.set_defaults(func=status) args = parser.parse_args() if hasattr(args, 'func'):
"--rebuild", action="store_true", help="rebuild from scratch") sub.add_argument( "-l", "--local", action="store_true", help="only build the image locally; don't push it to gcloud docker repo" ) sub.set_defaults(func=build_docker) sub = subparsers.add_parser( 'run', help='run the deployment', formatter_class=argparse.ArgumentDefaultsHelpFormatter) sub.add_argument("-t", "--tag", default="", help="tag of the image to run") sub.add_argument("-f", "--force", action="store_true", help="force re-download image in k8s") sub.set_defaults(func=run_on_kubernetes) sub = subparsers.add_parser('delete', help='kill the deployment') sub.set_defaults(func=delete) util.add_deployment_parsers(NAME, subparsers) args = parser.parse_args() if hasattr(args, 'func'): args.func(args)
def stop_on_kubernetes(args): util.stop_deployment(NAME) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(description='Control deployment of {name}'.format(name=NAME)) subparsers = parser.add_subparsers(help='sub-command help') sub = subparsers.add_parser('build', help='build docker image') sub.add_argument("-t", "--tag", default="", help="tag for this build") sub.add_argument("-r", "--rebuild", action="store_true", help="update to latest version of SMC from master") sub.add_argument("-c", "--commit", default='', help="build a particular sha1 commit; the commit is automatically appended to the tag") sub.add_argument("--rebuild_all", action="store_true", help="rebuild everything including base image") sub.add_argument("-l", "--local", action="store_true", help="only build the image locally; don't push it to gcloud docker repo") sub.set_defaults(func=build_docker) sub = subparsers.add_parser('run', help='create/update {name} deployment on the currently selected kubernetes cluster; you must also call "build -p" to push an image'.format(name=NAME)) sub.add_argument("-t", "--tag", default="", help="tag of the image to run (default: most recent tag)") sub.add_argument("-r", "--replicas", default=None, help="number of replicas") sub.add_argument("-f", "--force", action="store_true", help="force reload image in k8s") sub.set_defaults(func=run_on_kubernetes) sub = subparsers.add_parser('delete', help='delete the deployment') sub.set_defaults(func=stop_on_kubernetes) util.add_deployment_parsers(NAME, subparsers) args = parser.parse_args() args.func(args)
def label_preemptible_nodes(): def cmd(s): return util.run(s, verbose=False, get_output=True) shared.label_preemptible_nodes(cmd) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(description='Control deployment of {name}'.format(name=NAME)) subparsers = parser.add_subparsers(help='sub-command help') sub = subparsers.add_parser('build', help='build docker image') sub.add_argument("-t", "--tag", required=True, help="tag for this build") sub.add_argument("-r", "--rebuild", action="store_true", help="rebuild from scratch") sub.add_argument("-l", "--local", action="store_true", help="only build the image locally; don't push it to gcloud docker repo") sub.set_defaults(func=build_docker) sub = subparsers.add_parser('run', help='run the deployment', formatter_class=argparse.ArgumentDefaultsHelpFormatter) sub.add_argument("-t", "--tag", default="", help="tag of the image to run") sub.add_argument("-f", "--force", action="store_true", help="force re-download image in k8s") sub.set_defaults(func=run_on_kubernetes) sub = subparsers.add_parser('delete', help='kill the deployment') sub.set_defaults(func=delete) util.add_deployment_parsers(NAME, subparsers, exclude='autoscale') args = parser.parse_args() if hasattr(args, 'func'): args.func(args)
help="how gentle to be in doing the rolling update; in particular, will wait about this many seconds after each pod starts up (default: 30)") sub.add_argument("-d", "--database-nodes", default='localhost', type=str, help="database to connect to. If 'localhost' (the default), will run a local rethindkb proxy that is itself pointed at the rethinkdb-cluster service; if 'rethinkdb-proxy' will use that service.") sub.add_argument("-p", "--database-pool-size", default=50, type=int, help="size of database connection pool") sub.add_argument("--database-concurrent-warn", default=300, type=int, help="if this many concurrent queries for sustained time, kill container") sub.add_argument("--rethinkdb-proxy-tag", default="", help="tag of rethinkdb-proxy image to run") sub.add_argument("--test", action="store_true", help="using for testing so make very minimal resource requirements") sub.set_defaults(func=run_on_kubernetes) sub = subparsers.add_parser('delete', help='delete the deployment') sub.set_defaults(func=stop_on_kubernetes) sub = subparsers.add_parser('load-sendgrid', help='load the sendgrid password into k8s from disk', formatter_class=argparse.ArgumentDefaultsHelpFormatter) sub.add_argument('path', type=str, help='path to directory that contains the password in a file named "sendgrid"') sub.set_defaults(func=lambda args: load_secret('sendgrid',args)) sub = subparsers.add_parser('load-zendesk', help='load the zendesk password into k8s from disk', formatter_class=argparse.ArgumentDefaultsHelpFormatter) sub.add_argument('path', type=str, help='path to directory that contains the password in a file named "zendesk"') sub.set_defaults(func=lambda args: load_secret('zendesk',args)) util.add_deployment_parsers(NAME, subparsers, default_container='smc-hub') sub = subparsers.add_parser('status', help='display status info about concurrent and blocked, based on recent logs') sub.add_argument("-t", "--tail", default=100, type=int, help="how far back to go in log") sub.set_defaults(func=status) args = parser.parse_args() if hasattr(args, 'func'): args.func(args)