Exemple #1
0
 def Args(parser):
     _AddCommonArgs(parser)
     group = parser.add_mutually_exclusive_group(required=True)
     _AddMutuallyExclusiveArgs(group, base.ReleaseTrack.BETA)
     flags.AddClusterAutoscalingFlags(parser, group)
     group_locations = group.add_mutually_exclusive_group()
     _AddAdditionalZonesArg(group_locations, deprecated=True)
     flags.AddNodeLocationsFlag(group_locations)
     group_logging_monitoring = group.add_group()
     flags.AddLoggingServiceFlag(group_logging_monitoring)
     flags.AddMonitoringServiceFlag(group_logging_monitoring)
     flags.AddEnableStackdriverKubernetesFlag(group)
     flags.AddMasterAuthorizedNetworksFlags(parser,
                                            enable_group_for_update=group)
     flags.AddEnableLegacyAuthorizationFlag(group)
     flags.AddStartIpRotationFlag(group)
     flags.AddStartCredentialRotationFlag(group)
     flags.AddCompleteIpRotationFlag(group)
     flags.AddCompleteCredentialRotationFlag(group)
     flags.AddUpdateLabelsFlag(group)
     flags.AddRemoveLabelsFlag(group)
     flags.AddNetworkPolicyFlags(group)
     flags.AddMaintenanceWindowFlag(group, add_unset_text=True)
     flags.AddPodSecurityPolicyFlag(group)
     flags.AddEnableBinAuthzFlag(group)
     flags.AddAutoprovisioningFlags(group)
     flags.AddVerticalPodAutoscalingFlag(group)
     flags.AddResourceUsageExportFlags(group, is_update=True)
     flags.AddIstioConfigFlag(parser)
     flags.AddEnableIntraNodeVisibilityFlag(group)
     flags.AddWorkloadIdentityFlags(group)
     flags.AddWorkloadIdentityUpdateFlags(group)
     flags.AddEnableShieldedNodesFlags(group)
     flags.AddDatabaseEncryptionFlag(group)
Exemple #2
0
  def Args(parser):
    _Args(parser)
    group = parser.add_mutually_exclusive_group()
    _AddAdditionalZonesFlag(group, deprecated=True)
    flags.AddNodeLocationsFlag(group)
    flags.AddAlphaAddonsFlags(parser)
    flags.AddClusterAutoscalingFlags(parser)
    flags.AddMaxPodsPerNodeFlag(parser)
    flags.AddEnableAutoRepairFlag(parser, for_create=True)
    flags.AddEnableBinAuthzFlag(parser)
    flags.AddEnableKubernetesAlphaFlag(parser)
    flags.AddEnableLegacyAuthorizationFlag(parser)
    flags.AddIPAliasFlags(parser)
    flags.AddIstioConfigFlag(parser)
    flags.AddLabelsFlag(parser)
    flags.AddLocalSSDAndLocalSSDVolumeConfigsFlag(parser)
    flags.AddMaintenanceWindowGroup(parser, emw_hidden=True, add_emw_flags=True)
    flags.AddMasterAuthorizedNetworksFlags(parser)
    flags.AddMinCpuPlatformFlag(parser)
    flags.AddWorkloadMetadataFromNodeFlag(parser)
    flags.AddNetworkPolicyFlags(parser)
    flags.AddAutoprovisioningFlags(parser, hidden=False, for_create=True)
    flags.AddAutoscalingProfilesFlag(parser, hidden=True)
    flags.AddNodeTaintsFlag(parser)
    flags.AddPreemptibleFlag(parser)
    flags.AddPodSecurityPolicyFlag(parser)
    flags.AddAllowRouteOverlapFlag(parser)
    flags.AddPrivateClusterFlags(parser, with_deprecated=True, with_alpha=True)
    flags.AddClusterNodeIdentityFlags(parser)
    flags.AddTpuFlags(parser, hidden=False, enable_tpu_service_networking=True)
    flags.AddEnableStackdriverKubernetesFlag(parser)
    flags.AddManagedPodIdentityFlags(parser)
    flags.AddWorkloadIdentityFlags(parser)
    flags.AddResourceUsageExportFlags(parser)
    flags.AddAuthenticatorSecurityGroupFlags(parser)
    flags.AddVerticalPodAutoscalingFlag(parser)
    flags.AddSecurityProfileForCreateFlags(parser)
    flags.AddInitialNodePoolNameArg(parser, hidden=False)
    flags.AddEnablePrivateIpv6AccessFlag(parser, hidden=True)
    flags.AddEnableIntraNodeVisibilityFlag(parser)
    flags.AddEnableShieldedNodesFlags(parser)
    flags.AddDisableDefaultSnatFlag(parser, for_cluster_create=True)

    versioning_groups = parser.add_mutually_exclusive_group("""\
`--release-channel` cannot be specified if `--cluster-version` or
`--node-version` are specified.
""")
    flags.AddReleaseChannelFlag(versioning_groups)

    cluster_version_group = versioning_groups.add_group()
    flags.AddClusterVersionFlag(cluster_version_group)
    flags.AddNodeVersionFlag(cluster_version_group)
    flags.AddEnableAutoUpgradeFlag(parser, default=True)
    flags.AddDatabaseEncryptionFlag(parser)
    flags.AddSurgeUpgradeFlag(parser)
    flags.AddMaxUnavailableUpgradeFlag(parser)
    flags.AddLinuxSysctlFlags(parser)
    flags.AddShieldedInstanceFlags(parser)
    flags.AddNodeConfigFlag(parser)
Exemple #3
0
 def Args(parser):
     _AddCommonArgs(parser)
     group = parser.add_mutually_exclusive_group(required=True)
     _AddMutuallyExclusiveArgs(group, base.ReleaseTrack.BETA)
     flags.AddClusterAutoscalingFlags(parser, group)
     group_locations = group.add_mutually_exclusive_group()
     _AddAdditionalZonesArg(group_locations, deprecated=True)
     flags.AddNodeLocationsFlag(group_locations)
     group_logging_monitoring = group.add_group()
     flags.AddLoggingServiceFlag(group_logging_monitoring)
     flags.AddMonitoringServiceFlag(group_logging_monitoring)
     flags.AddEnableStackdriverKubernetesFlag(group)
     flags.AddEnableLoggingMonitoringSystemOnlyFlag(group)
     flags.AddEnableWorkloadMonitoringEapFlag(group)
     flags.AddEnableMasterSignalsFlags(group)
     flags.AddMasterAuthorizedNetworksFlags(parser,
                                            enable_group_for_update=group)
     flags.AddEnableLegacyAuthorizationFlag(group)
     flags.AddStartIpRotationFlag(group)
     flags.AddStartCredentialRotationFlag(group)
     flags.AddCompleteIpRotationFlag(group)
     flags.AddCompleteCredentialRotationFlag(group)
     flags.AddUpdateLabelsFlag(group)
     flags.AddRemoveLabelsFlag(group)
     flags.AddNetworkPolicyFlags(group)
     flags.AddDailyMaintenanceWindowFlag(group, add_unset_text=True)
     flags.AddRecurringMaintenanceWindowFlags(group, is_update=True)
     flags.AddPodSecurityPolicyFlag(group)
     flags.AddEnableBinAuthzFlag(group)
     flags.AddAutoprovisioningFlags(group)
     flags.AddAutoscalingProfilesFlag(group)
     flags.AddVerticalPodAutoscalingFlag(group)
     flags.AddResourceUsageExportFlags(group, is_update=True)
     flags.AddIstioConfigFlag(parser)
     flags.AddCloudRunConfigFlag(parser)
     flags.AddEnableIntraNodeVisibilityFlag(group)
     flags.AddWorkloadIdentityFlags(group,
                                    use_identity_provider=True,
                                    use_workload_certificates=True)
     flags.AddWorkloadIdentityUpdateFlags(group,
                                          use_workload_certificates=True)
     flags.AddGkeOidcFlag(group)
     flags.AddDatabaseEncryptionFlag(group)
     flags.AddDisableDatabaseEncryptionFlag(group)
     flags.AddReleaseChannelFlag(group, is_update=True, hidden=False)
     flags.AddEnableShieldedNodesFlags(group)
     flags.AddTpuFlags(group, enable_tpu_service_networking=True)
     flags.AddMasterGlobalAccessFlag(group, is_update=True)
     flags.AddEnableGvnicFlag(group)
     flags.AddDisableDefaultSnatFlag(group, for_cluster_create=False)
     flags.AddNotificationConfigFlag(group)
     flags.AddPrivateIpv6GoogleAccessTypeFlag('v1beta1',
                                              group,
                                              hidden=False)
     flags.AddKubernetesObjectsExportConfig(group)
     flags.AddDisableAutopilotFlag(group, hidden=True)
     flags.AddILBSubsettingFlags(group, hidden=True)
     flags.AddClusterDNSFlags(group, hidden=True)
     flags.AddCrossConnectSubnetworksMutationFlags(group)
Exemple #4
0
 def Args(parser):
     _AddCommonArgs(parser)
     group = parser.add_mutually_exclusive_group(required=True)
     _AddMutuallyExclusiveArgs(group, base.ReleaseTrack.ALPHA)
     flags.AddClusterAutoscalingFlags(parser, group)
     group_locations = group.add_mutually_exclusive_group()
     _AddAdditionalZonesArg(group_locations, deprecated=True)
     flags.AddNodeLocationsFlag(group_locations)
     group_logging_monitoring = group.add_group()
     flags.AddLoggingServiceFlag(group_logging_monitoring)
     flags.AddMonitoringServiceFlag(group_logging_monitoring)
     flags.AddEnableStackdriverKubernetesFlag(group)
     flags.AddEnableLoggingMonitoringSystemOnlyFlag(group)
     flags.AddMasterAuthorizedNetworksFlags(parser,
                                            enable_group_for_update=group)
     flags.AddEnableLegacyAuthorizationFlag(group)
     flags.AddStartIpRotationFlag(group)
     flags.AddStartCredentialRotationFlag(group)
     flags.AddCompleteIpRotationFlag(group)
     flags.AddCompleteCredentialRotationFlag(group)
     flags.AddUpdateLabelsFlag(group)
     flags.AddRemoveLabelsFlag(group)
     flags.AddNetworkPolicyFlags(group)
     flags.AddAutoprovisioningFlags(group, hidden=False)
     flags.AddAutoscalingProfilesFlag(group)
     flags.AddDailyMaintenanceWindowFlag(group, add_unset_text=True)
     flags.AddRecurringMaintenanceWindowFlags(group, is_update=True)
     flags.AddPodSecurityPolicyFlag(group)
     flags.AddEnableBinAuthzFlag(group)
     flags.AddResourceUsageExportFlags(group, is_update=True)
     flags.AddVerticalPodAutoscalingFlag(group)
     flags.AddSecurityProfileForUpdateFlag(group)
     flags.AddIstioConfigFlag(parser)
     flags.AddEnableIntraNodeVisibilityFlag(group)
     flags.AddWorkloadIdentityFlags(group, use_workload_pool=False)
     flags.AddWorkloadIdentityUpdateFlags(group)
     flags.AddDisableDefaultSnatFlag(group, for_cluster_create=False)
     flags.AddDatabaseEncryptionFlag(group)
     flags.AddDisableDatabaseEncryptionFlag(group)
     flags.AddCostManagementConfigFlag(group, is_update=True)
     flags.AddReleaseChannelFlag(group, is_update=True, hidden=False)
     flags.AddEnableShieldedNodesFlags(group)
     flags.AddTpuFlags(group, enable_tpu_service_networking=True)
     flags.AddMasterGlobalAccessFlag(group)
     flags.AddEnableGvnicFlag(group)
Exemple #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.
    """
        _AddCommonArgs(parser)
        group = parser.add_mutually_exclusive_group(required=True)
        group_locations = group.add_mutually_exclusive_group()
        _AddMutuallyExclusiveArgs(group, base.ReleaseTrack.GA)
        flags.AddNodeLocationsFlag(group_locations)
        flags.AddClusterAutoscalingFlags(parser, group)
        flags.AddMasterAuthorizedNetworksFlags(parser,
                                               enable_group_for_update=group)
        flags.AddEnableLegacyAuthorizationFlag(group)
        flags.AddStartIpRotationFlag(group)
        flags.AddStartCredentialRotationFlag(group)
        flags.AddCompleteIpRotationFlag(group)
        flags.AddCompleteCredentialRotationFlag(group)
        flags.AddCloudRunConfigFlag(parser)
        flags.AddUpdateLabelsFlag(group)
        flags.AddRemoveLabelsFlag(group)
        flags.AddNetworkPolicyFlags(group)
        flags.AddEnableIntraNodeVisibilityFlag(group)
        group_logging_monitoring = group.add_group()
        flags.AddLoggingServiceFlag(group_logging_monitoring)
        flags.AddMonitoringServiceFlag(group_logging_monitoring)
        flags.AddEnableBinAuthzFlag(group)
        flags.AddEnableStackdriverKubernetesFlag(group)
        flags.AddDailyMaintenanceWindowFlag(group, add_unset_text=True)
        flags.AddRecurringMaintenanceWindowFlags(group, is_update=True)
        flags.AddResourceUsageExportFlags(group, is_update=True)
        flags.AddReleaseChannelFlag(group, is_update=True, hidden=False)
        flags.AddWorkloadIdentityFlags(group)
        flags.AddWorkloadIdentityUpdateFlags(group)
        flags.AddDatabaseEncryptionFlag(group)
        flags.AddDisableDatabaseEncryptionFlag(group)
        flags.AddDisableDefaultSnatFlag(group, for_cluster_create=False)
        flags.AddVerticalPodAutoscalingFlag(group)
        flags.AddAutoprovisioningFlags(group)
        flags.AddEnableShieldedNodesFlags(group)
        flags.AddMasterGlobalAccessFlag(group, is_update=True)
        flags.AddPrivateIpv6GoogleAccessTypeFlag('v1', group, hidden=False)
        flags.AddNotificationConfigFlag(group)
Exemple #6
0
 def Args(parser):
     _Args(parser)
     group = parser.add_mutually_exclusive_group()
     _AddAdditionalZonesFlag(group, deprecated=True)
     flags.AddNodeLocationsFlag(group)
     flags.AddBetaAddonsFlags(parser)
     flags.AddClusterAutoscalingFlags(parser)
     flags.AddMaxPodsPerNodeFlag(parser)
     flags.AddEnableAutoRepairFlag(parser, for_create=True)
     flags.AddEnableBinAuthzFlag(parser)
     flags.AddEnableKubernetesAlphaFlag(parser)
     flags.AddEnableLegacyAuthorizationFlag(parser)
     flags.AddIPAliasFlags(parser)
     flags.AddIstioConfigFlag(parser)
     flags.AddLabelsFlag(parser)
     flags.AddLocalSSDFlag(parser)
     flags.AddMaintenanceWindowGroup(parser,
                                     emw_hidden=False,
                                     add_emw_flags=True)
     flags.AddMasterAuthorizedNetworksFlags(parser)
     flags.AddMinCpuPlatformFlag(parser)
     flags.AddWorkloadMetadataFromNodeFlag(parser)
     flags.AddNetworkPolicyFlags(parser)
     flags.AddNodeTaintsFlag(parser)
     flags.AddPreemptibleFlag(parser)
     flags.AddPodSecurityPolicyFlag(parser)
     flags.AddAllowRouteOverlapFlag(parser)
     flags.AddClusterNodeIdentityFlags(parser)
     flags.AddPrivateClusterFlags(parser,
                                  with_deprecated=True,
                                  with_alpha=False)
     flags.AddEnableStackdriverKubernetesFlag(parser)
     flags.AddTpuFlags(parser, hidden=False)
     flags.AddAutoprovisioningFlags(parser, hidden=False, for_create=True)
     flags.AddVerticalPodAutoscalingFlag(parser)
     flags.AddResourceUsageExportFlags(parser)
     flags.AddAuthenticatorSecurityGroupFlags(parser)
     flags.AddEnableIntraNodeVisibilityFlag(parser)
     flags.AddWorkloadIdentityFlags(parser)
     flags.AddEnableShieldedNodesFlags(parser)
     flags.AddEnableAutoUpgradeFlag(parser, default=True)
     flags.AddDatabaseEncryptionFlag(parser)
     flags.AddShieldedInstanceFlags(parser)
     _AddReleaseChannelGroup(parser)
Exemple #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.
  """
    parser.add_argument('name',
                        help="""\
The name of the cluster to create.

The name may contain only lowercase alphanumerics and '-', must start with a
letter and end with an alphanumeric, and must be no longer than 40
characters.
""")
    # Timeout in seconds for operation
    parser.add_argument(
        '--timeout',
        type=int,
        default=3600,
        hidden=True,
        help='Timeout (seconds) for waiting on the operation to complete.')
    flags.AddAsyncFlag(parser)
    parser.add_argument(
        '--num-nodes',
        type=arg_parsers.BoundedInt(1),
        help=
        'The number of nodes to be created in each of the cluster\'s zones.',
        default=3)
    flags.AddMachineTypeFlag(parser)
    parser.add_argument('--subnetwork',
                        help="""\
The Google Compute Engine subnetwork
(https://cloud.google.com/compute/docs/subnetworks) to which the cluster is
connected. The subnetwork must belong to the network specified by --network.

Cannot be used with the "--create-subnetwork" option.
""")
    parser.add_argument(
        '--network',
        help='The Compute Engine Network that the cluster will connect to. '
        'Google Kubernetes Engine will use this network when creating routes '
        'and firewalls for the clusters. Defaults to the \'default\' network.')
    parser.add_argument(
        '--cluster-ipv4-cidr',
        help='The IP address range for the pods in this cluster in CIDR '
        'notation (e.g. 10.0.0.0/14).  Prior to Kubernetes version 1.7.0 '
        'this must be a subset of 10.0.0.0/8; however, starting with version '
        '1.7.0 can be any RFC 1918 IP range.')
    parser.add_argument(
        '--enable-cloud-logging',
        action=actions.DeprecationAction(
            '--enable-cloud-logging',
            warn=
            'From 1.14, legacy Stackdriver GKE logging is deprecated. Thus, '
            'flag `--enable-cloud-logging` is also deprecated. Please use '
            '`--enable-stackdriver-kubernetes` instead, to migrate to new '
            'Stackdriver Kubernetes Engine monitoring and logging. For more '
            'details, please read: '
            'https://cloud.google.com/monitoring/kubernetes-engine/migration.',
            action='store_true'),
        help='Automatically send logs from the cluster to the Google Cloud '
        'Logging API. This flag is deprecated, use '
        '`--enable-stackdriver-kubernetes` instead.')
    parser.add_argument(
        '--enable-cloud-monitoring',
        action=actions.DeprecationAction(
            '--enable-cloud-monitoring',
            warn='From 1.14, legacy Stackdriver GKE monitoring is deprecated. '
            'Thus, flag `--enable-cloud-monitoring` is also deprecated. Please '
            'use `--enable-stackdriver-kubernetes` instead, to migrate to new '
            'Stackdriver Kubernetes Engine monitoring and logging. For more '
            'details, please read: '
            'https://cloud.google.com/monitoring/kubernetes-engine/migration.',
            action='store_true'),
        help='Automatically send metrics from pods in the cluster to the Google '
        'Cloud Monitoring API. VM metrics will be collected by Google Compute '
        'Engine regardless of this setting. This flag is deprecated, use '
        '`--enable-stackdriver-kubernetes` instead.')
    parser.add_argument('--disk-size',
                        type=arg_parsers.BinarySize(lower_bound='10GB'),
                        help='Size for node VM boot disks. Defaults to 100GB.')
    flags.AddBasicAuthFlags(parser)
    parser.add_argument(
        '--max-nodes-per-pool',
        type=arg_parsers.BoundedInt(100, api_adapter.MAX_NODES_PER_POOL),
        help='The maximum number of nodes to allocate per default initial node '
        'pool. Kubernetes Engine will automatically create enough nodes pools '
        'such that each node pool contains less than '
        '--max-nodes-per-pool nodes. Defaults to {nodes} nodes, but can be set '
        'as low as 100 nodes per pool on initial create.'.format(
            nodes=api_adapter.MAX_NODES_PER_POOL))
    flags.AddImageTypeFlag(parser, 'cluster')
    flags.AddImageFlag(parser, hidden=True)
    flags.AddImageProjectFlag(parser, hidden=True)
    flags.AddImageFamilyFlag(parser, hidden=True)
    flags.AddNodeLabelsFlag(parser)
    flags.AddTagsFlag(
        parser, """\
Applies the given Compute Engine tags (comma separated) on all nodes in the new
node-pool. Example:

  $ {command} 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.CLUSTERS_FORMAT)
    flags.AddIssueClientCertificateFlag(parser)
    flags.AddAcceleratorArgs(parser)
    flags.AddDiskTypeFlag(parser)
    flags.AddMetadataFlags(parser)
    flags.AddDatabaseEncryptionFlag(parser)
    flags.AddShieldedInstanceFlags(parser)
    flags.AddEnableShieldedNodesFlags(parser)