
                             S r SSKJr  SSKJr  SSKJr  SSK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&                  \R&                  \R(                  5      rg)zCRemoves configuration properties from Policy Controller components.    )absolute_import)division)unicode_literalsN)protos)base)command)deployment_configs)flags)
exceptionsc                   B    \ rS rSrSrSrSr\S 5       rS r	S r
S rSrg	)
Remove   aL  Removes configuration properties from Policy Controller components.

Remove customizations of on-cluster components in Policy Controller. These
components are managed as individual kubernetes deployments (e.g. 'admission')
in the gatekeeper-system namespace.

When removing a 'toleration' property, it must match exactly, including the
key, value and effect flag (if originally specified).

## EXAMPLES

To remove the replica count for a component:

  $ {command} admission replica-count

To remove the replica count for a component across all fleet memberships:

  $ {command} admission replica-count --all-memberships

To remove a toleration with key 'my-key' on a component:

  $ {command} admission toleration my-key

To remove a toleration with key 'my-key' and 'my-value' on a component:

  $ {command} admission toleration my-key=my-value

To remove a toleration with key 'my-key' and 'my-value' on a component, along
with the effect 'NoSchedule':

  $ {command} admission toleration my-key=my-value --effect=NoSchedule

To remove a memory limit:

  $ {command} audit memory-limit

To remove a memory request:

  $ {command} mutation memory-request

To remove a cpu limit:

  $ {command} admission cpu-limit

To remove a cpu request:

  $ {command} audit cpu-request

To remove the anti-affinity configuration:

  $ {command} admission pod-affinity
policycontrollerc                 V   [         R                  " US5      nUR                  5         UR                  S[        R
                  SS9  UR                  S[        R                  SS9  UR                  S[        R                  S SS	9  UR                  S
[        R                  S[        S9  g )Nzremove deployment configuration
deploymentzwThe PolicyController deployment component (i.e, "admission",  "audit" or "mutation" from which to remove configuration.)choiceshelppropertyzProperty to be removed.valuez_This is only required to remove a toleration. It should not be included for any other property.)nargsdefaultr   z--effectzsApplies only to "toleration" property. To be removed, tolerations must match exactly, including the effect setting.)r   r   type)r
   	PocoFlagsadd_membershipsadd_argumentr   G8R_COMPONENTSSUPPORTED_PROPERTIESargparseOPTIONALK8S_SCHEDULING_OPTIONSstr)clsparser	cmd_flagss      Alib/surface/container/fleet/policycontroller/deployment/remove.pyArgsRemove.ArgsX   s    (IJI
))I	   //&  
 0   11A       c           	          U R                  U5      nUR                  5        VVs0 s H  u  p4X0R                  XA5      _M     nnnU R                  U5      $ s  snnf N)
path_specsitemsremoveupdate_specs)selfargsspecspathspecupdated_specss         r%   Run
Remove.Run}   sX    OOD!E8=8E*$kk$%%   ]++s   Ac                    [         R                  " UR                  R                  R                  5      nUR                  UR                  U R                  R                  5       5      nU R                  UUR                  UR                  UR                  5      X2R                  '   [         R                  " U R                  R                  R                  5       U5      nXQR                  R                  l        U$ r*   )r   additional_properties_to_dictr   policyControllerHubConfigdeploymentConfigsgetr   messages0PolicyControllerPolicyControllerDeploymentConfigset_deployment_configr   r   effectset_additional_propertiesPolicyControllerHubConfigDeploymentConfigsValue)r/   r3   r0   cfgsdeployment_cfgdcvs         r%   r-   Remove.remove   s    //77IID XXFFHN
 !66

	D 
*
*//FFH$C IL33EKr(   c                 l   US:X  a  [         R                  " XU5      $ Ub  [        R                  " S5      eUb  [        R                  " S5      eUS:X  a"  [         R                  " U R
                  US 5      $ US:X  a"  [         R                  " U R
                  US 5      $ US:X  a"  [         R                  " U R
                  US 5      $ US:X  a"  [         R                  " U R
                  US 5      $ US:X  a  [         R                  " US 5      $ US	:X  a"  [         R                  " U R
                  US 5      $ g )
N
tolerationz:"value" argument only accepted when removing a toleration.z7"effect" flag only accepted when removing a toleration.z	cpu-limitzcpu-requestzmemory-limitzmemory-requestzreplica-countzpod-affinity)r   remove_tolerationr   Errorupdate_cpu_limitr<   update_cpu_requestupdate_mem_limitupdate_mem_requestupdate_replica_countupdate_pod_affinity)r/   rD   propr   r?   s        r%   r>   Remove.set_deployment_config   s   |)).HH
F  
C  {((MM}**4==.$OO~((MM**4==.$OO,,^TBB~++DMM>4PP r(    N)__name__
__module____qualname____firstlineno____doc__feature_namemf_nameclassmethodr&   r5   r-   r>   __static_attributes__rS   r(   r%   r   r      s7    3j $,'" "H,.Qr(   r   )rX   
__future__r   r   r   r   7googlecloudsdk.api_lib.container.fleet.policycontrollerr   3googlecloudsdk.command_lib.container.fleet.featuresr   =googlecloudsdk.command_lib.container.fleet.membershipfeaturesmf_base;googlecloudsdk.command_lib.container.fleet.policycontrollerr   r	   r   r
   googlecloudsdk.corer   UpdateCommandPocoCommandr   rS   r(   r%   <module>rf      sR    J &  '  J D Y O h M *SQT!6!68K8K SQr(   