
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSK
Jr  SSK
Jr  SS	KJr  SS
KJr  SSKJr  SSKJr   " S S\R(                  5      rSSSS.\l        g)zResize cluster command.    )absolute_import)division)unicode_literals)
exceptions)util)actions)base)flags)log)console_attr)
console_ioc                   .    \ rS rSrSr\S 5       rS rSrg)Resize!   3Resizes an existing cluster for running containers.c           
         U R                  SSS9  U R                  SS9nUR                  S[        S[        R                  " SSS	9S
S9  UR                  S[        S
S9  U R                  SSS9  [
        R                  " U 5        g)zRegister 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.
namezThe name of this cluster.)helpT)requiredz--size	num_nodeszIThe {flag_name} flag is now deprecated. Please use `--num-nodes` instead.)warnz&Target number of nodes in the cluster.)typedestactionr   z--num-nodes)r   r   z--node-poolzThe node pool to resize.N)add_argumentadd_mutually_exclusive_groupintr   DeprecationActionr
   AddAsyncFlag)parsergroups     (lib/surface/container/clusters/resize.pyArgsResize.Args$   s     %@A///>E	((/45 6  7 
5  7 ,FG	v    c                    U R                   S   nU R                   S   nU" U5      nUR                  UR                  U5      nSnUR                  nUR                  (       a  UR                  OSn UR	                  U5      nUR                  nUb%  UR!                  XaR                  5      R                  n["        R$                  " SR                  UUUR&                  S9SSS	9  UR)                  XXUR&                  5      n
UR*                  (       d+  UR-                  U
S
R                  UR.                  5      5        [        R0                  " U5        g! [
        R                  [        R                  [        R                  4 aD  n	[        R                  " SR                  [        R                  " U	5      5      5         Sn	A	GN8Sn	A	ff = f)zThis 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.
api_adapterlocation_getNzdefault-poolz`Problem loading details of cluster to resize:

{}

You can still attempt to resize the cluster.
z_Pool [{pool}] for [{cluster_name}] will be resized to {new_size} node(s) in each zone it spans.)poolcluster_namenew_sizeT)messagethrow_if_unattendedcancel_on_nozResizing {0})contextParseClusterr   	node_pool
GetClusterr   HttpExceptionapitools_exceptionsHttpForbiddenErrorr   Errorr   warningformatr   SafeTextFindNodePoolr   PromptContinuer   ResizeNodePoolasync_WaitForOperation	clusterIdUpdatedResource)selfargsadapterr(   locationcluster_refclusterr*   	pool_nameerrorop_refs              r"   Run
Resize.Run>   s    ll=)G<</LD!H&&tyy(;KG99L"&..nI
6 "";/g\\l &&w?DDi=>Df#"."nn ?E ?. ! ##KDNNKF;;v-44[5J5JKM$/ $$&9&L&LJJ 6	kk DEKV#,,U3F56 66s   1E 3G9GG N)	__name__
__module____qualname____firstlineno____doc__staticmethodr#   rJ   __static_attributes__rL   r%   r"   r   r   !   s    ; 2+%r%   r   r   a3  
        Resize an existing cluster to a provided size.

If you have multiple node pools, you must specify which node pool to resize by
using the --node-pool flag. You are not required to use the flag if you have
a single node pool.

When increasing the size of a container cluster, the new instances are created
with the same configuration as the existing instances.
Existing pods are not moved onto the new instances,
but new pods (such as those created by resizing a replication controller)
will be scheduled onto the new instances.

When decreasing a cluster, the nodes are drained. As a result, the pods running
on these nodes are gracefully terminated. If your pods are being managed by a
workload controller, the controller will attempt to reschedule them onto the
remaining instances. If your pods are not managed by a workload controller,
they will not be restarted.
Note that when resizing down, instances running pods and instances without pods
are not differentiated. Resize will pick instances to remove at random.

When you resize a node pool that spans multiple zones, the new size represents
the number of nodes in the node pool per zone. For example, if you have a node
pool of size 2 spanning two zones, the total node count is 4. If you resize the
node pool with `--num-nodes=4`, the total node count becomes 8.
z        To resize the default node pool of an existing cluster, run:

          $ {command} sample-cluster --num-nodes=2
        )briefDESCRIPTIONEXAMPLESN)rQ   
__future__r   r   r   apitools.base.pyr   r4    googlecloudsdk.api_lib.containerr   googlecloudsdk.callioper   r	   $googlecloudsdk.command_lib.containerr
   googlecloudsdk.corer   googlecloudsdk.core.consoler   r   Commandr   detailed_helprL   r%   r"   <module>r`      sZ     &  ' > 1 + ( . 6 # 4 2H%T\\ H%Z 	>	6	?$ r%   