feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The command group for cloud container operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.container import container_command_util
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
class NodePools(base.Group):
"""Create and delete operations for Google Kubernetes Engine node pools."""
category = base.COMPUTE_CATEGORY
@staticmethod
def Args(parser):
"""Add arguments to the parser.
Args:
parser: argparse.ArgumentParser, This is a standard argparser parser with
which you can register arguments. See the public argparse documentation
for its capabilities.
"""
flags.AddLocationFlags(parser)
def Filter(self, context, args):
"""Modify the context that will be given to this group's commands when run.
Args:
context: {str:object}, A set of key-value pairs that can be used for
common initialization among commands.
args: argparse.Namespace: The same namespace given to the corresponding
.Run() invocation.
Returns:
The refined command context.
"""
base.RequireProjectID(args)
context['location_get'] = container_command_util.GetZoneOrRegion
return context

View File

@@ -0,0 +1,98 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Complete node-pool upgrade command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA,
base.ReleaseTrack.GA)
class CompleteUpgrade(base.Command):
"""Complete a node pool upgrade."""
@staticmethod
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.')
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
Raises:
util.Error, if complete failed.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
try:
pool_ref = adapter.ParseNodePool(args.name, location)
adapter.CompleteNodePoolUpgrade(pool_ref)
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
log.UpdatedResource(pool_ref)
CompleteUpgrade.detailed_help = {
'brief':
'Complete a node pool upgrade.',
'DESCRIPTION':
"""
Complete a node pool upgrade.
Complete upgrade is a method used to skip the remaining node pool soaking
phase during blue-green node pool upgrades.
""",
'EXAMPLES':
"""\
To complete an active upgrade in ``node-pool-1'' in the
cluster ``sample-cluster'', run:
$ {command} node-pool-1 --cluster=sample-cluster
""",
}

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for managing Container node pool configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Container node pool configurations."""

View File

@@ -0,0 +1,43 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Container node pool.
description: |
*{command}* exports the configuration for a Container node pool.
Node pool configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
node pools within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for a node pool, run:
$ {command} my-node-pool
To export the configuration for a node pool to a file, run:
$ {command} my-node-pool --path=/path/to/dir/
To export the configuration for a node pool in Terraform
HCL format, run:
$ {command} my-node-pool --resource-format=terraform
To export the configurations for all node pools within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Node pool to export the configuration for.
spec: !REF googlecloudsdk.command_lib.container.clusters.resources:node_pool
# Inherited from node-pools command.
removed_flags: ['location']
command_level_fallthroughs:
location:
- arg_name: 'location'

View File

@@ -0,0 +1,674 @@
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Create node pool command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.compute import metadata_utils
from googlecloudsdk.api_lib.compute import utils
from googlecloudsdk.api_lib.container import api_adapter
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import constants
from googlecloudsdk.command_lib.container import container_command_util as cmd_util
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
DETAILED_HELP = {
'DESCRIPTION':
"""\
*{command}* facilitates the creation of a node pool in a Google
Kubernetes Engine cluster. A variety of options exists to customize the
node configuration and the number of nodes created.
""",
'EXAMPLES':
"""\
To create a new node pool "node-pool-1" with the default options in the
cluster "sample-cluster", run:
$ {command} node-pool-1 --cluster=sample-cluster
The new node pool will show up in the cluster after all the nodes have
been provisioned.
To create a node pool with 5 nodes, run:
$ {command} node-pool-1 --cluster=sample-cluster --num-nodes=5
""",
}
WARN_WINDOWS_SAC_SUPPORT_LIFECYCLE = (
'Note: Windows SAC node pools must be upgraded regularly to remain '
'operational. Please refer to '
'https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#choose_your_windows_server_node_image'
' for more information.')
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. Defaults to
3.
Exception: when `--tpu-topology` is specified for multi-host TPU machine types
the number of nodes will be defaulted to `(product of topology)/(# of chips per
VM)`.
""",
default=None,
)
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.AddLabelsFlag(parser, for_node_pool=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.AddBootDiskProvisionedThroughputFlag(parser)
flags.AddBootDiskProvisionedIopsFlag(parser)
flags.AddMetadataFlags(parser)
flags.AddShieldedInstanceFlags(parser)
flags.AddNetworkConfigFlags(parser)
flags.AddThreadsPerCore(parser)
flags.AddPerformanceMonitoringUnit(parser)
flags.AddAdditionalNodeNetworkFlag(parser)
flags.AddAdditionalPodNetworkFlag(parser)
flags.AddAsyncFlag(parser)
flags.AddSoleTenantNodeAffinityFileFlag(parser)
flags.AddSoleTenantMinNodeCpusFlag(parser)
flags.AddContainerdConfigFlag(parser)
flags.AddEnableKubeletReadonlyPortFlag(parser)
flags.AddGpuDirectStrategyFlag(parser)
flags.AddEnableKernelModuleSignatureEnforcementFlag(
parser, for_node_pool=True
)
flags.AddEnableLustreMultiRailFlag(parser, hidden=True)
def ParseCreateNodePoolOptionsBase(args):
"""Parses the flags provided with the node pool creation command."""
enable_autorepair = cmd_util.GetAutoRepair(args)
flags.WarnForNodeModification(args, enable_autorepair)
flags.ValidateSurgeUpgradeSettings(args)
metadata = metadata_utils.ConstructMetadataDict(args.metadata,
args.metadata_from_file)
ephemeral_storage_local_ssd = None
if args.IsKnownAndSpecified('ephemeral_storage_local_ssd'):
ephemeral_storage_local_ssd = (
[]
if args.ephemeral_storage_local_ssd is None
else args.ephemeral_storage_local_ssd
)
local_nvme_ssd_block = None
if args.IsKnownAndSpecified('local_nvme_ssd_block'):
local_nvme_ssd_block = (
[]
if args.local_nvme_ssd_block is None
else args.local_nvme_ssd_block
)
return api_adapter.CreateNodePoolOptions(
accelerators=args.accelerator,
boot_disk_kms_key=args.boot_disk_kms_key,
machine_type=args.machine_type,
disk_size_gb=utils.BytesToGb(args.disk_size),
scopes=args.scopes,
node_version=args.node_version,
num_nodes=args.num_nodes,
local_ssd_count=args.local_ssd_count,
local_nvme_ssd_block=local_nvme_ssd_block,
ephemeral_storage_local_ssd=ephemeral_storage_local_ssd,
tags=args.tags,
threads_per_core=args.threads_per_core,
labels=args.labels,
node_labels=args.node_labels,
node_taints=args.node_taints,
enable_autoscaling=args.enable_autoscaling,
max_nodes=args.max_nodes,
min_cpu_platform=args.min_cpu_platform,
min_nodes=args.min_nodes,
total_max_nodes=args.total_max_nodes,
total_min_nodes=args.total_min_nodes,
location_policy=args.location_policy,
image_type=args.image_type,
image=args.image,
image_project=args.image_project,
image_family=args.image_family,
preemptible=args.preemptible,
enable_autorepair=enable_autorepair,
enable_autoupgrade=cmd_util.GetAutoUpgrade(args),
service_account=args.service_account,
disk_type=args.disk_type,
metadata=metadata,
max_pods_per_node=args.max_pods_per_node,
enable_autoprovisioning=args.enable_autoprovisioning,
workload_metadata=args.workload_metadata,
workload_metadata_from_node=args.workload_metadata_from_node,
shielded_secure_boot=args.shielded_secure_boot,
shielded_integrity_monitoring=args.shielded_integrity_monitoring,
reservation_affinity=args.reservation_affinity,
reservation=args.reservation,
sandbox=args.sandbox,
gpudirect_strategy=args.gpudirect_strategy,
max_surge_upgrade=args.max_surge_upgrade,
max_unavailable_upgrade=args.max_unavailable_upgrade,
node_group=args.node_group,
system_config_from_file=args.system_config_from_file,
pod_ipv4_range=args.pod_ipv4_range,
create_pod_ipv4_range=args.create_pod_ipv4_range,
gvnic=args.enable_gvnic,
enable_image_streaming=args.enable_image_streaming,
spot=args.spot,
enable_confidential_nodes=args.enable_confidential_nodes,
confidential_node_type=args.confidential_node_type,
enable_confidential_storage=args.enable_confidential_storage,
data_cache_count=args.data_cache_count,
enable_blue_green_upgrade=args.enable_blue_green_upgrade,
enable_surge_upgrade=args.enable_surge_upgrade,
node_pool_soak_duration=args.node_pool_soak_duration,
standard_rollout_policy=args.standard_rollout_policy,
autoscaled_rollout_policy=args.autoscaled_rollout_policy,
enable_private_nodes=args.enable_private_nodes,
enable_fast_socket=args.enable_fast_socket,
logging_variant=args.logging_variant,
windows_os_version=args.windows_os_version,
additional_node_network=args.additional_node_network,
additional_pod_network=args.additional_pod_network,
sole_tenant_node_affinity_file=args.sole_tenant_node_affinity_file,
sole_tenant_min_node_cpus=args.sole_tenant_min_node_cpus,
containerd_config_from_file=args.containerd_config_from_file,
resource_manager_tags=args.resource_manager_tags,
enable_insecure_kubelet_readonly_port=args.enable_insecure_kubelet_readonly_port,
enable_nested_virtualization=args.enable_nested_virtualization,
boot_disk_provisioned_iops=args.boot_disk_provisioned_iops,
boot_disk_provisioned_throughput=args.boot_disk_provisioned_throughput,
accelerator_network_profile=args.accelerator_network_profile,
enable_kernel_module_signature_enforcement=args.enable_kernel_module_signature_enforcement,
enable_lustre_multi_nic=args.enable_lustre_multi_nic,
)
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Create(base.CreateCommand):
"""Create a node pool in a running cluster."""
@staticmethod
def Args(parser):
_Args(parser)
flags.AddAcceleratorArgs(
parser,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_deprecated_fields=False,
enable_gpu_driver_installation=True)
flags.AddBootDiskKmsKeyFlag(parser)
flags.AddClusterAutoscalingFlags(parser)
flags.AddLocalSSDsGAFlags(parser, for_node_pool=True)
flags.AddPreemptibleFlag(parser, for_node_pool=True)
flags.AddEnableAutoRepairFlag(parser, for_node_pool=True, for_create=True)
flags.AddOpportunisticMaintenanceFlag(parser)
flags.AddMinCpuPlatformFlag(parser, for_node_pool=True)
flags.AddWorkloadMetadataFlag(parser)
flags.AddNodeTaintsFlag(parser, for_node_pool=True)
flags.AddNodePoolNodeIdentityFlags(parser)
flags.AddNodePoolAutoprovisioningFlag(parser, hidden=False)
flags.AddMaxPodsPerNodeFlag(parser, for_node_pool=True)
flags.AddEnableAutoUpgradeFlag(parser, for_node_pool=True, default=True)
flags.AddReservationAffinityFlags(parser, for_node_pool=True)
flags.AddSandboxFlag(parser)
flags.AddNodePoolLocationsFlag(parser, for_create=True)
flags.AddSurgeUpgradeFlag(parser, for_node_pool=True, default=1)
flags.AddMaxUnavailableUpgradeFlag(
parser, for_node_pool=True, is_create=True)
flags.AddSystemConfigFlag(parser, hidden=False)
flags.AddNodeGroupFlag(parser)
flags.AddEnableGvnicFlag(parser)
flags.AddEnableImageStreamingFlag(parser, for_node_pool=True)
flags.AddSpotFlag(parser, for_node_pool=True)
flags.AddEnableConfidentialNodesFlag(parser, for_node_pool=True)
flags.AddConfidentialNodeTypeFlag(parser, for_node_pool=True)
flags.AddDisablePodCIDROverprovisionFlag(parser, hidden=True)
flags.AddNetworkPerformanceConfigFlags(parser, hidden=False)
flags.AddEnableSurgeUpgradeFlag(parser)
flags.AddEnableBlueGreenUpgradeFlag(parser)
flags.AddStandardRolloutPolicyFlag(parser)
flags.AddAutoscaledRolloutPolicyFlag(parser)
flags.AddStoragePoolsFlag(
parser, for_node_pool=True, for_create=True)
flags.AddNodePoolSoakDurationFlag(parser)
flags.AddNodePoolEnablePrivateNodes(parser)
flags.AddEnableFastSocketFlag(parser)
flags.AddLoggingVariantFlag(parser, for_node_pool=True)
flags.AddWindowsOsVersionFlag(parser)
flags.AddPlacementTypeFlag(parser, for_node_pool=True, hidden=False)
flags.AddQueuedProvisioningFlag(parser)
flags.AddConsolidationDelayFlag(parser, hidden=True)
flags.AddMaxRunDurationFlag(parser)
flags.AddFlexStartFlag(parser)
flags.AddBestEffortProvisionFlags(parser)
flags.AddPlacementPolicyFlag(parser)
flags.AddTPUTopologyFlag(parser)
flags.AddResourceManagerTagsCreate(parser, for_node_pool=True)
flags.AddEnableNestedVirtualizationFlag(
parser, for_node_pool=True, hidden=False)
flags.AddSecondaryBootDisksArgs(parser)
flags.AddEnableConfidentialStorageFlag(parser, for_node_pool=True)
flags.AddDataCacheCountFlag(parser, for_node_pool=True)
flags.AddAcceleratorNetworkProfileFlag(parser)
def ParseCreateNodePoolOptions(self, args):
ops = ParseCreateNodePoolOptionsBase(args)
ops.node_locations = args.node_locations
ops.network_performance_config = args.network_performance_configs
ops.disable_pod_cidr_overprovision = args.disable_pod_cidr_overprovision
ops.placement_type = args.placement_type
ops.enable_best_effort_provision = args.enable_best_effort_provision
ops.min_provision_nodes = args.min_provision_nodes
ops.performance_monitoring_unit = args.performance_monitoring_unit
ops.placement_policy = args.placement_policy
ops.enable_queued_provisioning = args.enable_queued_provisioning
ops.max_run_duration = args.max_run_duration
ops.consolidation_delay = args.consolidation_delay
ops.flex_start = args.flex_start
ops.tpu_topology = args.tpu_topology
ops.secondary_boot_disks = args.secondary_boot_disk
ops.storage_pools = args.storage_pools
return ops
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Cluster message for the successfully created node pool.
Raises:
util.Error, if creation failed.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
try:
pool_ref = adapter.ParseNodePool(args.name, location)
options = self.ParseCreateNodePoolOptions(args)
if options.accelerators is not None:
log.status.Print('Note: ' + constants.KUBERNETES_GPU_LIMITATION_MSG)
log.status.Print('Note: ' +
constants.KUBERNETES_GPU_DRIVER_AUTO_INSTALL_MSG)
gpu_driver_version = options.accelerators.get(
'gpu-driver-version', None
)
if gpu_driver_version == 'disabled':
log.status.Print(
'Note: '
+ constants.KUBERNETES_GPU_DRIVER_DISABLED_NEEDS_MANUAL_INSTALL_MSG
)
elif options.image_type and options.image_type.upper().startswith(
'WINDOWS_SAC'):
log.status.Print(WARN_WINDOWS_SAC_SUPPORT_LIFECYCLE)
# Image streaming feature requires Container File System API to be
# enabled.
# Checking whether the API has been enabled, and warning if not.
if options.enable_image_streaming:
util.CheckForContainerFileSystemApiEnablementWithPrompt(
pool_ref.projectId)
operation_ref = adapter.CreateNodePool(pool_ref, options)
if args.async_:
op = adapter.GetOperation(operation_ref)
if not args.IsSpecified('format'):
args.format = util.OPERATIONS_FORMAT
return op
adapter.WaitForOperation(
operation_ref,
'Creating node pool {0}'.format(pool_ref.nodePoolId),
timeout_s=args.timeout)
pool = adapter.GetNodePool(pool_ref)
util.CheckForCgroupModeV1(pool)
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
log.CreatedResource(pool_ref)
return [pool]
@base.ReleaseTracks(base.ReleaseTrack.BETA)
class CreateBeta(Create):
"""Create a node pool in a running cluster."""
@staticmethod
def Args(parser):
_Args(parser)
flags.AddAcceleratorArgs(
parser,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_deprecated_fields=True,
enable_gpu_driver_installation=True)
flags.AddClusterAutoscalingFlags(parser)
flags.AddLocalSSDsBetaFlags(parser, for_node_pool=True)
flags.AddBootDiskKmsKeyFlag(parser)
flags.AddPreemptibleFlag(parser, for_node_pool=True)
flags.AddEnableAutoRepairFlag(parser, for_node_pool=True, for_create=True)
flags.AddMinCpuPlatformFlag(parser, for_node_pool=True)
flags.AddWorkloadMetadataFlag(parser, use_mode=False)
flags.AddNodeTaintsFlag(parser, for_node_pool=True)
flags.AddNodePoolNodeIdentityFlags(parser)
flags.AddNodePoolAutoprovisioningFlag(parser, hidden=False)
flags.AddMaxPodsPerNodeFlag(parser, for_node_pool=True)
flags.AddEnableAutoUpgradeFlag(parser, for_node_pool=True, default=True)
flags.AddSandboxFlag(parser)
flags.AddNodePoolLocationsFlag(parser, for_create=True)
flags.AddSurgeUpgradeFlag(parser, for_node_pool=True, default=1)
flags.AddMaxUnavailableUpgradeFlag(
parser, for_node_pool=True, is_create=True)
flags.AddReservationAffinityFlags(parser, for_node_pool=True)
flags.AddSystemConfigFlag(parser, hidden=False)
flags.AddNodeGroupFlag(parser)
flags.AddEnableGcfsFlag(parser, for_node_pool=True)
flags.AddEnableImageStreamingFlag(parser, for_node_pool=True)
flags.AddNodePoolEnablePrivateNodes(parser)
flags.AddEnableGvnicFlag(parser)
flags.AddSpotFlag(parser, for_node_pool=True)
flags.AddPlacementTypeFlag(parser, for_node_pool=True, hidden=False)
flags.AddPlacementPolicyFlag(parser)
flags.AddEnableSurgeUpgradeFlag(parser)
flags.AddEnableBlueGreenUpgradeFlag(parser)
flags.AddStandardRolloutPolicyFlag(parser)
flags.AddAutoscaledRolloutPolicyFlag(parser)
flags.AddNodePoolSoakDurationFlag(parser)
flags.AddMaintenanceIntervalFlag(parser, for_node_pool=True, hidden=True)
flags.AddNetworkPerformanceConfigFlags(parser, hidden=False)
flags.AddEnableConfidentialNodesFlag(parser, for_node_pool=True)
flags.AddConfidentialNodeTypeFlag(parser, for_node_pool=True)
flags.AddEnableConfidentialStorageFlag(parser, for_node_pool=True)
flags.AddStoragePoolsFlag(
parser, for_node_pool=True, for_create=True)
flags.AddLocalSsdEncryptionModeFlag(
parser, for_node_pool=True)
flags.AddDataCacheCountFlag(parser, for_node_pool=True)
flags.AddDisablePodCIDROverprovisionFlag(parser)
flags.AddEnableFastSocketFlag(parser)
flags.AddLoggingVariantFlag(parser, for_node_pool=True)
flags.AddWindowsOsVersionFlag(parser)
flags.AddBestEffortProvisionFlags(parser, hidden=False)
flags.AddQueuedProvisioningFlag(parser)
flags.AddConsolidationDelayFlag(parser, hidden=True)
flags.AddMaxRunDurationFlag(parser)
flags.AddFlexStartFlag(parser)
flags.AddTPUTopologyFlag(parser)
flags.AddEnableNestedVirtualizationFlag(
parser, for_node_pool=True, hidden=False)
flags.AddHostMaintenanceIntervalFlag(
parser, for_node_pool=True, hidden=True)
flags.AddOpportunisticMaintenanceFlag(parser)
flags.AddResourceManagerTagsCreate(parser, for_node_pool=True)
flags.AddSecondaryBootDisksArgs(parser)
flags.AddAcceleratorNetworkProfileFlag(parser, hidden=False)
def ParseCreateNodePoolOptions(self, args):
ops = ParseCreateNodePoolOptionsBase(args)
flags.WarnForNodeVersionAutoUpgrade(args)
flags.ValidateSurgeUpgradeSettings(args)
ephemeral_storage = None
if args.IsKnownAndSpecified('ephemeral_storage'):
ephemeral_storage = (
[]
if args.ephemeral_storage is None
else args.ephemeral_storage
)
ops.boot_disk_kms_key = args.boot_disk_kms_key
ops.sandbox = args.sandbox
ops.node_locations = args.node_locations
ops.system_config_from_file = args.system_config_from_file
ops.enable_gcfs = args.enable_gcfs
ops.enable_image_streaming = args.enable_image_streaming
ops.ephemeral_storage = ephemeral_storage
ops.spot = args.spot
ops.placement_type = args.placement_type
ops.placement_policy = args.placement_policy
ops.location_policy = args.location_policy
ops.enable_blue_green_upgrade = args.enable_blue_green_upgrade
ops.enable_surge_upgrade = args.enable_surge_upgrade
ops.node_pool_soak_duration = args.node_pool_soak_duration
ops.standard_rollout_policy = args.standard_rollout_policy
ops.autoscaled_rollout_policy = args.autoscaled_rollout_policy
ops.maintenance_interval = args.maintenance_interval
ops.network_performance_config = args.network_performance_configs
ops.enable_confidential_nodes = args.enable_confidential_nodes
ops.confidential_node_type = args.confidential_node_type
ops.disable_pod_cidr_overprovision = args.disable_pod_cidr_overprovision
ops.enable_fast_socket = args.enable_fast_socket
ops.enable_queued_provisioning = args.enable_queued_provisioning
ops.max_run_duration = args.max_run_duration
ops.consolidation_delay = args.consolidation_delay
ops.flex_start = args.flex_start
ops.tpu_topology = args.tpu_topology
ops.enable_nested_virtualization = args.enable_nested_virtualization
ops.enable_best_effort_provision = args.enable_best_effort_provision
ops.min_provision_nodes = args.min_provision_nodes
ops.host_maintenance_interval = args.host_maintenance_interval
ops.opportunistic_maintenance = args.opportunistic_maintenance
ops.performance_monitoring_unit = args.performance_monitoring_unit
ops.secondary_boot_disks = args.secondary_boot_disk
ops.storage_pools = args.storage_pools
ops.local_ssd_encryption_mode = args.local_ssd_encryption_mode
ops.data_cache_count = args.data_cache_count
return ops
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class CreateAlpha(Create):
"""Create a node pool in a running cluster."""
def ParseCreateNodePoolOptions(self, args):
ops = ParseCreateNodePoolOptionsBase(args)
flags.WarnForNodeVersionAutoUpgrade(args)
flags.ValidateSurgeUpgradeSettings(args)
ephemeral_storage = None
if args.IsKnownAndSpecified('ephemeral_storage'):
ephemeral_storage = (
[]
if args.ephemeral_storage is None
else args.ephemeral_storage
)
ops.local_ssd_volume_configs = args.local_ssd_volumes
ops.boot_disk_kms_key = args.boot_disk_kms_key
ops.sandbox = args.sandbox
ops.linux_sysctls = args.linux_sysctls
ops.node_locations = args.node_locations
ops.system_config_from_file = args.system_config_from_file
ops.enable_gcfs = args.enable_gcfs
ops.enable_image_streaming = args.enable_image_streaming
ops.spot = args.spot
ops.placement_type = args.placement_type
ops.placement_policy = args.placement_policy
ops.location_policy = args.location_policy
ops.enable_blue_green_upgrade = args.enable_blue_green_upgrade
ops.enable_surge_upgrade = args.enable_surge_upgrade
ops.node_pool_soak_duration = args.node_pool_soak_duration
ops.standard_rollout_policy = args.standard_rollout_policy
ops.autoscaled_rollout_policy = args.autoscaled_rollout_policy
ops.maintenance_interval = args.maintenance_interval
ops.network_performance_config = args.network_performance_configs
ops.enable_confidential_nodes = args.enable_confidential_nodes
ops.confidential_node_type = args.confidential_node_type
ops.disable_pod_cidr_overprovision = args.disable_pod_cidr_overprovision
ops.enable_fast_socket = args.enable_fast_socket
ops.enable_queued_provisioning = args.enable_queued_provisioning
ops.max_run_duration = args.max_run_duration
ops.consolidation_delay = args.consolidation_delay
ops.flex_start = args.flex_start
ops.tpu_topology = args.tpu_topology
ops.enable_nested_virtualization = args.enable_nested_virtualization
ops.enable_best_effort_provision = args.enable_best_effort_provision
ops.min_provision_nodes = args.min_provision_nodes
ops.host_maintenance_interval = args.host_maintenance_interval
ops.opportunistic_maintenance = args.opportunistic_maintenance
ops.performance_monitoring_unit = args.performance_monitoring_unit
ops.ephemeral_storage = ephemeral_storage
ops.secondary_boot_disks = args.secondary_boot_disk
ops.storage_pools = args.storage_pools
ops.local_ssd_encryption_mode = args.local_ssd_encryption_mode
ops.data_cache_count = args.data_cache_count
if args.enable_attestation and not args.tee_policy:
raise exceptions.InvalidArgumentException(
'--enable-attestation',
'The --tee-policy flag must be provided when --enable-attestation is'
' specified.',
)
if args.tee_policy and not args.enable_attestation:
raise exceptions.InvalidArgumentException(
'--tee-policy',
'The --enable-attestation flag must be provided when --tee-policy is'
' specified.',
)
ops.runner_pool_control_mode = args.runner_pool_control_mode
ops.control_node_pool = args.control_node_pool
ops.enable_attestation = args.enable_attestation
ops.tee_policy = args.tee_policy
return ops
@staticmethod
def Args(parser):
_Args(parser)
flags.AddAcceleratorArgs(
parser,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_deprecated_fields=True,
enable_gpu_driver_installation=True)
flags.AddClusterAutoscalingFlags(parser)
flags.AddNodePoolAutoprovisioningFlag(parser, hidden=False)
flags.AddLocalSSDsAlphaFlags(parser, for_node_pool=True)
flags.AddBootDiskKmsKeyFlag(parser)
flags.AddPreemptibleFlag(parser, for_node_pool=True)
flags.AddEnableAutoRepairFlag(parser, for_node_pool=True, for_create=True)
flags.AddMinCpuPlatformFlag(parser, for_node_pool=True)
flags.AddWorkloadMetadataFlag(parser, use_mode=False)
flags.AddNodeTaintsFlag(parser, for_node_pool=True)
flags.AddNodePoolNodeIdentityFlags(parser)
flags.AddMaxPodsPerNodeFlag(parser, for_node_pool=True)
flags.AddSandboxFlag(parser)
flags.AddNodeGroupFlag(parser)
flags.AddEnableAutoUpgradeFlag(parser, for_node_pool=True, default=True)
flags.AddLinuxSysctlFlags(parser, for_node_pool=True)
flags.AddSurgeUpgradeFlag(parser, for_node_pool=True, default=1)
flags.AddMaxUnavailableUpgradeFlag(
parser, for_node_pool=True, is_create=True)
flags.AddNodePoolLocationsFlag(parser, for_create=True)
flags.AddSystemConfigFlag(parser, hidden=False)
flags.AddReservationAffinityFlags(parser, for_node_pool=True)
flags.AddEnableGcfsFlag(parser, for_node_pool=True)
flags.AddEnableImageStreamingFlag(parser, for_node_pool=True)
flags.AddNodePoolEnablePrivateNodes(parser)
flags.AddEnableGvnicFlag(parser)
flags.AddSpotFlag(parser, for_node_pool=True)
flags.AddPlacementTypeFlag(parser, for_node_pool=True, hidden=False)
flags.AddPlacementPolicyFlag(parser)
flags.AddEnableSurgeUpgradeFlag(parser)
flags.AddEnableBlueGreenUpgradeFlag(parser)
flags.AddStandardRolloutPolicyFlag(parser, for_node_pool=True)
flags.AddAutoscaledRolloutPolicyFlag(parser)
flags.AddNodePoolSoakDurationFlag(parser, for_node_pool=True)
flags.AddMaintenanceIntervalFlag(parser, for_node_pool=True, hidden=True)
flags.AddNetworkPerformanceConfigFlags(parser, hidden=False)
flags.AddEnableConfidentialNodesFlag(parser, for_node_pool=True)
flags.AddConfidentialNodeTypeFlag(parser, for_node_pool=True)
flags.AddEnableConfidentialStorageFlag(parser, for_node_pool=True)
flags.AddStoragePoolsFlag(
parser, for_node_pool=True, for_create=True)
flags.AddLocalSsdEncryptionModeFlag(
parser, for_node_pool=True)
flags.AddDataCacheCountFlag(parser, for_node_pool=True)
flags.AddDisablePodCIDROverprovisionFlag(parser)
flags.AddEnableFastSocketFlag(parser)
flags.AddLoggingVariantFlag(parser, for_node_pool=True)
flags.AddWindowsOsVersionFlag(parser)
flags.AddBestEffortProvisionFlags(parser, hidden=False)
flags.AddQueuedProvisioningFlag(parser)
flags.AddConsolidationDelayFlag(parser, hidden=True)
flags.AddMaxRunDurationFlag(parser)
flags.AddFlexStartFlag(parser)
flags.AddTPUTopologyFlag(parser)
flags.AddEnableNestedVirtualizationFlag(
parser, for_node_pool=True, hidden=False)
flags.AddHostMaintenanceIntervalFlag(
parser, for_node_pool=True, hidden=True)
flags.AddOpportunisticMaintenanceFlag(parser)
flags.AddResourceManagerTagsCreate(parser, for_node_pool=True)
flags.AddSecondaryBootDisksArgs(parser)
flags.AddAcceleratorNetworkProfileFlag(parser, hidden=False)
linked_runner_group = parser.add_group(mutex=True, hidden=True)
flags.AddRunnerPoolControlModeFlag(linked_runner_group, hidden=True)
runner_pool_group = linked_runner_group.add_group()
flags.AddControlNodePoolFlag(runner_pool_group, hidden=True)
attestation_group = runner_pool_group.add_group(
help='Settings for attestation.')
flags.AddEnableAttestationFlag(attestation_group, hidden=True)
flags.AddTeePolicyFlag(attestation_group, hidden=True)
Create.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,120 @@
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Delete node pool command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
DETAILED_HELP = {
'DESCRIPTION':
"""\
*{command}* deletes a node pool from a Google Kubernetes Engine (GKE)
cluster. When you delete a node pool, GKE drains all the nodes in the
node pool. The draining process involves GKE deleting Pods on each node
in the node pool. Each node in a node pool is drained by deleting Pods
with an allotted graceful termination period of `MAX_POD`. `MAX_POD` is
the maximum `terminationGracePeriodSeconds` set on the Pods scheduled to
the node with a cap of one hour.
""",
'EXAMPLES':
"""\
To delete the "node-pool-1" node pool from the cluster
"sample-cluster", run:
$ {command} node-pool-1 --cluster=sample-cluster
""",
}
class Delete(base.DeleteCommand):
"""Delete an existing node pool in a running cluster."""
@staticmethod
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,
hidden=True,
help='THIS ARGUMENT NEEDS HELP TEXT.')
flags.AddAsyncFlag(parser)
flags.AddNodePoolClusterFlag(
parser, 'The cluster from which to delete the node pool.')
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
pool_ref = adapter.ParseNodePool(args.name, location)
console_io.PromptContinue(
message=('The following node pool will be deleted.\n'
'[{name}] in cluster [{clusterId}] in [{zone}]').format(
name=pool_ref.nodePoolId,
clusterId=pool_ref.clusterId,
zone=adapter.Zone(pool_ref)),
throw_if_unattended=True,
cancel_on_no=True)
try:
# Make sure it exists (will raise appropriate error if not)
adapter.GetNodePool(pool_ref)
op_ref = adapter.DeleteNodePool(pool_ref)
if args.async_:
op = adapter.GetOperation(op_ref)
if not args.IsSpecified('format'):
args.format = util.OPERATIONS_FORMAT
return op
adapter.WaitForOperation(
op_ref,
'Deleting node pool {0}'.format(pool_ref.nodePoolId),
timeout_s=args.timeout)
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
log.DeletedResource(pool_ref)
return op_ref
Delete.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Describe node pool command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
@base.DefaultUniverseOnly
class Describe(base.DescribeCommand):
"""Describe an existing node pool for a cluster.
*{command}* displays all data associated with the node pool in the
Google Kubernetes Engine cluster.
"""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To describe a node pool of an existing cluster, run:
$ {command} node-pool-1 --cluster=sample-cluster
""",
}
@staticmethod
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.')
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
try:
nodepool = adapter.GetNodePool(adapter.ParseNodePool(args.name, location))
util.CheckForCgroupModeV1(nodepool)
return nodepool
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)

View File

@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Get node pool upgrade info command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
@base.UniverseCompatible
class GetUpgradeInfo(base.Command):
"""Get upgrade information for an existing node pool for a cluster.
*{command}* displays all upgrade information associated with the node pool in
the Google Kubernetes Engine cluster.
"""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To get upgrade information for a node pool of an existing cluster,
run:
$ {command} node-pool-1 --cluster=sample-cluster
""",
}
@staticmethod
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.')
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
try:
return adapter.GetNodePoolUpgradeInfo(adapter.ParseNodePool(args.name,
location))
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)

View File

@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""List node pools command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import properties
DETAILED_HELP = {
'DESCRIPTION':
"""\
*{command}* displays all node pools in the Google Kubernetes Engine
cluster.
""",
'EXAMPLES':
"""\
To list all node pools in the cluster "sample-cluster" in table form,
run:
$ {command} --cluster=sample-cluster
""",
}
@base.DefaultUniverseOnly
class List(base.ListCommand):
"""List existing node pools for a cluster."""
@staticmethod
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.')
parser.display_info.AddFormat(util.NODEPOOLS_FORMAT)
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
cluster = properties.VALUES.container.cluster.Get(required=True)
cluster_ref = adapter.ParseCluster(cluster, location)
try:
res = adapter.ListNodePools(cluster_ref)
for node_pool in res.nodePools:
util.CheckForCgroupModeV1(node_pool)
return res.nodePools
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
List.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,141 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Rollback node pool command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
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.')
flags.AddRespectPodDisruptionBudgetFlag(parser)
parser.add_argument(
'--timeout',
type=int,
default=1800, # Seconds
hidden=True,
help='THIS ARGUMENT NEEDS HELP TEXT.')
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Rollback(base.Command):
"""Rollback a node-pool upgrade."""
@staticmethod
def Args(parser):
_Args(parser)
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Some value that we want to have printed later.
Raises:
util.Error, if rollback failed.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
pool_ref = adapter.ParseNodePool(args.name, location)
console_io.PromptContinue(
message='Node Pool: [{node_pool_id}], of Cluster: [{cluster_name}] '
'will be rolled back to previous configuration. This operation is '
'long-running and will block other operations on the cluster '
'(including delete) until it has run to completion.'.format(
node_pool_id=pool_ref.nodePoolId, cluster_name=pool_ref.clusterId),
throw_if_unattended=True,
cancel_on_no=True)
try:
# Make sure it exists (will raise appropriate error if not)
adapter.GetNodePool(pool_ref)
op_ref = adapter.RollbackUpgrade(pool_ref, respect_pdb=args.respect_pdb)
if not args.async_:
adapter.WaitForOperation(
op_ref,
'Rolling back {0}'.format(pool_ref.nodePoolId),
timeout_s=args.timeout)
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
log.UpdatedResource(pool_ref)
return op_ref
@base.ReleaseTracks(base.ReleaseTrack.BETA)
class RollbackBeta(Rollback):
"""Rollback a node-pool upgrade."""
@staticmethod
def Args(parser):
_Args(parser)
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class RollbackAlpha(Rollback):
"""Rollback a node-pool upgrade."""
@staticmethod
def Args(parser):
_Args(parser)
Rollback.detailed_help = {
'brief':
'Rollback a node-pool upgrade.',
'DESCRIPTION':
"""
Rollback a node-pool upgrade.
Rollback is a method used after a canceled or failed node-pool upgrade. It
makes a best-effort attempt to revert the pool back to its original state.
""",
'EXAMPLES':
"""\
To roll back a canceled or failed upgrade in "node-pool-1" in the
cluster "sample-cluster", run:
$ {command} node-pool-1 --cluster=sample-cluster
""",
}

View File

@@ -0,0 +1,547 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Update node pool command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.compute import utils
from googlecloudsdk.api_lib.container import api_adapter
from googlecloudsdk.api_lib.container import util
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.container import flags
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
DETAILED_HELP = {
'DESCRIPTION':
"""\
*{command}* updates a node pool in a Google Kubernetes Engine cluster.
""",
'EXAMPLES':
"""\
To turn on node autoupgrade in "node-pool-1" in the cluster
"sample-cluster", run:
$ {command} node-pool-1 --cluster=sample-cluster --enable-autoupgrade
""",
}
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.')
flags.AddAsyncFlag(parser)
# Timeout in seconds for operation
parser.add_argument(
'--timeout',
type=int,
default=1800,
hidden=True,
help='THIS ARGUMENT NEEDS HELP TEXT.')
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.UniverseCompatible
class Update(base.UpdateCommand):
"""Updates a node pool in a running cluster."""
@staticmethod
def Args(parser):
_Args(parser)
group = parser.add_mutually_exclusive_group(required=True)
flags.AddNodePoolLocationsFlag(group)
node_management_group = group.add_argument_group('Node management')
flags.AddEnableAutoRepairFlag(node_management_group, for_node_pool=True)
flags.AddEnableAutoUpgradeFlag(node_management_group, for_node_pool=True)
flags.AddAcceleratorArgs(
group,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_driver_installation=True,
hidden=False,
)
autoscaling_group = flags.AddClusterAutoscalingFlags(group)
flags.AddNodePoolAutoprovisioningFlag(autoscaling_group, hidden=False)
flags.AddWorkloadMetadataFlag(group)
upgrade_settings_group = group.add_argument_group('Upgrade settings')
flags.AddEnableSurgeUpgradeFlag(upgrade_settings_group)
flags.AddSurgeUpgradeFlag(upgrade_settings_group, for_node_pool=True)
flags.AddMaxUnavailableUpgradeFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddEnableBlueGreenUpgradeFlag(upgrade_settings_group)
flags.AddStandardRolloutPolicyFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddAutoscaledRolloutPolicyFlag(upgrade_settings_group)
flags.AddNodePoolSoakDurationFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddSystemConfigFlag(group, hidden=False)
flags.AddLabelsFlag(group, for_node_pool=True)
flags.AddNodeLabelsFlag(group, for_node_pool=True, for_update=True)
flags.AddNodeTaintsFlag(group, for_node_pool=True, for_update=True)
flags.AddTagsNodePoolUpdate(group)
flags.AddEnableGvnicFlag(group)
flags.AddEnableImageStreamingFlag(group, for_node_pool=True)
flags.AddEnableConfidentialNodesFlag(
group, for_node_pool=True, is_update=True)
flags.AddConfidentialNodeTypeFlag(group, for_node_pool=True, is_update=True)
flags.AddNetworkPerformanceConfigFlags(group, hidden=False)
flags.AddNodePoolEnablePrivateNodes(group)
flags.AddEnableFastSocketFlag(group)
flags.AddLoggingVariantFlag(group, for_node_pool=True)
flags.AddWindowsOsVersionFlag(group)
flags.AddContainerdConfigFlag(group)
flags.AddStoragePoolsFlag(
group, for_node_pool=True, for_create=False)
flags.AddResourceManagerTagsNodePoolUpdate(group)
flags.AddQueuedProvisioningFlag(group)
flags.AddConsolidationDelayFlag(group, hidden=True)
flags.AddMaxRunDurationFlag(group)
flags.AddFlexStartFlag(group)
flags.AddEnableKubeletReadonlyPortFlag(group)
node_config_group = group.add_argument_group('Node config')
flags.AddMachineTypeFlag(node_config_group, update=True)
flags.AddDiskTypeFlag(node_config_group)
flags.AddDiskSizeFlag(node_config_group)
flags.AddBootDiskProvisionedThroughputFlag(node_config_group)
flags.AddBootDiskProvisionedIopsFlag(node_config_group)
flags.AddEnableKernelModuleSignatureEnforcementFlag(
group, for_node_pool=True
)
flags.AddEnableLustreMultiRailFlag(group, for_node_pool=True, hidden=True)
def ParseUpdateNodePoolOptions(self, args):
flags.ValidateSurgeUpgradeSettings(args)
return api_adapter.UpdateNodePoolOptions(
accelerators=args.accelerator,
enable_autorepair=args.enable_autorepair,
enable_autoupgrade=args.enable_autoupgrade,
enable_autoscaling=args.enable_autoscaling,
node_locations=args.node_locations,
max_nodes=args.max_nodes,
min_nodes=args.min_nodes,
total_max_nodes=args.total_max_nodes,
total_min_nodes=args.total_min_nodes,
location_policy=args.location_policy,
workload_metadata=args.workload_metadata,
workload_metadata_from_node=args.workload_metadata_from_node,
enable_autoprovisioning=args.enable_autoprovisioning,
max_surge_upgrade=args.max_surge_upgrade,
max_unavailable_upgrade=args.max_unavailable_upgrade,
system_config_from_file=args.system_config_from_file,
labels=args.labels,
node_labels=args.node_labels,
node_taints=args.node_taints,
tags=args.tags,
gvnic=args.enable_gvnic,
enable_image_streaming=args.enable_image_streaming,
network_performance_config=args.network_performance_configs,
enable_confidential_nodes=args.enable_confidential_nodes,
confidential_node_type=args.confidential_node_type,
enable_blue_green_upgrade=args.enable_blue_green_upgrade,
enable_surge_upgrade=args.enable_surge_upgrade,
node_pool_soak_duration=args.node_pool_soak_duration,
standard_rollout_policy=args.standard_rollout_policy,
autoscaled_rollout_policy=args.autoscaled_rollout_policy,
enable_private_nodes=args.enable_private_nodes,
enable_fast_socket=args.enable_fast_socket,
logging_variant=args.logging_variant,
windows_os_version=args.windows_os_version,
containerd_config_from_file=args.containerd_config_from_file,
storage_pools=args.storage_pools,
enable_queued_provisioning=args.enable_queued_provisioning,
max_run_duration=args.max_run_duration,
consolidation_delay=args.consolidation_delay,
flex_start=args.flex_start,
machine_type=args.machine_type,
disk_type=args.disk_type,
enable_insecure_kubelet_readonly_port=args.enable_insecure_kubelet_readonly_port,
disk_size_gb=utils.BytesToGb(args.disk_size)
if hasattr(args, 'disk_size')
else None,
resource_manager_tags=args.resource_manager_tags,
boot_disk_provisioned_iops=args.boot_disk_provisioned_iops,
boot_disk_provisioned_throughput=args.boot_disk_provisioned_throughput,
enable_kernel_module_signature_enforcement=args.enable_kernel_module_signature_enforcement,
enable_lustre_multi_nic=args.enable_lustre_multi_nic,
)
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
Cluster message for the successfully updated node pool.
Raises:
util.Error, if creation failed.
"""
adapter = self.context['api_adapter']
location_get = self.context['location_get']
location = location_get(args)
pool_ref = adapter.ParseNodePool(args.name, location)
options = self.ParseUpdateNodePoolOptions(args)
if options.node_labels is not None:
console_io.PromptContinue(
message=(
'The previous user-specified labels on this node pool will be '
'replaced by \'{labels}\'').format(
labels=args.GetValue('node_labels')),
throw_if_unattended=True,
cancel_on_no=True)
if options.node_taints is not None:
console_io.PromptContinue(
message=(
'The previous user-specified taints on this node pool will be '
'replaced by \'{taints}\'').format(
taints=args.GetValue('node_taints')),
throw_if_unattended=True,
cancel_on_no=True)
if options.tags is not None:
console_io.PromptContinue(
message=('The previous user-specified tags on this node pool will be '
'replaced by \'{tags}\'').format(tags=args.GetValue('tags')),
throw_if_unattended=True,
cancel_on_no=True)
# Image streaming feature requires Container File System API to be enabled.
# Checking whether the API has been enabled, and warning if not.
if options.enable_image_streaming:
util.CheckForContainerFileSystemApiEnablementWithPrompt(
pool_ref.projectId)
try:
operation_ref = adapter.UpdateNodePool(pool_ref, options)
if args.async_:
op = adapter.GetOperation(operation_ref)
if not args.IsSpecified('format'):
args.format = util.OPERATIONS_FORMAT
return op
adapter.WaitForOperation(
operation_ref,
'Updating node pool {0}'.format(pool_ref.nodePoolId),
timeout_s=args.timeout)
pool = adapter.GetNodePool(pool_ref)
util.CheckForCgroupModeV1(pool)
except apitools_exceptions.HttpError as error:
raise exceptions.HttpException(error, util.HTTP_ERROR_FORMAT)
log.UpdatedResource(pool_ref)
return pool
@base.ReleaseTracks(base.ReleaseTrack.BETA)
class UpdateBeta(Update):
"""Updates a node pool in a running cluster."""
@staticmethod
def Args(parser):
_Args(parser)
group = parser.add_mutually_exclusive_group(required=True)
node_management_group = group.add_argument_group('Node management')
flags.AddEnableAutoRepairFlag(node_management_group, for_node_pool=True)
flags.AddEnableAutoUpgradeFlag(node_management_group, for_node_pool=True)
flags.AddAcceleratorArgs(
group,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_driver_installation=True,
hidden=False,
)
autoscaling_group = flags.AddClusterAutoscalingFlags(group)
flags.AddNodePoolAutoprovisioningFlag(autoscaling_group, hidden=False)
upgrade_settings_group = group.add_argument_group('Upgrade settings')
flags.AddEnableSurgeUpgradeFlag(upgrade_settings_group)
flags.AddSurgeUpgradeFlag(upgrade_settings_group, for_node_pool=True)
flags.AddMaxUnavailableUpgradeFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddEnableBlueGreenUpgradeFlag(upgrade_settings_group)
flags.AddStandardRolloutPolicyFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddAutoscaledRolloutPolicyFlag(upgrade_settings_group)
flags.AddNodePoolSoakDurationFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddWorkloadMetadataFlag(group, use_mode=False)
flags.AddNodePoolLocationsFlag(group)
flags.AddSystemConfigFlag(group, hidden=False)
flags.AddLabelsFlag(group, for_node_pool=True)
flags.AddNodeLabelsFlag(group, for_node_pool=True, for_update=True)
flags.AddNodeTaintsFlag(group, for_node_pool=True, for_update=True)
flags.AddTagsNodePoolUpdate(group)
flags.AddNodePoolEnablePrivateNodes(group)
flags.AddEnableGcfsFlag(group, for_node_pool=True)
flags.AddEnableGvnicFlag(group)
flags.AddEnableImageStreamingFlag(group, for_node_pool=True)
flags.AddNetworkPerformanceConfigFlags(group, hidden=False)
flags.AddEnableConfidentialNodesFlag(
group, for_node_pool=True, is_update=True)
flags.AddConfidentialNodeTypeFlag(group, for_node_pool=True, is_update=True)
flags.AddEnableFastSocketFlag(group)
flags.AddLoggingVariantFlag(group, for_node_pool=True)
flags.AddWindowsOsVersionFlag(group)
flags.AddResourceManagerTagsNodePoolUpdate(group)
flags.AddContainerdConfigFlag(group)
flags.AddStoragePoolsFlag(
group, for_node_pool=True, for_create=False)
flags.AddQueuedProvisioningFlag(group)
flags.AddConsolidationDelayFlag(group, hidden=True)
flags.AddMaxRunDurationFlag(group)
flags.AddFlexStartFlag(group)
flags.AddEnableKubeletReadonlyPortFlag(group)
node_config_group = group.add_argument_group('Node config')
flags.AddMachineTypeFlag(node_config_group, update=True)
flags.AddDiskTypeFlag(node_config_group)
flags.AddDiskSizeFlag(node_config_group)
flags.AddBootDiskProvisionedThroughputFlag(node_config_group)
flags.AddBootDiskProvisionedIopsFlag(node_config_group)
flags.AddEnableKernelModuleSignatureEnforcementFlag(
group, for_node_pool=True
)
flags.AddEnableLustreMultiRailFlag(group, for_node_pool=True, hidden=True)
def ParseUpdateNodePoolOptions(self, args):
flags.ValidateSurgeUpgradeSettings(args)
ops = api_adapter.UpdateNodePoolOptions(
accelerators=args.accelerator,
enable_autorepair=args.enable_autorepair,
enable_autoupgrade=args.enable_autoupgrade,
enable_autoscaling=args.enable_autoscaling,
max_nodes=args.max_nodes,
min_nodes=args.min_nodes,
total_max_nodes=args.total_max_nodes,
total_min_nodes=args.total_min_nodes,
location_policy=args.location_policy,
enable_autoprovisioning=args.enable_autoprovisioning,
workload_metadata=args.workload_metadata,
workload_metadata_from_node=args.workload_metadata_from_node,
node_locations=args.node_locations,
max_surge_upgrade=args.max_surge_upgrade,
max_unavailable_upgrade=args.max_unavailable_upgrade,
system_config_from_file=args.system_config_from_file,
labels=args.labels,
node_labels=args.node_labels,
node_taints=args.node_taints,
tags=args.tags,
enable_private_nodes=args.enable_private_nodes,
enable_gcfs=args.enable_gcfs,
gvnic=args.enable_gvnic,
enable_image_streaming=args.enable_image_streaming,
enable_blue_green_upgrade=args.enable_blue_green_upgrade,
enable_surge_upgrade=args.enable_surge_upgrade,
node_pool_soak_duration=args.node_pool_soak_duration,
standard_rollout_policy=args.standard_rollout_policy,
autoscaled_rollout_policy=args.autoscaled_rollout_policy,
network_performance_config=args.network_performance_configs,
enable_confidential_nodes=args.enable_confidential_nodes,
confidential_node_type=args.confidential_node_type,
enable_fast_socket=args.enable_fast_socket,
logging_variant=args.logging_variant,
windows_os_version=args.windows_os_version,
resource_manager_tags=args.resource_manager_tags,
containerd_config_from_file=args.containerd_config_from_file,
storage_pools=args.storage_pools,
enable_queued_provisioning=args.enable_queued_provisioning,
max_run_duration=args.max_run_duration,
consolidation_delay=args.consolidation_delay,
flex_start=args.flex_start,
machine_type=args.machine_type,
disk_type=args.disk_type,
enable_insecure_kubelet_readonly_port=args.enable_insecure_kubelet_readonly_port,
disk_size_gb=utils.BytesToGb(args.disk_size)
if hasattr(args, 'disk_size')
else None,
boot_disk_provisioned_iops=args.boot_disk_provisioned_iops,
boot_disk_provisioned_throughput=args.boot_disk_provisioned_throughput,
enable_kernel_module_signature_enforcement=args.enable_kernel_module_signature_enforcement,
enable_lustre_multi_nic=args.enable_lustre_multi_nic,
)
return ops
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class UpdateAlpha(Update):
"""Updates a node pool in a running cluster."""
@staticmethod
def Args(parser):
_Args(parser)
group = parser.add_mutually_exclusive_group(required=True)
node_management_group = group.add_argument_group('Node management')
flags.AddEnableAutoRepairFlag(node_management_group, for_node_pool=True)
flags.AddEnableAutoUpgradeFlag(node_management_group, for_node_pool=True)
flags.AddAcceleratorArgs(
group,
enable_gpu_partition=True,
enable_gpu_sharing=True,
enable_gpu_driver_installation=True,
hidden=False,
)
autoscaling_group = flags.AddClusterAutoscalingFlags(group)
flags.AddNodePoolAutoprovisioningFlag(autoscaling_group, hidden=False)
upgrade_settings_group = group.add_argument_group('Upgrade settings')
flags.AddEnableSurgeUpgradeFlag(upgrade_settings_group)
flags.AddSurgeUpgradeFlag(upgrade_settings_group, for_node_pool=True)
flags.AddMaxUnavailableUpgradeFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddEnableBlueGreenUpgradeFlag(upgrade_settings_group)
flags.AddStandardRolloutPolicyFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddAutoscaledRolloutPolicyFlag(upgrade_settings_group)
flags.AddNodePoolSoakDurationFlag(
upgrade_settings_group, for_node_pool=True)
flags.AddWorkloadMetadataFlag(group, use_mode=False)
flags.AddNodePoolLocationsFlag(group)
flags.AddSystemConfigFlag(group, hidden=False)
flags.AddLabelsFlag(group, for_node_pool=True)
flags.AddNodeLabelsFlag(group, for_node_pool=True, for_update=True)
flags.AddNodeTaintsFlag(group, for_node_pool=True, for_update=True)
flags.AddTagsNodePoolUpdate(group)
flags.AddNodePoolEnablePrivateNodes(group)
flags.AddEnableGcfsFlag(group, for_node_pool=True)
flags.AddEnableGvnicFlag(group)
flags.AddEnableImageStreamingFlag(group, for_node_pool=True)
flags.AddNetworkPerformanceConfigFlags(group, hidden=False)
flags.AddEnableConfidentialNodesFlag(
group, for_node_pool=True, is_update=True)
flags.AddConfidentialNodeTypeFlag(group, for_node_pool=True, is_update=True)
flags.AddEnableFastSocketFlag(group)
flags.AddLoggingVariantFlag(group, for_node_pool=True)
flags.AddWindowsOsVersionFlag(group)
flags.AddResourceManagerTagsNodePoolUpdate(group)
flags.AddContainerdConfigFlag(group)
flags.AddStoragePoolsFlag(
group, for_node_pool=True, for_create=False)
flags.AddQueuedProvisioningFlag(group)
flags.AddConsolidationDelayFlag(group, hidden=True)
flags.AddMaxRunDurationFlag(group)
flags.AddFlexStartFlag(group)
flags.AddEnableKubeletReadonlyPortFlag(group)
node_config_group = group.add_argument_group('Node config')
flags.AddMachineTypeFlag(node_config_group, update=True)
flags.AddDiskTypeFlag(node_config_group)
flags.AddDiskSizeFlag(node_config_group)
flags.AddBootDiskProvisionedThroughputFlag(node_config_group)
flags.AddBootDiskProvisionedIopsFlag(node_config_group)
flags.AddEnableKernelModuleSignatureEnforcementFlag(
group, for_node_pool=True
)
flags.AddEnableLustreMultiRailFlag(group, for_node_pool=True, hidden=True)
def ParseUpdateNodePoolOptions(self, args):
flags.ValidateSurgeUpgradeSettings(args)
ops = api_adapter.UpdateNodePoolOptions(
accelerators=args.accelerator,
enable_autorepair=args.enable_autorepair,
enable_autoupgrade=args.enable_autoupgrade,
enable_autoscaling=args.enable_autoscaling,
max_nodes=args.max_nodes,
min_nodes=args.min_nodes,
total_max_nodes=args.total_max_nodes,
total_min_nodes=args.total_min_nodes,
location_policy=args.location_policy,
enable_autoprovisioning=args.enable_autoprovisioning,
workload_metadata=args.workload_metadata,
workload_metadata_from_node=args.workload_metadata_from_node,
node_locations=args.node_locations,
max_surge_upgrade=args.max_surge_upgrade,
max_unavailable_upgrade=args.max_unavailable_upgrade,
system_config_from_file=args.system_config_from_file,
labels=args.labels,
node_labels=args.node_labels,
node_taints=args.node_taints,
tags=args.tags,
enable_private_nodes=args.enable_private_nodes,
enable_gcfs=args.enable_gcfs,
gvnic=args.enable_gvnic,
enable_image_streaming=args.enable_image_streaming,
enable_blue_green_upgrade=args.enable_blue_green_upgrade,
enable_surge_upgrade=args.enable_surge_upgrade,
node_pool_soak_duration=args.node_pool_soak_duration,
standard_rollout_policy=args.standard_rollout_policy,
autoscaled_rollout_policy=args.autoscaled_rollout_policy,
network_performance_config=args.network_performance_configs,
enable_confidential_nodes=args.enable_confidential_nodes,
confidential_node_type=args.confidential_node_type,
enable_fast_socket=args.enable_fast_socket,
logging_variant=args.logging_variant,
windows_os_version=args.windows_os_version,
resource_manager_tags=args.resource_manager_tags,
containerd_config_from_file=args.containerd_config_from_file,
storage_pools=args.storage_pools,
enable_queued_provisioning=args.enable_queued_provisioning,
max_run_duration=args.max_run_duration,
consolidation_delay=args.consolidation_delay,
flex_start=args.flex_start,
machine_type=args.machine_type,
disk_type=args.disk_type,
enable_insecure_kubelet_readonly_port=args.enable_insecure_kubelet_readonly_port,
disk_size_gb=utils.BytesToGb(args.disk_size)
if hasattr(args, 'disk_size')
else None,
boot_disk_provisioned_iops=args.boot_disk_provisioned_iops,
boot_disk_provisioned_throughput=args.boot_disk_provisioned_throughput,
enable_kernel_module_signature_enforcement=args.enable_kernel_module_signature_enforcement,
enable_lustre_multi_nic=args.enable_lustre_multi_nic,
)
return ops
Update.detailed_help = DETAILED_HELP