Example #1
0
    def Args(parser):
        """Register flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
          to capture some information, but behaves like an ArgumentParser.
    """
        flags.AddNodePoolClusterFlag(parser, 'The name of the cluster.')
Example #2
0
def _Args(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
  """
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to create.')
    flags.AddNodePoolClusterFlag(parser,
                                 'The cluster to add the node pool to.')
    # Timeout in seconds for operation
    parser.add_argument('--timeout',
                        type=int,
                        default=1800,
                        hidden=True,
                        help='THIS ARGUMENT NEEDS HELP TEXT.')
    parser.add_argument(
        '--num-nodes',
        type=int,
        help='The number of nodes in the node pool in each of the '
        'cluster\'s zones.',
        default=3)
    parser.add_argument(
        '--machine-type',
        '-m',
        help='The type of machine to use for nodes. Defaults to n1-standard-1')
    parser.add_argument(
        '--disk-size',
        type=int,
        help='Size in GB for node VM boot disks. Defaults to 100GB.')
    flags.AddImageTypeFlag(parser, 'node pool')
    flags.AddImageFlag(parser, hidden=True)
    flags.AddImageProjectFlag(parser, hidden=True)
    flags.AddImageFamilyFlag(parser, hidden=True)
    flags.AddNodeLabelsFlag(parser, for_node_pool=True)
    flags.AddTagsFlag(
        parser, """\
Applies the given Compute Engine tags (comma separated) on all nodes in the new
node-pool. Example:

  $ {command} node-pool-1 --cluster=example-cluster --tags=tag1,tag2

New nodes, including ones created by resize or recreate, will have these tags
on the Compute Engine API instance object and can be used in firewall rules.
See https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create
for examples.
""")
    # TODO(b/36071127): unhide this flag after we have enough ssd.
    flags.AddDiskTypeFlag(parser, suppressed=True)
    flags.AddEnableAutoUpgradeFlag(parser, for_node_pool=True)
    parser.display_info.AddFormat(util.NODEPOOLS_FORMAT)
    flags.AddNodeVersionFlag(parser)
Example #3
0
def _Args(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
  """
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to create.')
    flags.AddNodePoolClusterFlag(parser,
                                 'The cluster to add the node pool to.')
    parser.add_argument(
        '--enable-cloud-endpoints',
        action='store_true',
        default=True,
        help='Automatically enable Google Cloud Endpoints to take advantage of '
        'API management features.')
    # Timeout in seconds for operation
    parser.add_argument('--timeout',
                        type=int,
                        default=1800,
                        help=argparse.SUPPRESS)
    parser.add_argument(
        '--num-nodes',
        type=int,
        help='The number of nodes in the node pool in each of the '
        'cluster\'s zones.',
        default=3)
    parser.add_argument(
        '--machine-type',
        '-m',
        help='The type of machine to use for nodes. Defaults to n1-standard-1')
    parser.add_argument(
        '--disk-size',
        type=int,
        help='Size in GB for node VM boot disks. Defaults to 100GB.')
    flags.AddImageTypeFlag(parser, 'node pool')
    flags.AddNodeLabelsFlag(parser, for_node_pool=True)
    flags.AddTagsFlag(
        parser, """\
Applies the given Compute Engine tags (comma separated) on all nodes in the new
node-pool. Example:

  $ {command} node-pool-1 --cluster=example-cluster --tags=tag1,tag2

New nodes, including ones created by resize or recreate, will have these tags
on the Compute Engine API instance object and can be used in firewall rules.
See https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create
for examples.
""")
    flags.AddDiskTypeFlag(parser, suppressed=True)
    parser.display_info.AddFormat(util.NODEPOOLS_FORMAT)
Example #4
0
def _Args(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order to
      capture some information, but behaves like an ArgumentParser.
  """
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to create.')
    flags.AddNodePoolClusterFlag(parser,
                                 'The cluster to add the node pool to.')
    # Timeout in seconds for operation
    parser.add_argument('--timeout',
                        type=int,
                        default=1800,
                        hidden=True,
                        help='THIS ARGUMENT NEEDS HELP TEXT.')
    parser.add_argument(
        '--num-nodes',
        type=int,
        help='The number of nodes in the node pool in each of the '
        'cluster\'s zones.',
        default=3)
    flags.AddMachineTypeFlag(parser)
    parser.add_argument(
        '--disk-size',
        type=arg_parsers.BinarySize(lower_bound='10GB'),
        help='Size for node VM boot disks in GB. Defaults to 100GB.')
    flags.AddImageTypeFlag(parser, 'node pool')
    flags.AddImageFlag(parser, hidden=True)
    flags.AddImageProjectFlag(parser, hidden=True)
    flags.AddImageFamilyFlag(parser, hidden=True)
    flags.AddNodeLabelsFlag(parser, for_node_pool=True)
    flags.AddTagsFlag(
        parser, """\
Applies the given Compute Engine tags (comma separated) on all nodes in the new
node-pool. Example:

  $ {command} node-pool-1 --cluster=example-cluster --tags=tag1,tag2

New nodes, including ones created by resize or recreate, will have these tags
on the Compute Engine API instance object and can be used in firewall rules.
See https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create
for examples.
""")
    parser.display_info.AddFormat(util.NODEPOOLS_FORMAT)
    flags.AddNodeVersionFlag(parser)
    flags.AddDiskTypeFlag(parser)
    flags.AddMetadataFlags(parser)
    flags.AddShieldedInstanceFlags(parser)
    flags.AddNetworkConfigFlags(parser)
    flags.AddThreadsPerCore(parser)
Example #5
0
def _Args(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
  """
    flags.AddNodePoolNameArg(parser, 'The name of the node pool.')
    flags.AddNodePoolClusterFlag(parser, 'The name of the cluster.')
    # Timeout in seconds for operation
    parser.add_argument('--timeout',
                        type=int,
                        default=1800,
                        help=argparse.SUPPRESS)
Example #6
0
    def Args(parser):
        """Register flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
          to capture some information, but behaves like an ArgumentParser.
    """
        # TODO(b/28639250): Support remote completion when the SDK supports it.
        flags.AddNodePoolNameArg(parser,
                                 'The name of the node pool to delete.')
        parser.add_argument('--timeout',
                            type=int,
                            default=1800,
                            help=argparse.SUPPRESS)
        flags.AddClustersWaitAndAsyncFlags(parser)
        flags.AddNodePoolClusterFlag(
            parser, 'The cluster from which to delete the node pool.')
Example #7
0
  def Args(parser):
    """Register flags for this command.

    Args:
      parser: an argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    """

    flags.AddAsyncFlag(parser)
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to rollback.')
    flags.AddNodePoolClusterFlag(
        parser, 'The cluster from which to rollback the node pool.')
    parser.add_argument(
        '--timeout',
        type=int,
        default=1800,  # Seconds
        hidden=True,
        help='THIS ARGUMENT NEEDS HELP TEXT.')
    def Args(parser):
        """Register flags for this command.

    Args:
      parser: an argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    """

        flags.AddNodePoolNameArg(
            parser,
            'Name of the node pool for which the upgrade is to be completed.')
        flags.AddNodePoolClusterFlag(
            parser, 'Cluster to which the node pool belongs.')
        parser.add_argument(
            '--timeout',
            type=int,
            default=1800,  # Seconds
            hidden=True,
            help='Duration to wait before command timeout.')
Example #9
0
  def Args(parser):
    """Register flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
          to capture some information, but behaves like an ArgumentParser.
    """
    # TODO(b/28639250): Support remote completion when the SDK supports it.
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to delete.')
    parser.add_argument(
        '--timeout',
        type=int,
        default=1800,
        help=argparse.SUPPRESS)
    parser.add_argument(
        '--wait',
        action='store_true',
        default=True,
        help='Poll the operation for completion after issuing a delete '
        'request.')
    flags.AddNodePoolClusterFlag(
        parser,
        'The cluster from which to delete the node pool.')
Example #10
0
def _Args(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
  """
    flags.AddNodePoolNameArg(parser, 'The name of the node pool to create.')
    flags.AddNodePoolClusterFlag(parser,
                                 'The cluster to add the node pool to.')
    parser.add_argument(
        '--enable-cloud-endpoints',
        action='store_true',
        default=True,
        help='Automatically enable Google Cloud Endpoints to take advantage of '
        'API management features.')
    # Timeout in seconds for operation
    parser.add_argument('--timeout',
                        type=int,
                        default=1800,
                        help=argparse.SUPPRESS)
    parser.add_argument(
        '--num-nodes',
        type=int,
        help='The number of nodes in the node pool in each of the '
        'cluster\'s zones.',
        default=3)
    parser.add_argument(
        '--machine-type',
        '-m',
        help='The type of machine to use for nodes. Defaults to '
        'server-specified')
    parser.add_argument(
        '--disk-size',
        type=int,
        help='Size in GB for node VM boot disks. Defaults to 100GB.')
    parser.add_argument('--scopes',
                        type=arg_parsers.ArgList(min_length=1),
                        metavar='SCOPE',
                        help="""\
Specifies scopes for the node instances. The project's default
service account is used. Examples:

  $ {{command}} node-pool-1 --cluster=example-cluster --scopes https://www.googleapis.com/auth/devstorage.read_only

  $ {{command}} node-pool-1 --cluster=example-cluster --scopes bigquery,storage-rw,compute-ro

Multiple SCOPEs can specified, separated by commas. The scopes
necessary for the cluster to function properly (compute-rw, storage-ro),
are always added, even if not explicitly specified.

SCOPE can be either the full URI of the scope or an alias.
Available aliases are:

[options="header",format="csv",grid="none",frame="none"]
|========
Alias,URI
{aliases}
|========
""".format(aliases=compute_constants.ScopesForHelp()))
    flags.AddImageTypeFlag(parser, 'node pool')
    flags.AddNodeLabelsFlag(parser, for_node_pool=True)
    flags.AddTagsFlag(
        parser, """\
Applies the given Compute Engine tags (comma separated) on all nodes in the new
node-pool. Example:

  $ {command} node-pool-1 --cluster=example-cluster --tags=tag1,tag2

New nodes, including ones created by resize or recreate, will have these tags
on the Compute Engine API instance object and can be used in firewall rules.
See https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create
for examples.
""")