From e8482e5a893208b452dc75802f34b997f58d0bcb Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 22 Sep 2026 03:23:03 +0100 Subject: [PATCH 1/3] fix(generator): preserve documented gcloud branch optionality --- ...cloud-cluster-director-clusters-update.txt | 854 ++++++++ .../gcloud-composer-environments-update.txt | 642 ++++++ .../gcloud-container-clusters-update.txt | 1937 +++++++++++++++++ .../GcloudNestedSynopsisValidationTests.cs | 54 +- .../GcloudPeerResourceValidationTests.cs | 11 +- .../Scrapers/Cli/GcloudCliScraper.cs | 9 + 6 files changed, 3504 insertions(+), 3 deletions(-) create mode 100644 tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-cluster-director-clusters-update.txt create mode 100644 tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-composer-environments-update.txt create mode 100644 tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-container-clusters-update.txt diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-cluster-director-clusters-update.txt b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-cluster-director-clusters-update.txt new file mode 100644 index 00000000000..c1eb4b7d75c --- /dev/null +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-cluster-director-clusters-update.txt @@ -0,0 +1,854 @@ +NAME + gcloud cluster-director clusters update - updates a Cluster Director + resource + +SYNOPSIS + gcloud cluster-director clusters update (CLUSTER : --location=LOCATION) + (--add-filestore-instances=[id=ID],[name=NAME] + --add-flex-start-instances=[id=ID], + [machineType=MACHINETYPE],[maxDuration=MAXDURATION],[zone=ZONE] + --add-labels=[ADD_LABELS,...] + --add-lustre-instances=[id=ID],[name=NAME] + --add-new-filestore-instances=[capacityGb=CAPACITYGB], + [description=DESCRIPTION],[fileshare=FILESHARE], + [id=ID],[name=NAME],[protocol=PROTOCOL],[tier=TIER] + --add-new-lustre-instances=[capacityGb=CAPACITYGB], + [description=DESCRIPTION],[filesystem=FILESYSTEM],[id=ID], + [name=NAME],[perUnitStorageThroughput=PERUNITSTORAGETHROUGHPUT] + --add-new-storage-buckets=[enableAutoclass=ENABLEAUTOCLASS], + [enableHNS=ENABLEHNS],[id=ID],[name=NAME],[storageClass=STORAGECLASS] + --add-on-demand-instances=[id=ID], + [machineType=MACHINETYPE],[zone=ZONE] + --add-reserved-instances=[id=ID],[reservation=RESERVATION] + --add-slurm-epilog-scripts=[ADD_SLURM_EPILOG_SCRIPTS,...] + --add-slurm-node-sets=[computeId=COMPUTEID], + [computeInstance=COMPUTEINSTANCE],[id=ID], + [maxDynamicNodeCount=MAXDYNAMICNODECOUNT], + [staticNodeCount=STATICNODECOUNT],[storageConfigs=STORAGECONFIGS] + --add-slurm-partitions=[id=ID],[nodeSetIds=NODESETIDS] + --add-slurm-prolog-scripts=[ADD_SLURM_PROLOG_SCRIPTS,...] + --add-spot-instances=[id=ID],[machineType=MACHINETYPE], + [terminationAction=TERMINATIONACTION],[zone=ZONE] + --add-storage-buckets=[id=ID],[name=NAME] --description=DESCRIPTION + --remove-filestore-instances=[REMOVE_FILESTORE_INSTANCES,...] + --remove-flex-start-instances=[REMOVE_FLEX_START_INSTANCES,...] + --remove-labels=[REMOVE_LABELS,...] + --remove-lustre-instances=[REMOVE_LUSTRE_INSTANCES,...] + --remove-on-demand-instances=[REMOVE_ON_DEMAND_INSTANCES,...] + --remove-reserved-instances=[REMOVE_RESERVED_INSTANCES,...] + --remove-slurm-epilog-scripts=[REMOVE_SLURM_EPILOG_SCRIPTS,...] + --remove-slurm-node-sets=[REMOVE_SLURM_NODE_SETS,...] + --remove-slurm-partitions=[REMOVE_SLURM_PARTITIONS,...] + --remove-slurm-prolog-scripts=[REMOVE_SLURM_PROLOG_SCRIPTS,...] + --remove-spot-instances=[REMOVE_SPOT_INSTANCES,...] + --remove-storage-buckets=[REMOVE_STORAGE_BUCKETS,...] + --slurm-default-partition=SLURM_DEFAULT_PARTITION + --update-slurm-login-node=[bootDisk=BOOTDISK], + [count=COUNT],[startupScript=STARTUPSCRIPT] + --update-slurm-node-sets=[computeId=COMPUTEID], + [computeInstance=COMPUTEINSTANCE],[id=ID], + [maxDynamicNodeCount=MAXDYNAMICNODECOUNT], + [staticNodeCount=STATICNODECOUNT],[storageConfigs=STORAGECONFIGS] + --update-slurm-partitions=[id=ID],[nodeSetIds=NODESETIDS] + | --config=[computeResources=COMPUTERESOURCES], + [description=DESCRIPTION],[labels=LABELS],[name=NAME], + [networkResources=NETWORKRESOURCES], + [orchestrator=ORCHESTRATOR],[storageResources=STORAGERESOURCES] + --update-mask=UPDATE_MASK) [--async] [GCLOUD_WIDE_FLAG ...] + +DESCRIPTION + gcloud cluster-director clusters update facilitates the updation of a + cluster resource. + + There are following ways to update a cluster: + o [Preferred] Use granular flags to update cluster specs, based on + read-modify-update pattern. + * Read the existing cluster specs through get cluster request. + * Modify the cluster specs through granular flags. + * Update the cluster specs through patch cluster request. + o Use --config with cluster specs and --update-mask flags, both in JSON + format. + * Map and repeated fields update requires existing and new values. + * For example, to update a cluster to add a new nodeset, use the + update mask "orchestrator.slurm.node_sets", and the patch cluster + must include all existing nodesets as well as the new one. + + Please refer to the examples below for more details. + +EXAMPLES + To update a cluster my-cluster in location us-central1-a with granular + flags, run the following example: + + Add labels, compute instances, slurm node sets, slurm partitions and update + description and default partition: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a \ + --description="My updated cluster description" \ + --add-labels=env=prod,client=gcloud-cli \ + --add-on-demand-instances=id=compute1,zone=us-central1-a,\ + machineType=n2-standard-2 \ + --add-reserved-instances=id=compute2,reservation=zones/\ + us-central1-a/reservations/{reservation} \ + --add-spot-instances=id=compute3,zone=us-central1-a,\ + machineType=n2-standard-2 \ + --add-flex-start-instances=id=compute4,zone=us-central1-a,\ + machineType=a4-highgpu-8g,maxDuration=10000s \ + --add-new-lustre-instances=lustre=locations/us-central1-a/\ + instances/lustre1,capacityGb=1024,filesystem=lustre1 \ + --add-lustre-instances=locations/us-central1-a/instances/\ + lustre0 --add-slurm-node-sets=id=nodeset1,computeId=compute1 \ + --add-slurm-node-sets=id=nodeset2,computeId=compute2 \ + --add-slurm-node-sets=id=nodeset3,computeId=compute3 \ + --add-slurm-node-sets=id=nodeset4,computeId=compute4 \ + --add-slurm-partitions=id=partition1,nodesetIds=[nodeset1] \ + --add-slurm-partitions=id=partition2,nodesetIds=[nodeset2,\ + nodeset3,nodeset4] --slurm-default-partition=partition1 + + Update slurm node sets and slurm partitions: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a \ + --update-slurm-node-sets=id=nodeset1,staticNodeCount=2,\ + maxDynamicNodeCount=10 \ + --update-slurm-partitions=id=partition1,nodesetIds=[nodeset0] + + Remove slurm node sets, slurm partitions and compute instances and update + default partition: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a --slurm-default-partition=partition0 \ + --remove-labels=env,client \ + --remove-lustre-instances=locations/us-central1-a/instances/\ + lustre0 --remove-slurm-partitions=partition1 \ + --remove-slurm-partitions=partition2 \ + --remove-slurm-node-sets=nodeset1 \ + --remove-slurm-node-sets=nodeset2 \ + --remove-slurm-node-sets=nodeset3 \ + --remove-slurm-node-sets=nodeset4 \ + --remove-on-demand-instances=compute1 \ + --remove-reserved-instances=compute2 \ + --remove-spot-instances=compute3 \ + --remove-flex-start-instances=compute4 + + Add and remove slurm prolog/epilog scripts: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a --add-slurm-prolog-scripts=script1.sh \ + --remove-slurm-epilog-scripts=script2.sh + + Or cluster my-cluster in location us-central1-a with config JSON run the + following JSON example: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a --update-mask=labels \ + --config='{"key": "value"}' + + Or create a JSON file my-cluster-config.json with the cluster specs and run + the following file example: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a --update-mask=labels \ + --config=my-cluster-config.json + + Or create a JSON file with the update mask and run the following file + example: + + $ gcloud cluster-director clusters update my-cluster \ + --location=us-central1-a --update-mask=my-update-mask.json \ + --config=my-cluster-config.json + +POSITIONAL ARGUMENTS + Cluster resource - Name of the cluster resource. Formats: cluster | + projects/{project}/locations/{locations}/clusters/{cluster} The arguments + in this group can be used to specify the attributes of this resource. + (NOTE) Some attributes are not given arguments in this group but can be + set in other ways. + + To set the project attribute: + * provide the argument cluster on the command line with a fully + specified name; + * provide the argument --project on the command line; + * set the property core/project. + + This must be specified. + + CLUSTER + ID of the cluster or fully qualified identifier for the cluster. + + To set the cluster attribute: + + provide the argument cluster on the command line. + + This positional argument must be specified if any of the other + arguments in this group are specified. + + --location=LOCATION + Location ID of the cluster resource. + + To set the location attribute: + + provide the argument cluster on the command line with a fully + specified name; + + provide the argument --location on the command line. + +REQUIRED FLAGS + Cluster configuration for provisioning with updates. + + Exactly one of these must be specified: + + Flag Configurations to define cluster updates. + + --add-filestore-instances=[id=ID],[name=NAME] + Reference of existing filestore instance. + + id: ID of the filestore resource, used to refer to this resource in + storage-configs. name: Name of the existing filestore instance to + import from your project in the format of + locations/us-central1/instances/filestore-1. + + For example --add-filestore-instances + id=my-fs,name=locations/us-central1/instances/filestore-1. + + Sets add_filestore_instances value. + + id + Required, sets id value. + + name + Required, sets name value. + + Shorthand Example: + + --add-filestore-instances=id=string,name=string --add-filestore-instances=id=string,name=string + + JSON Example: + + --add-filestore-instances='[{"id": "string", "name": "string"}]' + + File Example: + + --add-filestore-instances=path_to_file.(yaml|json) + + --add-flex-start-instances=[id=ID],[machineType=MACHINETYPE],[maxDuration=MAXDURATION],[zone=ZONE] + Parameters to define cluster Flex Start instances. + + For example --add-flex-start-instances + id=c1,zone=us-central1-a,machineType=n1-standard-1,maxDuration=10000s. + + Sets add_flex_start_instances value. + + id + Required, sets id value. + + machineType + Required, sets machineType value. + + maxDuration + Required, sets maxDuration value. + + zone + Required, sets zone value. + + Shorthand Example: + + --add-flex-start-instances=id=string,machineType=string,maxDuration=string,zone=string --add-flex-start-instances=id=string,machineType=string,maxDuration=string,zone=string + + JSON Example: + + --add-flex-start-instances='[{"id": "string", "machineType": "string", "maxDuration": "string", "zone": "string"}]' + + File Example: + + --add-flex-start-instances=path_to_file.(yaml|json) + + --add-labels=[ADD_LABELS,...] + Cluster labels as key value pairs. + + For example --add-labels key1=value1,key2=value2. + + Sets add_labels value. + + KEY + Sets KEY value. + + VALUE + Sets VALUE value. + + Shorthand Example: + + --add-labels={string=string} + + JSON Example: + + --add-labels='{"string": "string"}' + + File Example: + + --add-labels=path_to_file.(yaml|json) + + --add-lustre-instances=[id=ID],[name=NAME] + Reference of existing Lustre instance. + + id: ID of the lustre resource, used to refer to this resource in + storage-configs. name: Name of the existing Managed Lustre instance + to import from your project in the format of + locations/us-central1/instances/lustre-1. + + For example --add-lustre-instances + id=my-lustre,name=locations/us-central1/instances/lustre-1. + + Sets add_lustre_instances value. + + id + Required, sets id value. + + name + Required, sets name value. + + Shorthand Example: + + --add-lustre-instances=id=string,name=string --add-lustre-instances=id=string,name=string + + JSON Example: + + --add-lustre-instances='[{"id": "string", "name": "string"}]' + + File Example: + + --add-lustre-instances=path_to_file.(yaml|json) + + --add-new-filestore-instances=[capacityGb=CAPACITYGB],[description=DESCRIPTION],[fileshare=FILESHARE],[id=ID],[name=NAME],[protocol=PROTOCOL],[tier=TIER] + Parameters to create a filestore instance. + + Required fields: + + id + + name + + tier + + capacityGb + + fileshare + + For example --create-filestores + id=my-fs,name=locations/us-central1/instances/filestore-1,tier=REGIONAL,capacityGb=1024,fileshare=share1 + + id: Alphanumeric identifier of the filestore resource. Can be used to + refer to this resource in storage-configs. name: Name of the + filestore instance to create in your project in the format of + locations/us-central1/instances/filestore-1. + + capacityGb: Size of the filestore in GiB. Must be between 1024 and + 102400, and must meet scalability requirements described at + https://cloud.google.com/filestore/docs/service-tiers. + + fileshare: The directory on a Filestore instance where all shared + files are stored. Must match the regex [a-z]([-a-z0-9]*[a-z0-9])?, be + 1-63 characters in length, and comply with RFC1035. + + Supported protocol values: + + NFSV3 + + NFSV41 + + If not specified, defaults to NFSV3 + + Defaults: + + protocol: NFSV3. + + Sets add_new_filestore_instances value. + + Shorthand Example: + + --add-new-filestore-instances=capacityGb=int,description=string,fileshare=string,id=string,name=string,protocol=string,tier=string --add-new-filestore-instances=capacityGb=int,description=string,fileshare=string,id=string,name=string,protocol=string,tier=string + + JSON Example: + + --add-new-filestore-instances='[{"capacityGb": int, "description": "string", "fileshare": "string", "id": "string", "name": "string", "protocol": "string", "tier": "string"}]' + + File Example: + + --add-new-filestore-instances=path_to_file.(yaml|json) + + --add-new-lustre-instances=[capacityGb=CAPACITYGB],[description=DESCRIPTION],[filesystem=FILESYSTEM],[id=ID],[name=NAME],[perUnitStorageThroughput=PERUNITSTORAGETHROUGHPUT] + Parameters to create a Lustre instance. + + Required fields: + + id + + name + + capacityGb + + filesystem. + + id: ID of the lustre resource, used to refer to this resource in + storage-configs. + + name: Name of the Managed Lustre instance to create in your project + in the format of locations/us-central1/instances/lustre-1. + + For example --add-new-lustre-instances + id=my-lustre,name=locations/us-central1/instances/lustre-1,capacityGb=1024,filesystem=fs-1,perUnitStorageThroughput=1000 + + Values for perUnitStorageThroughput: 125, 250, 500, 1000. + + Sets add_new_lustre_instances value. + + Shorthand Example: + + --add-new-lustre-instances=capacityGb=int,description=string,filesystem=string,id=string,name=string,perUnitStorageThroughput=int --add-new-lustre-instances=capacityGb=int,description=string,filesystem=string,id=string,name=string,perUnitStorageThroughput=int + + JSON Example: + + --add-new-lustre-instances='[{"capacityGb": int, "description": "string", "filesystem": "string", "id": "string", "name": "string", "perUnitStorageThroughput": int}]' + + File Example: + + --add-new-lustre-instances=path_to_file.(yaml|json) + + --add-new-storage-buckets=[enableAutoclass=ENABLEAUTOCLASS],[enableHNS=ENABLEHNS],[id=ID],[name=NAME],[storageClass=STORAGECLASS] + Parameters to create a Google Cloud Storage bucket. + + Required fields: + + id + + name + + For example --add-new-storage-buckets + id=my-bucket,name=bucket-1,storageClass=STANDARD,enableHNS=true + + Supported storageClass values: + + STANDARD + + NEARLINE + + COLDLINE + + ARCHIVE + + Defaults: + + storageClass: STANDARD + + Note: + + Either storageClass or enableAutoclass can be set. + + HNS: Hierarchical namespace. Hierarchical namespace buckets + cannot use Autoclass. + + Sets add_new_storage_buckets value. + + Shorthand Example: + + --add-new-storage-buckets=enableAutoclass=boolean,enableHNS=boolean,id=string,name=string,storageClass=string --add-new-storage-buckets=enableAutoclass=boolean,enableHNS=boolean,id=string,name=string,storageClass=string + + JSON Example: + + --add-new-storage-buckets='[{"enableAutoclass": boolean, "enableHNS": boolean, "id": "string", "name": "string", "storageClass": "string"}]' + + File Example: + + --add-new-storage-buckets=path_to_file.(yaml|json) + + --add-on-demand-instances=[id=ID],[machineType=MACHINETYPE],[zone=ZONE] + Parameters to define cluster on demand instances. + + For example --add-on-demand-instances + id=c1,zone=us-central1-a,machineType=n1-standard-1. + + Sets add_on_demand_instances value. + + id + Required, sets id value. + + machineType + Required, sets machineType value. + + zone + Required, sets zone value. + + Shorthand Example: + + --add-on-demand-instances=id=string,machineType=string,zone=string --add-on-demand-instances=id=string,machineType=string,zone=string + + JSON Example: + + --add-on-demand-instances='[{"id": "string", "machineType": "string", "zone": "string"}]' + + File Example: + + --add-on-demand-instances=path_to_file.(yaml|json) + + --add-reserved-instances=[id=ID],[reservation=RESERVATION] + Parameters to define cluster reserved instances. + + For example --add-reserved-instances + id=c1,reservation=zones/us-central1-a/reservations/reservation-1. + + Sets add_reserved_instances value. + + id + Required, sets id value. + + reservation + Sets reservation value. + + Shorthand Example: + + --add-reserved-instances=id=string,reservation=string --add-reserved-instances=id=string,reservation=string + + JSON Example: + + --add-reserved-instances='[{"id": "string", "reservation": "string"}]' + + File Example: + + --add-reserved-instances=path_to_file.(yaml|json) + + --add-slurm-epilog-scripts=[ADD_SLURM_EPILOG_SCRIPTS,...] + Slurm epilog bash scripts. + + For example --add-slurm-epilog-scripts script1.sh,script2.sh + + --add-slurm-node-sets=[computeId=COMPUTEID],[computeInstance=COMPUTEINSTANCE],[id=ID],[maxDynamicNodeCount=MAXDYNAMICNODECOUNT],[staticNodeCount=STATICNODECOUNT],[storageConfigs=STORAGECONFIGS] + Parameters to define slurm cluster nodeset config. + + Required fields: + + id + + For example --add-slurm-node-sets + id=ns1,computeId=c1,staticNodeCount=1,maxDynamicNodeCount=2,computeInstance=[startupScript="echo + hello",labels="k1=v1"] + + Defaults: + + Note: + + startupScript: + - Either str or file_path + - For file_path, only bash file format (.sh or .bash) is + supported. + - For file_path, only absolute path is supported. + + Sets add_slurm_node_sets value. + + Shorthand Example: + + --add-slurm-node-sets=computeId=string,computeInstance={bootDisk={sizeGb=int,type=string},labels={string=string},startupScript=string},id=string,maxDynamicNodeCount=int,staticNodeCount=int,storageConfigs=[{id=string,localMount=string}] --add-slurm-node-sets=computeId=string,computeInstance={bootDisk={sizeGb=int,type=string},labels={string=string},startupScript=string},id=string,maxDynamicNodeCount=int,staticNodeCount=int,storageConfigs=[{id=string,localMount=string}] + + JSON Example: + + --add-slurm-node-sets='[{"computeId": "string", "computeInstance": {"bootDisk": {"sizeGb": int, "type": "string"}, "labels": {"string": "string"}, "startupScript": "string"}, "id": "string", "maxDynamicNodeCount": int, "staticNodeCount": int, "storageConfigs": [{"id": "string", "localMount": "string"}]}]' + + File Example: + + --add-slurm-node-sets=path_to_file.(yaml|json) + + --add-slurm-partitions=[id=ID],[nodeSetIds=NODESETIDS] + Parameters to define slurm cluster partitions. + + For example --add-slurm-partitions id=p1,nodesetIds=[ns1,ns2]. + + Sets add_slurm_partitions value. + + id + Required, sets id value. + + nodeSetIds + Required, sets nodeSetIds value. + + Shorthand Example: + + --add-slurm-partitions=id=string,nodeSetIds=[string] --add-slurm-partitions=id=string,nodeSetIds=[string] + + JSON Example: + + --add-slurm-partitions='[{"id": "string", "nodeSetIds": ["string"]}]' + + File Example: + + --add-slurm-partitions=path_to_file.(yaml|json) + + --add-slurm-prolog-scripts=[ADD_SLURM_PROLOG_SCRIPTS,...] + Slurm prolog bash scripts. + + For example --add-slurm-prolog-scripts script1.sh,script2.sh + + --add-spot-instances=[id=ID],[machineType=MACHINETYPE],[terminationAction=TERMINATIONACTION],[zone=ZONE] + Parameters to define cluster spot instances. + + For example --add-spot-instances + id=c1,zone=us-central1-a,machineType=n1-standard-1. + + Sets add_spot_instances value. + + id + Required, sets id value. + + machineType + Required, sets machineType value. + + terminationAction + Sets terminationAction value. + + zone + Required, sets zone value. + + Shorthand Example: + + --add-spot-instances=id=string,machineType=string,terminationAction=string,zone=string --add-spot-instances=id=string,machineType=string,terminationAction=string,zone=string + + JSON Example: + + --add-spot-instances='[{"id": "string", "machineType": "string", "terminationAction": "string", "zone": "string"}]' + + File Example: + + --add-spot-instances=path_to_file.(yaml|json) + + --add-storage-buckets=[id=ID],[name=NAME] + Reference of existing Google Cloud Storage bucket. + + id: ID of the bucket resource, used to refer to this resource in + storage-configs. name: Name of the existing Cloud Storage bucket to + import from your project in the format of bucket-name. + + For example --add-storage-buckets id=my-bucket,name=bucket-1. + + Sets add_storage_buckets value. + + id + Required, sets id value. + + name + Required, sets name value. + + Shorthand Example: + + --add-storage-buckets=id=string,name=string --add-storage-buckets=id=string,name=string + + JSON Example: + + --add-storage-buckets='[{"id": "string", "name": "string"}]' + + File Example: + + --add-storage-buckets=path_to_file.(yaml|json) + + --description=DESCRIPTION + Description of the cluster. + + For example --description "My cluster" + + --remove-filestore-instances=[REMOVE_FILESTORE_INSTANCES,...] + Parameters to remove filestore instance config by filestore name. + + For example --remove-filestore-instances + locations/us-central1/instances/filestore-1,locations/us-central1/instances/filestore-2,... + + --remove-flex-start-instances=[REMOVE_FLEX_START_INSTANCES,...] + Parameters to remove Flex Start instance config by compute id. + + For example --remove-flex-start-instances c1,c2,... + + --remove-labels=[REMOVE_LABELS,...] + Parameters to remove cluster label by key. + + For example --remove-labels key1,key2,... + + --remove-lustre-instances=[REMOVE_LUSTRE_INSTANCES,...] + Parameters to remove lustre instance config by lustre name. + + For example --remove-lustre-instances + locations/us-central1/instances/lustre-1,locations/us-central1/instances/lustre-2,... + + --remove-on-demand-instances=[REMOVE_ON_DEMAND_INSTANCES,...] + Parameters to remove on demand instances config by compute id. + + For example --remove-on-demand-instances c1,c2,... + + --remove-reserved-instances=[REMOVE_RESERVED_INSTANCES,...] + Parameters to remove reserved instance config by compute id. + + For example --remove-reserved-instances c1,c2,... + + --remove-slurm-epilog-scripts=[REMOVE_SLURM_EPILOG_SCRIPTS,...] + Scripts to remove from Slurm epilog bash scripts. + + For example --remove-slurm-epilog-scripts script1.sh,script2.sh + + --remove-slurm-node-sets=[REMOVE_SLURM_NODE_SETS,...] + Parameters to remove slurm nodeset config by nodeset id. + + For example --remove-slurm-node-sets ns1,ns2,... + + --remove-slurm-partitions=[REMOVE_SLURM_PARTITIONS,...] + Parameters to remove slurm partition config by partition id. + + For example --remove-slurm-partitions p1,p2,... + + --remove-slurm-prolog-scripts=[REMOVE_SLURM_PROLOG_SCRIPTS,...] + Scripts to remove from Slurm prolog bash scripts. + + For example --remove-slurm-prolog-scripts script1.sh,script2.sh + + --remove-spot-instances=[REMOVE_SPOT_INSTANCES,...] + Parameters to remove spot instance config by compute id. + + For example --remove-spot-instances c1,c2,... + + --remove-storage-buckets=[REMOVE_STORAGE_BUCKETS,...] + Parameters to remove Google Cloud Storage bucket by bucket name. + + For example --remove-storage-buckets bucket-1,bucket-2,... + + --slurm-default-partition=SLURM_DEFAULT_PARTITION + Parameters to define slurm cluster default partition. + + For example --slurm-default-partition p1 + + --update-slurm-login-node=[bootDisk=BOOTDISK],[count=COUNT],[startupScript=STARTUPSCRIPT] + Parameters to update slurm cluster login node. Only bootDisk, count + and startupScript can be updated. + + For example --update-slurm-login-node count=2,startupScript="echo + hello". + + Sets update_slurm_login_node value. + + Shorthand Example: + + --update-slurm-login-node=bootDisk={sizeGb=int,type=string},count=int,startupScript=string + + JSON Example: + + --update-slurm-login-node='{"bootDisk": {"sizeGb": int, "type": "string"}, "count": int, "startupScript": "string"}' + + File Example: + + --update-slurm-login-node=path_to_file.(yaml|json) + + --update-slurm-node-sets=[computeId=COMPUTEID],[computeInstance=COMPUTEINSTANCE],[id=ID],[maxDynamicNodeCount=MAXDYNAMICNODECOUNT],[staticNodeCount=STATICNODECOUNT],[storageConfigs=STORAGECONFIGS] + Parameters to define and update slurm cluster nodeset config. + + For example --update-slurm-node-sets + id=ns1,staticNodeCount=1,maxDynamicNodeCount=2,computeInstance=[startupScript="echo + hello"]. + + Sets update_slurm_node_sets value. + + Shorthand Example: + + --update-slurm-node-sets=computeId=string,computeInstance={bootDisk={sizeGb=int,type=string},labels={string=string},startupScript=string},id=string,maxDynamicNodeCount=int,staticNodeCount=int,storageConfigs=[{id=string,localMount=string}] --update-slurm-node-sets=computeId=string,computeInstance={bootDisk={sizeGb=int,type=string},labels={string=string},startupScript=string},id=string,maxDynamicNodeCount=int,staticNodeCount=int,storageConfigs=[{id=string,localMount=string}] + + JSON Example: + + --update-slurm-node-sets='[{"computeId": "string", "computeInstance": {"bootDisk": {"sizeGb": int, "type": "string"}, "labels": {"string": "string"}, "startupScript": "string"}, "id": "string", "maxDynamicNodeCount": int, "staticNodeCount": int, "storageConfigs": [{"id": "string", "localMount": "string"}]}]' + + File Example: + + --update-slurm-node-sets=path_to_file.(yaml|json) + + --update-slurm-partitions=[id=ID],[nodeSetIds=NODESETIDS] + Parameters to define and update slurm cluster partition config. + + For example --update-slurm-partitions id=p1,nodesetIds=[ns1,ns2]. + + Sets update_slurm_partitions value. + + id + Required, sets id value. + + nodeSetIds + Sets nodeSetIds value. + + Shorthand Example: + + --update-slurm-partitions=id=string,nodeSetIds=[string] --update-slurm-partitions=id=string,nodeSetIds=[string] + + JSON Example: + + --update-slurm-partitions='[{"id": "string", "nodeSetIds": ["string"]}]' + + File Example: + + --update-slurm-partitions=path_to_file.(yaml|json) + + Cluster configuration for updates. + + --config=[computeResources=COMPUTERESOURCES],[description=DESCRIPTION],[labels=LABELS],[name=NAME],[networkResources=NETWORKRESOURCES],[orchestrator=ORCHESTRATOR],[storageResources=STORAGERESOURCES] + Configuration of the cluster specs in the form of a JSON object. + Required, See example below: + + --config='{ + "networkResources": { + "network0": { + "config": { + "newNetwork": { + "network": "network0" + } + } + } + }, + "storageResources": { + "lustre0": { + "config": { + "newLustre": { + "capacityGb": 1200, + "filesystem": "lustre-fs" + } + } + } + }, + "computeResources": { + "compute0": { + "config": { + "newOnDemandInstances": { + "machineType": "n2-standard-4", + "zone": "us-central1-a" + } + } + } + }, + "orchestrator": { + "slurm": { + "nodeSets": [ + { + "id": "nodeset0", + "computeId": "compute0" + } + ] + } + } + }' --format json. + + Shorthand Example: + + --config=computeResources={string={config={newDwsFlexInstances={machineType=string,maxDuration=string,zone=string},newFlexStartInstances={machineType=string,maxDuration=string,zone=string},newOnDemandInstances={machineType=string,zone=string},newReservedInstances={reservation=string},newSpotInstances={machineType=string,terminationAction=string,zone=string}}}},description=string,labels={string=string},name=string,networkResources={string={config={existingComputeNetwork={network=string,subnetwork=string},existingNetwork={network=string,subnetwork=string},newComputeNetwork={description=string,network=string},newNetwork={description=string,network=string}}}},orchestrator={slurm={defaultPartition=string,epilogBashScripts,loginNodes={bootDisk={sizeGb=int,type=string},count=int,enableOsLogin=boolean,enablePublicIps=boolean,labels={string=string},machineType=string,startupScript=string,storageConfigs=[{id=string,localMount=string}],zone=string},nodeSets=[{computeId=string,computeInstance={bootDisk={sizeGb=int,type=string},labels={string=string},startupScript=string},id=string,maxDynamicNodeCount=int,staticNodeCount=int,storageConfigs=[{id=string,localMount=string}]}],partitions=[{id=string,nodeSetIds=[string]}],prologBashScripts}},storageResources={string={config={existingBucket={bucket=string},existingFilestore={filestore=string},existingLustre={lustre=string},newBucket={autoclass={enabled=boolean},bucket=string,hierarchicalNamespace={enabled=boolean},storageClass=string},newFilestore={description=string,fileShares=[{capacityGb=int,fileShare=string}],filestore=string,id=string,protocol=string,tier=string},newLustre={capacityGb=int,description=string,filesystem=string,id=string,lustre=string,perUnitStorageThroughput=int}}}} + + JSON Example: + + --config='{"computeResources": {"string": {"config": {"newDwsFlexInstances": {"machineType": "string", "maxDuration": "string", "zone": "string"}, "newFlexStartInstances": {"machineType": "string", "maxDuration": "string", "zone": "string"}, "newOnDemandInstances": {"machineType": "string", "zone": "string"}, "newReservedInstances": {"reservation": "string"}, "newSpotInstances": {"machineType": "string", "terminationAction": "string", "zone": "string"}}}}, "description": "string", "labels": {"string": "string"}, "name": "string", "networkResources": {"string": {"config": {"existingComputeNetwork": {"network": "string", "subnetwork": "string"}, "existingNetwork": {"network": "string", "subnetwork": "string"}, "newComputeNetwork": {"description": "string", "network": "string"}, "newNetwork": {"description": "string", "network": "string"}}}}, "orchestrator": {"slurm": {"defaultPartition": "string", "epilogBashScripts", "loginNodes": {"bootDisk": {"sizeGb": int, "type": "string"}, "count": int, "enableOsLogin": boolean, "enablePublicIps": boolean, "labels": {"string": "string"}, "machineType": "string", "startupScript": "string", "storageConfigs": [{"id": "string", "localMount": "string"}], "zone": "string"}, "nodeSets": [{"computeId": "string", "computeInstance": {"bootDisk": {"sizeGb": int, "type": "string"}, "labels": {"string": "string"}, "startupScript": "string"}, "id": "string", "maxDynamicNodeCount": int, "staticNodeCount": int, "storageConfigs": [{"id": "string", "localMount": "string"}]}], "partitions": [{"id": "string", "nodeSetIds": ["string"]}], "prologBashScripts"}}, "storageResources": {"string": {"config": {"existingBucket": {"bucket": "string"}, "existingFilestore": {"filestore": "string"}, "existingLustre": {"lustre": "string"}, "newBucket": {"autoclass": {"enabled": boolean}, "bucket": "string", "hierarchicalNamespace": {"enabled": boolean}, "storageClass": "string"}, "newFilestore": {"description": "string", "fileShares": [{"capacityGb": int, "fileShare": "string"}], "filestore": "string", "id": "string", "protocol": "string", "tier": "string"}, "newLustre": {"capacityGb": int, "description": "string", "filesystem": "string", "id": "string", "lustre": "string", "perUnitStorageThroughput": int}}}}}' + + File Example: + + --config=path_to_file.(yaml|json) + + This flag argument must be specified if any of the other arguments in + this group are specified. + + --update-mask=UPDATE_MASK + Update mask to specify the fields to update. + + For example --update-mask "description,labels". + + Required, sets update_mask value. + + Input Example: + + --update-mask=string + + File Example: + + --update-mask=path_to_file.(yaml|json) + + This flag argument must be specified if any of the other arguments in + this group are specified. + +OPTIONAL FLAGS + --async + Return immediately, without waiting for the operation in progress to + complete. + +GCLOUD WIDE FLAGS + These flags are available to all commands: --access-token-file, --account, + --billing-project, --configuration, --flags-file, --flatten, --format, + --help, --impersonate-service-account, --log-http, --project, --quiet, + --trace-token, --user-output-enabled, --verbosity. + + Run $ gcloud help for details. diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-composer-environments-update.txt b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-composer-environments-update.txt new file mode 100644 index 00000000000..70b8e9ae578 --- /dev/null +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-composer-environments-update.txt @@ -0,0 +1,642 @@ +NAME + gcloud composer environments update - update properties of a Cloud Composer + environment + +SYNOPSIS + gcloud composer environments update (ENVIRONMENT : --location=LOCATION) + (--airflow-database-retention-days=AIRFLOW_DATABASE_RETENTION_DAYS + | --cloud-sql-machine-type=CLOUD_SQL_MACHINE_TYPE + | --disable-high-resilience | --disable-logs-in-cloud-logging-only + | --disable-private-environment | --enable-high-resilience + | --enable-logs-in-cloud-logging-only | --enable-private-environment + | --environment-size=ENVIRONMENT_SIZE | --node-count=NODE_COUNT + | --support-web-server-plugins + | --web-server-machine-type=WEB_SERVER_MACHINE_TYPE + | --airflow-version=AIRFLOW_VERSION | --image-version=IMAGE_VERSION + | --clear-maintenance-window + | --maintenance-window-end=MAINTENANCE_WINDOW_END + --maintenance-window-recurrence=MAINTENANCE_WINDOW_RECURRENCE + --maintenance-window-start=MAINTENANCE_WINDOW_START + | --disable-cloud-data-lineage-integration + | --enable-cloud-data-lineage-integration + | --disable-master-authorized-networks + --enable-master-authorized-networks + --master-authorized-networks=[NETWORK,...] + | --disable-private-builds-only | --enable-private-builds-only + | --disable-scheduled-snapshot-creation + | --enable-scheduled-snapshot-creation + --snapshot-creation-schedule=SNAPSHOT_CREATION_SCHEDULE + --snapshot-location=SNAPSHOT_LOCATION + --snapshot-schedule-timezone=SNAPSHOT_SCHEDULE_TIMEZONE + | --disable-vpc-connectivity + | --network-attachment=NETWORK_ATTACHMENT + | [--network=NETWORK : --subnetwork=SUBNETWORK] + | --max-workers=MAX_WORKERS --min-workers=MIN_WORKERS + --scheduler-count=SCHEDULER_COUNT --scheduler-cpu=SCHEDULER_CPU + --scheduler-memory=SCHEDULER_MEMORY + --scheduler-storage=SCHEDULER_STORAGE --web-server-cpu=WEB_SERVER_CPU + --web-server-memory=WEB_SERVER_MEMORY + --web-server-storage=WEB_SERVER_STORAGE --worker-cpu=WORKER_CPU + --worker-memory=WORKER_MEMORY --worker-storage=WORKER_STORAGE + --dag-processor-count=DAG_PROCESSOR_COUNT + --dag-processor-cpu=DAG_PROCESSOR_CPU + --dag-processor-memory=DAG_PROCESSOR_MEMORY + --dag-processor-storage=DAG_PROCESSOR_STORAGE --disable-triggerer + | --enable-triggerer --triggerer-count=TRIGGERER_COUNT + --triggerer-cpu=TRIGGERER_CPU --triggerer-memory=TRIGGERER_MEMORY + | --update-airflow-configs=[KEY=VALUE,...] --clear-airflow-configs + | --remove-airflow-configs=[KEY,...] + | --update-env-variables=[NAME=VALUE,...] --clear-env-variables + | --remove-env-variables=[NAME,...] + | --update-labels=[KEY=VALUE,...] --clear-labels + | --remove-labels=[KEY,...] + | --update-pypi-packages-from-file=UPDATE_PYPI_PACKAGES_FROM_FILE + | --update-pypi-package=PACKAGE[EXTRAS_LIST]VERSION_SPECIFIER + --clear-pypi-packages | --remove-pypi-packages=[PACKAGE,...] + | --update-web-server-allow-ip=[description=DESCRIPTION], + [ip_range=IP_RANGE] | --web-server-allow-all | --web-server-deny-all) + [--async] [GCLOUD_WIDE_FLAG ...] + +DESCRIPTION + Update properties of a Cloud Composer environment. + +EXAMPLES + To update the Cloud Composer environment named env-1 to have 8 Airflow + workers, and not have the production label, run: + + $ gcloud composer environments update env-1 --node-count=8 \ + --remove-labels=production + +POSITIONAL ARGUMENTS + Environment resource - The environment to update. The arguments in this + group can be used to specify the attributes of this resource. (NOTE) Some + attributes are not given arguments in this group but can be set in other + ways. + + To set the project attribute: + * provide the argument environment on the command line with a fully + specified name; + * provide the argument --project on the command line; + * set the property core/project. + + This must be specified. + + ENVIRONMENT + ID of the environment or fully qualified identifier for the + environment. + + To set the environment attribute: + + provide the argument environment on the command line. + + This positional argument must be specified if any of the other + arguments in this group are specified. + + --location=LOCATION + Region where Composer environment runs or in which to create the + environment. + + To set the location attribute: + + provide the argument environment on the command line with a fully + specified name; + + provide the argument --location on the command line; + + set the property composer/location. + +REQUIRED FLAGS + The update type. + + Exactly one of these must be specified: + + --airflow-database-retention-days=AIRFLOW_DATABASE_RETENTION_DAYS + The number of days for the Airflow database retention period. If set + to 0, the Airflow database retention mechanism will be disabled. + + --cloud-sql-machine-type=CLOUD_SQL_MACHINE_TYPE + Cloud SQL machine type used by the Airflow database. The list of + available machine types is available here: + https://cloud.google.com/composer/pricing#db-machine-types. + + --disable-high-resilience + Disable high resilience, supported for Composer 2 Environments. + + --disable-logs-in-cloud-logging-only + Disable logs in cloud logging only, supported for Composer 2 + Environments. + + --disable-private-environment + Enable internet connection from any Composer component, supported in + Composer 3 environments or greater. + + --enable-high-resilience + Enable high resilience, supported for Composer 2 Environments. + + --enable-logs-in-cloud-logging-only + Enable logs in cloud logging only, supported for Composer 2 + Environments. + + --enable-private-environment + Disable internet connection from any Composer component, supported in + Composer 3 environments or greater. + + --environment-size=ENVIRONMENT_SIZE + Size of the environment. Unspecified means that the default option + will be chosen. ENVIRONMENT_SIZE must be one of: extra-large, large, + medium, small, unspecified. + + --node-count=NODE_COUNT + The new number of nodes running the environment. Must be >= 3. + + --support-web-server-plugins + Enable the support for web server plugins, supported in Composer 3 or + greater. + + --web-server-machine-type=WEB_SERVER_MACHINE_TYPE + machine type used by the Airflow web server. The list of available + machine types is available here: + https://cloud.google.com/composer/pricing. + + Or at most one of these can be specified: + + Group of arguments for performing in-place environment upgrades. + + --airflow-version=AIRFLOW_VERSION + Upgrade the environment to a later Apache Airflow version in-place. + + Must be of the form X[.Y[.Z]], where [] denotes optional fragments. + Examples: 2, 2.3, 2.3.4. + + The Apache Airflow version is a semantic version or an alias in the + form of major or major.minor version numbers, resolved to the + latest matching Apache Airflow version supported in the current + Cloud Composer version. The resolved version is stored in the + upgraded environment. + + --image-version=IMAGE_VERSION + Upgrade the environment to a later version in-place. + + The image version encapsulates the versions of both Cloud Composer + and Apache Airflow. Must be of the form + composer-A[.B.C[-D.E]]-airflow-X[.Y[.Z]], where [] denotes optional + fragments. + + Examples: composer-2-airflow-2, composer-2-airflow-2.2, + composer-2.1.2-airflow-2.3.4. + + The Cloud Composer portion of the image version is a semantic + version or an alias in the form of major version number or latest, + resolved to the current Cloud Composer version. The Apache Airflow + portion of the image version is a semantic version or an alias in + the form of major or major.minor version numbers, resolved to the + latest matching Apache Airflow version supported in the given Cloud + Composer version. The resolved versions are stored in the upgraded + environment. + + Or at most one of these can be specified: + + Group of arguments for setting the maintenance window value during + update. + + --clear-maintenance-window + Clears the maintenance window settings. Can be specified for + Composer 3 or greater. + + Or at least one of these can be specified: + + Group of arguments for setting the maintenance window value. + + --maintenance-window-end=MAINTENANCE_WINDOW_END + End time of the mantenance window in the form of the full date. + Only the time of the day is used as a reference for an ending + time of the window with a provided recurrence. Specified date + must take place after the one specified as a start date, the + difference between will be used as a length of a single + maintenance window. See $ gcloud topic datetimes for information + on time formats. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --maintenance-window-recurrence=MAINTENANCE_WINDOW_RECURRENCE + An RFC 5545 RRULE, specifying how the maintenance window will + recur. The minimum requirement for the length of the maintenance + window is 12 hours a week. Only FREQ=DAILY and FREQ=WEEKLY rules + are supported. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --maintenance-window-start=MAINTENANCE_WINDOW_START + Start time of the mantenance window in the form of the full date. + Only the time of the day is used as a reference for a starting + time of the window with a provided recurrence. See $ gcloud topic + datetimes for information on time formats. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + Or at least one of these can be specified: + + Group of arguments for setting Cloud Data Lineage integration + configuration in Composer 2. + + At most one of these can be specified: + + --disable-cloud-data-lineage-integration + Disable Cloud Data Lineage integration, supported for Composer 2 + Environments. + + --enable-cloud-data-lineage-integration + Enable Cloud Data Lineage integration, supported for Composer 2 + Environments. + + Or at least one of these can be specified: + + Group of arguments for setting master authorized networks + configuration. + + --disable-master-authorized-networks + Disable Master Authorized Networks feature + (https://cloud.google.com/kubernetes-engine/docs/how-to/authorized-networks) + in the Composer Environment's GKE cluster. + + --enable-master-authorized-networks + Enable Master Authorized Networks feature + (https://cloud.google.com/kubernetes-engine/docs/how-to/authorized-networks) + in the Composer Environment's GKE cluster. + + --master-authorized-networks=[NETWORK,...] + Comma separated Master Authorized Networks specified in CIDR + notation. + + Cannot be specified unless --enable-master-authorized-networks is + also specified. + + Or at most one of these can be specified: + + --disable-private-builds-only + Builds performed during operations that install Python packages + have an access to the internet, supported in Composer 3 or greater. + + --enable-private-builds-only + Builds performed during operations that install Python packages + have only private connectivity to Google services, supported in + Composer 3 or greater. + + Or at most one of these can be specified: + + Group of arguments used during update of scheduled snapshots settings + in Composer 2.0.32 or greater. + + --disable-scheduled-snapshot-creation + Disables automated snapshots creation. Can be specified for + Composer 2.0.32 or greater. + + Or at least one of these can be specified: + + Group of arguments for setting scheduled snapshots settings in + Composer 2.0.32 or greater. + + --enable-scheduled-snapshot-creation + When specified, snapshots of the environment will be created + according to a schedule. Can be specified for Composer 2.0.32 or + greater. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --snapshot-creation-schedule=SNAPSHOT_CREATION_SCHEDULE + Cron expression specifying when snapshots of the environment + should be created. Can be specified for Composer 2.0.32 or + greater. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --snapshot-location=SNAPSHOT_LOCATION + The Cloud Storage location for storing automatically created + snapshots. Can be specified for Composer 2.0.32 or greater. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --snapshot-schedule-timezone=SNAPSHOT_SCHEDULE_TIMEZONE + Timezone that sets the context to interpret + snapshot_creation_schedule. Can be specified for Composer 2.0.32 + or greater. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + Or at most one of these can be specified: + + --disable-vpc-connectivity + Disable connectivity with a user's VPC network, supported in + Composer 3 environments or greater. + + --network-attachment=NETWORK_ATTACHMENT + Cloud Composer Network Attachment, which provides connectivity with + a user's VPC network, supported in Composer 3 environments or + greater. + + Or at least one of these can be specified: + + Virtual Private Cloud networking + + --network=NETWORK + The Compute Engine Network to which the environment will be + connected. If a 'Custom Subnet Network' is provided, --subnetwork + must be specified as well. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --subnetwork=SUBNETWORK + The Compute Engine Subnetwork + (https://cloud.google.com/compute/docs/subnetworks) to which the + environment will be connected. + + Or at least one of these can be specified: + + Group of arguments for setting workloads configuration in Composer 2.X + or greater (--scheduler-count flag is available for Composer 1.X as + well). + + --max-workers=MAX_WORKERS + Maximum number of workers in the Environment. + + --min-workers=MIN_WORKERS + Minimum number of workers in the Environment. + + --scheduler-count=SCHEDULER_COUNT + Number of schedulers, supported in the Environments with Airflow + 2.0.1 and later. + + --scheduler-cpu=SCHEDULER_CPU + CPU allocated to Airflow scheduler. + + --scheduler-memory=SCHEDULER_MEMORY + Memory allocated to Airflow scheduler, ex. 600MB, 3GB, 2. If units + are not provided, defaults to GB. + + --scheduler-storage=SCHEDULER_STORAGE + Storage allocated to Airflow scheduler, ex. 600MB, 3GB, 2. If units + are not provided, defaults to GB. + + --web-server-cpu=WEB_SERVER_CPU + CPU allocated to each Airflow web server + + --web-server-memory=WEB_SERVER_MEMORY + Memory allocated to Airflow web server, ex. 600MB, 3GB, 2. If units + are not provided, defaults to GB. + + --web-server-storage=WEB_SERVER_STORAGE + Storage allocated to Airflow web server, ex. 600MB, 3GB, 2. If + units are not provided, defaults to GB. + + --worker-cpu=WORKER_CPU + CPU allocated to each Airflow worker + + --worker-memory=WORKER_MEMORY + Memory allocated to Airflow worker, ex. 600MB, 3GB, 2. If units are + not provided, defaults to GB. + + --worker-storage=WORKER_STORAGE + Storage allocated to Airflow worker, ex. 600MB, 3GB, 2. If units + are not provided, defaults to GB. + + Group of arguments for setting dag processor settings in Composer 3 or + greater. + + --dag-processor-count=DAG_PROCESSOR_COUNT + Number of dag processors, supported in Composer 3 environments or + greater. + + --dag-processor-cpu=DAG_PROCESSOR_CPU + CPU allocated to Airflow dag processor, supported in Composer 3 + environments or greater. + + --dag-processor-memory=DAG_PROCESSOR_MEMORY + Memory allocated to Airflow dag processor, ex. 1GB, 3GB, 2. If + units are not provided, defaults to GB, supported in Composer 3 + environments or greater. + + --dag-processor-storage=DAG_PROCESSOR_STORAGE + Storage allocated to Airflow dag processor, ex. 600MB, 3GB, 2. If + units are not provided, defaults to GB, supported in Composer 3 + environments or greater. + + Group of arguments for setting triggerer settings in Composer 2.0.31 + or greater. + + At most one of these can be specified: + + --disable-triggerer + (DEPRECATED) Disable a triggerer, supported in the Environments + with Composer 2.0.31 and Airflow 2.2.5 and greater. + + This flag is deprecated. Use --triggerer-count 0 instead. + + Or at least one of these can be specified: + + Group of arguments for setting triggerer settings during update in + Composer 2.0.31 or greater. + + --enable-triggerer + (DEPRECATED) Enable use of a triggerer, supported in the + Environments with Composer 2.0.31 and Airflow 2.2.5 and + greater. + + This flag is deprecated. Use --triggerer-count instead. + + --triggerer-count=TRIGGERER_COUNT + Number of triggerers, supported in the Environments with + Composer 2.0.31 and Airflow 2.2.5 and greater. + + --triggerer-cpu=TRIGGERER_CPU + CPU allocated to Airflow triggerer. Supported in the + Environments with Composer 2.0.31 and Airflow 2.2.5 and + greater. + + --triggerer-memory=TRIGGERER_MEMORY + Memory allocated to Airflow triggerer, ex. 512MB, 3GB, 2. If + units are not provided, defaults to GB. Supported in the + Environments with Composer 2.0.31 and Airflow 2.2.5 and + greater. + + Or at least one of these can be specified: + + Group of arguments for modifying the Airflow configuration. + + --update-airflow-configs=[KEY=VALUE,...] + A list of Airflow config override KEY=VALUE pairs to set. If a + config override exists, its value is updated; otherwise, a new + config override is created. + + KEYs should specify the configuration section and property name, + separated by a hyphen, for example core-print_stats_interval. The + section may not contain a closing square brace or period. The + property name must be non-empty and may not contain an equals sign, + semicolon, or period. By convention, property names are spelled + with snake_case. VALUEs may contain any character. + + Arguments available for item removal. + + At most one of these can be specified: + + --clear-airflow-configs + Removes all Airflow config overrides from the environment. + + --remove-airflow-configs=[KEY,...] + A list of Airflow config override keys to remove. + + Or at least one of these can be specified: + + Group of arguments for modifying environment variables. + + --update-env-variables=[NAME=VALUE,...] + A list of environment variable NAME=VALUE pairs to set and provide + to the Airflow scheduler, worker, and webserver processes. If an + environment variable exists, its value is updated; otherwise, a new + environment variable is created. + + NAMEs are the environment variable names and may contain upper and + lowercase letters, digits, and underscores; they must not begin + with a digit. + + User-specified environment variables should not be used to set + Airflow configuration properties. Instead use the + --update-airflow-configs flag. + + Arguments available for item removal. + + At most one of these can be specified: + + --clear-env-variables + Removes all environment variables from the environment. + + Environment variables that have system-provided defaults cannot + be unset with the --remove-env-variables or --clear-env-variables + flags; only the user-supplied overrides will be removed. + + --remove-env-variables=[NAME,...] + A list of environment variables to remove. + + Environment variables that have system-provided defaults cannot + be unset with the --remove-env-variables or --clear-env-variables + flags; only the user-supplied overrides will be removed. + + Or at least one of these can be specified: + + Group of arguments for modifying environment labels. + + --update-labels=[KEY=VALUE,...] + List of label KEY=VALUE pairs to update. If a label exists, its + value is modified. Otherwise, a new label is created. + + Keys must start with a lowercase character and contain only hyphens + (-), underscores (_), lowercase characters, and numbers. Values + must contain only hyphens (-), underscores (_), lowercase + characters, and numbers. + + At most one of these can be specified: + + --clear-labels + Remove all labels. If --update-labels is also specified then + --clear-labels is applied first. + + For example, to remove all labels: + + $ gcloud composer environments update --clear-labels + + To remove all existing labels and create two new labels, foo and + baz: + + $ gcloud composer environments update --clear-labels \ + --update-labels foo=bar,baz=qux + + --remove-labels=[KEY,...] + List of label keys to remove. If a label does not exist it is + silently ignored. If --update-labels is also specified then + --update-labels is applied first. + + Or at most one of these can be specified: + + Group of arguments for modifying the PyPI package configuration. + + --update-pypi-packages-from-file=UPDATE_PYPI_PACKAGES_FROM_FILE + The path to a file containing a list of PyPI packages to install in + the environment. Each line in the file should contain a package + specification in the format of the update-pypi-package argument + defined above. The path can be a local file path or a Google Cloud + Storage file path (Cloud Storage file path starts with 'gs://'). + + Or at least one of these can be specified: + + --update-pypi-package=PACKAGE[EXTRAS_LIST]VERSION_SPECIFIER + A PyPI package to add to the environment. If a package exists, + its value is updated; otherwise, a new package is installed. + + The value takes the form of: + PACKAGE[EXTRAS_LIST]VERSION_SPECIFIER, as one would specify in a + pip requirements file. + + PACKAGE is specified as a package name, such as numpy. + EXTRAS_LIST is a comma-delimited list of PEP 508 distribution + extras that may be empty, in which case the enclosing square + brackets may be omitted. VERSION_SPECIFIER is an optional PEP 440 + version specifier. If both EXTRAS_LIST and VERSION_SPECIFIER are + omitted, the = and everything to the right may be left empty. + + This is a repeated argument that can be specified multiple times + to update multiple packages. If PACKAGE appears more than once, + the last value will be used. + + Arguments available for item removal. + + At most one of these can be specified: + + --clear-pypi-packages + Removes all PyPI packages from the environment. + + PyPI packages that are required by the environment's core + software cannot be uninstalled with the --remove-pypi-packages + or --clear-pypi-packages flags. + + --remove-pypi-packages=[PACKAGE,...] + A list of PyPI package names to remove. + + PyPI packages that are required by the environment's core + software cannot be uninstalled with the --remove-pypi-packages + or --clear-pypi-packages flags. + + Or at most one of these can be specified: + + --update-web-server-allow-ip=[description=DESCRIPTION],[ip_range=IP_RANGE] + Specifies a list of IPv4 or IPv6 ranges that will be allowed to + access the Airflow web server. By default, all IPs are allowed to + access the web server. + + ip_range + IPv4 or IPv6 range of addresses allowed to access the Airflow + web server. + + description + An optional description of the IP range. + + --web-server-allow-all + Allows all IP addresses to access the Airflow web server. + + --web-server-deny-all + Denies all incoming traffic to the Airflow web server. + +OPTIONAL FLAGS + --async + Return immediately, without waiting for the operation in progress to + complete. + +GCLOUD WIDE FLAGS + These flags are available to all commands: --access-token-file, --account, + --billing-project, --configuration, --flags-file, --flatten, --format, + --help, --impersonate-service-account, --log-http, --project, --quiet, + --trace-token, --user-output-enabled, --verbosity. + + Run $ gcloud help for details. diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-container-clusters-update.txt b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-container-clusters-update.txt new file mode 100644 index 00000000000..41a430cc56c --- /dev/null +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-container-clusters-update.txt @@ -0,0 +1,1937 @@ +NAME + gcloud container clusters update - update cluster settings for an existing + container cluster + +SYNOPSIS + gcloud container clusters update NAME + (--anonymous-authentication-config=ANONYMOUS_AUTHENTICATION_CONFIG + | --autopilot-general-profile=AUTOPILOT_GENERAL_PROFILE + | --autopilot-privileged-admission=[ALLOWLIST_PATHS,...] + | --autopilot-workload-policies=WORKLOAD_POLICIES + | --autoprovisioning-cgroup-mode=AUTOPROVISIONING_CGROUP_MODE + | --autoprovisioning-enable-insecure-kubelet-readonly-port + | --autoprovisioning-network-tags=[TAGS,...] + | --autoprovisioning-resource-manager-tags=[KEY=VALUE,...] + | --autoscaling-profile=AUTOSCALING_PROFILE + | --complete-credential-rotation | --complete-ip-rotation + | --containerd-config-from-file=PATH_TO_FILE + | --control-plane-egress=CONTROL_PLANE_EGRESS + | --database-encryption-key=DATABASE_ENCRYPTION_KEY + | --disable-database-encryption | --disable-default-snat + | --disable-multi-nic-lustre | --disable-workload-identity + | --enable-agent-sandbox + | --[no-]enable-autopilot-compatibility-auditing + | --enable-autoscaling + | --[no-]enable-cilium-clusterwide-network-policy + | --enable-cost-allocation | --enable-default-compute-class + | --enable-fqdn-network-policy | --enable-identity-service + | --enable-image-streaming | --enable-insecure-kubelet-readonly-port + | --enable-intra-node-visibility + | --enable-kernel-module-signature-enforcement + | --enable-kubernetes-unstable-apis=API,[API,...] + | --enable-l4-ilb-subsetting | --enable-legacy-authorization + | --enable-legacy-lustre-port | --enable-multi-networking + | --enable-network-policy | --enable-private-nodes + | --enable-service-externalips | --enable-shielded-nodes + | --enable-slice-controller | --enable-stackdriver-kubernetes + | --enable-vertical-pod-autoscaling | --gateway-api=GATEWAY_API + | --generate-password | --hpa-profile=HPA_PROFILE + | --in-transit-encryption=IN_TRANSIT_ENCRYPTION + | --logging-variant=LOGGING_VARIANT | --maintenance-window=START_TIME + | --network-performance-configs=[PROPERTY1=VALUE1,...] + | --node-creation-mode=NODE_CREATION_MODE + | --node-locations=ZONE,[ZONE,...] + | --notification-config=[pubsub=ENABLED|DISABLED, + pubsub-topic=TOPIC,...] | --patch-update=[PATCH_UPDATE] + | --private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPE + | --release-channel=CHANNEL + | --remove-autopilot-workload-policies=REMOVE_WORKLOAD_POLICIES + | --remove-labels=[KEY,...] + | --remove-workload-policies=REMOVE_WORKLOAD_POLICIES + | --security-group=SECURITY_GROUP + | --security-posture=SECURITY_POSTURE | --set-password + | --stack-type=STACK_TYPE | --start-credential-rotation + | --start-ip-rotation | --tier=TIER + | --update-addons=[ADDON=ENABLED|DISABLED,...] + | --update-labels=[KEY=VALUE,...] + | --workload-policies=WORKLOAD_POLICIES + | --workload-pool=WORKLOAD_POOL + | --workload-vulnerability-scanning=WORKLOAD_VULNERABILITY_SCANNING + | --additional-ip-ranges=[subnetwork=NAME,pod-ipv4-range=NAME,...] + --remove-additional-ip-ranges=[subnetwork=NAME, + pod-ipv4-range=NAME,...] + | --additional-pod-ipv4-ranges=NAME,[NAME,...] + --remove-additional-pod-ipv4-ranges=NAME,[NAME,...] + | --auto-monitoring-scope=AUTO_MONITORING_SCOPE + --logging=[COMPONENT,...] --managed-otel-scope=MANAGED_OTEL_SCOPE + --monitoring=[COMPONENT,...] --disable-managed-prometheus + | --enable-managed-prometheus + | --binauthz-evaluation-mode=BINAUTHZ_EVALUATION_MODE + | --enable-binauthz | --clear-fleet-project --enable-fleet + --fleet-project=PROJECT_ID_OR_NUMBER + --membership-type=MEMBERSHIP_TYPE --unset-membership-type + | --clear-maintenance-minor-version-disruption-interval + | --maintenance-minor-version-disruption-interval=MAINTENANCE_MINOR_VERSION_DISRUPTION_INTERVAL --clear-maintenance-patch-version-disruption-interval | --maintenance-patch-version-disruption-interval=MAINTENANCE_PATCH_VERSION_DISRUPTION_INTERVAL | --clear-maintenance-window | --remove-maintenance-exclusion=NAME | [(--add-maintenance-exclusion-end=TIME_STAMP | --add-maintenance-exclusion-until-end-of-support) : --add-maintenance-exclusion-name=NAME --add-maintenance-exclusion-scope=SCOPE --add-maintenance-exclusion-start=TIME_STAMP] | --maintenance-window-recurrence=RRULE --maintenance-window-start=TIME_STAMP (--maintenance-window-duration=PT1H23M45S | --maintenance-window-end=TIME_STAMP) | --clear-resource-usage-bigquery-dataset | --enable-network-egress-metering --enable-resource-consumption-metering --resource-usage-bigquery-dataset=RESOURCE_USAGE_BIGQUERY_DATASET | --cluster-dns=CLUSTER_DNS --cluster-dns-domain=CLUSTER_DNS_DOMAIN --cluster-dns-scope=CLUSTER_DNS_SCOPE --additive-vpc-scope-dns-domain=ADDITIVE_VPC_SCOPE_DNS_DOMAIN | --disable-additive-vpc-scope | --dataplane-v2-observability-mode=DATAPLANE_V2_OBSERVABILITY_MODE | --disable-dataplane-v2-flow-observability | --enable-dataplane-v2-flow-observability --disable-dataplane-v2-metrics | --enable-dataplane-v2-metrics | --disable-auto-ipam | --enable-auto-ipam | --disable-l4-lb-firewall-reconciliation | --enable-l4-lb-firewall-reconciliation | --disable-pod-snapshots | --enable-pod-snapshots | --enable-authorized-networks-on-private-endpoint --enable-dns-access --enable-google-cloud-access --enable-ip-access --enable-k8s-certs-via-dns --enable-k8s-tokens-via-dns --enable-master-global-access --enable-private-endpoint --enable-master-authorized-networks --master-authorized-networks=NETWORK, + [NETWORK,...] | --enable-autoprovisioning + --autoprovisioning-config-file=PATH_TO_FILE + | --autoprovisioning-image-type=AUTOPROVISIONING_IMAGE_TYPE + --autoprovisioning-locations=ZONE,[ZONE,...] + --autoprovisioning-min-cpu-platform=PLATFORM --max-cpu=MAX_CPU + --max-memory=MAX_MEMORY --min-cpu=MIN_CPU --min-memory=MIN_MEMORY + --autoprovisioning-max-surge-upgrade=AUTOPROVISIONING_MAX_SURGE_UPGRADE --autoprovisioning-max-unavailable-upgrade=AUTOPROVISIONING_MAX_UNAVAILABLE_UPGRADE --autoprovisioning-node-pool-soak-duration=AUTOPROVISIONING_NODE_POOL_SOAK_DURATION --autoprovisioning-standard-rollout-policy=[batch-node-count=BATCH_NODE_COUNT, + batch-percent=BATCH_NODE_PERCENTAGE, + batch-soak-duration=BATCH_SOAK_DURATION,...] + --enable-autoprovisioning-blue-green-upgrade + | --enable-autoprovisioning-surge-upgrade + --autoprovisioning-scopes=[SCOPE,...] + --autoprovisioning-service-account=AUTOPROVISIONING_SERVICE_ACCOUNT + --enable-autoprovisioning-autorepair + --enable-autoprovisioning-autoupgrade + [--max-accelerator=[type=TYPE,count=COUNT,...] + : --min-accelerator=[type=TYPE,count=COUNT,...]] + | --enable-insecure-binding-system-authenticated + --enable-insecure-binding-system-unauthenticated + | --logging-service=LOGGING_SERVICE + --monitoring-service=MONITORING_SERVICE + | --[no-]enable-ray-cluster-logging + --[no-]enable-ray-cluster-monitoring | --[no-]enable-secret-manager + --[no-]enable-secret-manager-rotation + --secret-manager-rotation-interval=SECRET_MANAGER_ROTATION_INTERVAL + | --[no-]enable-secret-sync --[no-]enable-secret-sync-rotation + --secret-sync-rotation-interval=SECRET_SYNC_ROTATION_INTERVAL + | --password=PASSWORD --enable-basic-auth + | --username=USERNAME, -u USERNAME) [--async] + [--cloud-run-config=[load-balancer-type=EXTERNAL,...]] + [--node-pool=NODE_POOL] + [--location=LOCATION | --region=REGION | --zone=ZONE, -z ZONE] + [--location-policy=LOCATION_POLICY --max-nodes=MAX_NODES + --min-nodes=MIN_NODES + --total-max-nodes=TOTAL_MAX_NODES --total-min-nodes=TOTAL_MIN_NODES] + [GCLOUD_WIDE_FLAG ...] + +DESCRIPTION + Update cluster settings for an existing container cluster. + +EXAMPLES + To enable autoscaling for an existing cluster, run: + + $ gcloud container clusters update sample-cluster \ + --enable-autoscaling + +POSITIONAL ARGUMENTS + NAME + The name of the cluster to update. + +REQUIRED FLAGS + Exactly one of these must be specified: + + --anonymous-authentication-config=ANONYMOUS_AUTHENTICATION_CONFIG + Enable or restrict anonymous access to the cluster. When enabled, + anonymous users will be authenticated as system:anonymous with the + group system:unauthenticated. Limiting access restricts anonymous + access to only the health check endpoints /readyz, /livez, and + /healthz. + + ANONYMOUS_AUTHENTICATION_CONFIG must be one of: + + ENABLED + 'ENABLED' enables anonymous calls. + LIMITED + 'LIMITED' restricts anonymous access to the cluster. Only calls + to the health check endpoints are allowed anonymously, all other + calls will be rejected. + + --autopilot-general-profile=AUTOPILOT_GENERAL_PROFILE + Sets the Autopilot general profile for the cluster; possible values + are none and no-performance. If none is used, the cluster will use + the Autopilot default configuration. AUTOPILOT_GENERAL_PROFILE must + be one of: none, no-performance. + + --autopilot-privileged-admission=[ALLOWLIST_PATHS,...] + Specifies which privileged workload allowlist paths can be referenced + and installed by AllowlistSynchronizers in Autopilot modes. + + The value is a comma-separated list of paths in the format: + + + gke://// for Autopilot + partner allowlists + + gs:/// for user allowlists + + By default, all GKE-managed allowlists (gke://*) are authorized. See + https://cloud.google.com/kubernetes-engine/docs/resources/autopilot-partners + for all supported Autopilot partner allowlists. When setting this + flag, be careful to explicitly specify gke://* in addition to other + entries if you rely on this default behavior. + + Wildcards (*) are supported. For example, if gke://* is authorized, + then AllowlistSynchronizers can be used to install + gke://partner1/allowlist1.yaml and gke://partner2/allowlist2.yaml. + + Note: Use of user allowlists (gs://) requires special permissions and + is only available to a subset of high tier customers. Please contact + your account team for more information. + + Examples: + + Allow all GKE-managed allowlists (default behavior): + + $ gcloud container clusters update \ + --autopilot-privileged-admission=gke://* + + Authorize only allowlists from a GKE Autopilot partner: + + $ gcloud container clusters update \ + --autopilot-privileged-admission=gke://my-partner/* + + Authorize only a singular user-owned allowlist + + $ gcloud container clusters update \ + --autopilot-privileged-admission=gs://my-bucket/allowlists/\ + my-allowlist.yaml + + Authorize all user-owned allowlists under a given path: + + $ gcloud container clusters update \ + --autopilot-privileged-admission=gs://my-bucket/* + + Authorize all GKE-managed allowlists and a specific user-owned + allowlist: + + $ gcloud container clusters update \ + --autopilot-privileged-admission=gke://*,gs://my-bucket/\ + allowlists/my-allowlist.yaml + + Disable allowlist installation entirely: + + $ gcloud container clusters update \ + --autopilot-privileged-admission="" + + Exercise caution when using this flag on an existing cluster. Upon + updates, existing AllowlistSynchronizers will uninstall allowlists + that are no longer authorized. + + For instructions on installing allowlists in the cluster after + authorization, please refer to: + https://cloud.google.com/kubernetes-engine/docs/how-to/run-autopilot-partner-workloads + + --autopilot-workload-policies=WORKLOAD_POLICIES + Add Autopilot workload policies to the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --autopilot-workload-policies=allow-net-admin + + The only supported workload policy is 'allow-net-admin'. + + --autoprovisioning-cgroup-mode=AUTOPROVISIONING_CGROUP_MODE + Sets the cgroup mode for auto-provisioned nodes. + + Updating this flag triggers an update using surge upgrades of all + existing auto-provisioned nodes to apply the new value of cgroup + mode. + + For an Autopilot cluster, the specified cgroup mode will be set on + all existing and new nodes in the cluster. For a Standard cluster, + the specified cgroup mode will be set on all existing and new + auto-provisioned node pools in the cluster. + + If not set, GKE uses cgroupv2 for new nodes when the cluster was + created running 1.26 or later, and cgroupv1 for clusters created + running 1.25 or earlier. To check your initial cluster version, run + gcloud container clusters describe [NAME] + --format="value(initialClusterVersion)" + + For clusters created running version 1.26 or later, you can't set the + cgroup mode to v1. + + To learn more, see: + https://cloud.google.com/kubernetes-engine/docs/how-to/migrate-cgroupv2. + + AUTOPROVISIONING_CGROUP_MODE must be one of: default, v1, v2. + + --autoprovisioning-enable-insecure-kubelet-readonly-port + Enables the Kubelet's insecure read only port for Autoprovisioned + Node Pools. + + If not set, the value from nodePoolDefaults.nodeConfigDefaults will + be used. + + To disable the readonly port + --no-autoprovisioning-enable-insecure-kubelet-readonly-port. + + --autoprovisioning-network-tags=[TAGS,...] + Replaces the user specified Compute Engine tags on all nodes in all + the existing auto-provisioned node pools in the Standard cluster or + the Autopilot with the given tags (comma separated). + + Examples: + + $ gcloud container clusters update example-cluster \ + --autoprovisioning-network-tags=tag1,tag2 + + New nodes in auto-provisioned node pools, including ones created by + resize or recreate, will have these tags on the Compute Engine API + instance object and these tags can be used in firewall rules. See + https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create + for examples. + + --autoprovisioning-resource-manager-tags=[KEY=VALUE,...] + For an Autopilot cluster, the specified comma-separated resource + manager tags that has the GCP_FIREWALL purpose replace the existing + tags on all nodes in the cluster. + + For a Standard cluster, the specified comma-separated resource + manager tags that has the GCE_FIREWALL purpose are applied to all + nodes in the new newly created auto-provisioned node pools. Existing + auto-provisioned node pools retain the tags that they had before the + update. To update tags on an existing auto-provisioned node pool, use + the node pool level flag '--resource-manager-tags'. + + Examples: + + $ gcloud container clusters update example-cluster \ + --autoprovisioning-resource-manager-tags=tagKeys/\ + 1234=tagValues/2345 + $ gcloud container clusters update example-cluster \ + --autoprovisioning-resource-manager-tags=my-project/key1=value1 + $ gcloud container clusters update example-cluster \ + --autoprovisioning-resource-manager-tags=12345/key1=value1,\ + 23456/key2=value2 + $ gcloud container clusters update example-cluster \ + --autoprovisioning-resource-manager-tags= + + All nodes in an Autopilot cluster or all newly created + auto-provisioned nodes in a Standard cluster, including nodes that + are resized or re-created, will have the specified tags on the + corresponding Instance object in the Compute Engine API. You can + reference these tags in network firewall policy rules. For + instructions, see + https://cloud.google.com/firewall/docs/use-tags-for-firewalls. + + --autoscaling-profile=AUTOSCALING_PROFILE + Set autoscaling behaviour, choices are 'optimize-utilization' and + 'balanced'. Default is 'balanced'. + + --complete-credential-rotation + Complete the IP and credential rotation for this cluster. For + example: + + $ gcloud container clusters update example-cluster \ + --complete-credential-rotation + + This causes the cluster to stop serving its old IP, return to a + single IP, and invalidate old credentials. See documentation for more + details: + https://cloud.google.com/kubernetes-engine/docs/how-to/credential-rotation. + + --complete-ip-rotation + Complete the IP rotation for this cluster. For example: + + $ gcloud container clusters update example-cluster \ + --complete-ip-rotation + + This causes the cluster to stop serving its old IP, and return to a + single IP state. See documentation for more details: + https://cloud.google.com/kubernetes-engine/docs/how-to/ip-rotation. + + --containerd-config-from-file=PATH_TO_FILE + Path of the YAML file that contains containerd configuration entries + like configuring access to private image registries. + + For detailed information on the configuration usage, please refer to + https://cloud.google.com/kubernetes-engine/docs/how-to/customize-containerd-configuration. + + Note: Updating the containerd configuration of an existing cluster or + node pool requires recreation of the existing nodes, which might + cause disruptions in running workloads. + + Use a full or relative path to a local file containing the value of + containerd_config. + + --control-plane-egress=CONTROL_PLANE_EGRESS + Configures the egress policy for the GKE control plane to control + outbound traffic from the kube-apiserver. CONTROL_PLANE_EGRESS must + be one of: + + NONE + (Recommended) Provides maximum security. This mode removes the + control plane's public IP address and blocks all outbound traffic + from the kube-apiserver by default, preventing unexpected data + exfiltration. Webhooks that use clientConfig.url will be + disabled. Essential GKE-managed services are still permitted to + function via an internal allowlist. + VIA_CONTROL_PLANE + (Default) Maintains backward compatibility. The control plane + retains its public IP address and allows egress traffic from the + kube-apiserver. + + --database-encryption-key=DATABASE_ENCRYPTION_KEY + Enable Database Encryption. + + Enable database encryption that will be used to encrypt Kubernetes + Secrets at the application layer. The key provided should be the + resource ID in the format of + projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + For more information, see + https://cloud.google.com/kubernetes-engine/docs/how-to/encrypting-secrets. + + --disable-database-encryption + Disable database encryption. + + Disable Database Encryption which encrypt Kubernetes Secrets at the + application layer. For more information, see + https://cloud.google.com/kubernetes-engine/docs/how-to/encrypting-secrets. + + --disable-default-snat + Disable default source NAT rules applied in cluster nodes. + + By default, cluster nodes perform source network address translation + (SNAT) for packets sent from Pod IP address sources to destination IP + addresses that are not in the non-masquerade CIDRs list. For more + details about SNAT and IP masquerading, see: + https://cloud.google.com/kubernetes-engine/docs/how-to/ip-masquerade-agent#how_ipmasq_works + SNAT changes the packet's source IP address to the node's internal IP + address. + + When this flag is set, GKE does not perform SNAT for packets sent to + any destination. You must set this flag if the cluster uses privately + reused public IPs. + + The --disable-default-snat flag is only applicable to private GKE + clusters, which are inherently VPC-native. Thus, + --disable-default-snat requires that the cluster was created with + both --enable-ip-alias and --enable-private-nodes. + + --disable-multi-nic-lustre + Disable the Lustre CSI driver to automatically detect and configure + all suitable network interfaces on a node for Lustre IO. + + --disable-workload-identity + Disable Workload Identity on the cluster. + + For more information on Workload Identity, see + + https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity + + --enable-agent-sandbox + Enable the Agent Sandbox feature on the cluster. Use + --no-enable-agent-sandbox to disable. + + --[no-]enable-autopilot-compatibility-auditing + Lets you run the gcloud container clusters + check-autopilot-compatibility + (https://cloud.google.com/sdk/gcloud/reference/container/clusters/check-autopilot-compatibility) + command to check whether your workloads are compatible with Autopilot + mode. This flag is only applicable to clusters that run version + 1.31.6-gke.1027000 or later. + + Note: This flag causes a control plane restart. + + Use --enable-autopilot-compatibility-auditing to enable and + --no-enable-autopilot-compatibility-auditing to disable. + + --enable-autoscaling + Enables autoscaling for a node pool. + + Enables autoscaling in the node pool specified by --node-pool or the + default node pool if --node-pool is not provided. If not already, + --max-nodes or --total-max-nodes must also be set. + + --[no-]enable-cilium-clusterwide-network-policy + Enable Cilium Clusterwide Network Policies on the cluster. Use + --enable-cilium-clusterwide-network-policy to enable and + --no-enable-cilium-clusterwide-network-policy to disable. + + --enable-cost-allocation + Enable the cost management feature. + + When enabled, you can get informational GKE cost breakdowns by + cluster, namespace and label in your billing data exported to + BigQuery + (https://cloud.google.com/billing/docs/how-to/export-data-bigquery). + + Use --no-enable-cost-allocation to disable this feature. + + --enable-default-compute-class + Enable the default compute class to use for the cluster. + + To disable Default Compute Class in an existing cluster, explicitly + set flag --no-enable-default-compute-class. + + --enable-fqdn-network-policy + Enable FQDN Network Policies on the cluster. FQDN Network Policies + are disabled by default. + + --enable-identity-service + Enable Identity Service component on the cluster. + + When enabled, users can authenticate to Kubernetes cluster with + external identity providers. + + Identity Service is by default disabled when creating a new cluster. + To disable Identity Service in an existing cluster, explicitly set + flag --no-enable-identity-service. + + --enable-image-streaming + Enable Image Streaming for the cluster, allowing nodes to stream + container image data from Artifact Registry on demand to reduce + container start times. This flag sets the default for new node pools. + It is enabled by default on Autopilot clusters. + + See Image Streaming documentation + (https://cloud.google.com/kubernetes-engine/docs/how-to/image-streaming) + for full requirements (including version, API enablement and Artifact + Registry usage). To disable Image Streaming for the cluster, use + --no-enable-image-streaming. + + --enable-insecure-kubelet-readonly-port + Enables the Kubelet's insecure read only port. + + To disable the readonly port on a cluster or node-pool set the flag + to --no-enable-insecure-kubelet-readonly-port. + + --enable-intra-node-visibility + Enable Intra-node visibility for this cluster. + + Enabling intra-node visibility makes your intra-node pod-to-pod + traffic visible to the networking fabric. With this feature, you can + use VPC flow logging or other VPC features for intra-node traffic. + + Enabling it on an existing cluster causes the cluster master and the + cluster nodes to restart, which might cause a disruption. + + --enable-kernel-module-signature-enforcement + Enforces that kernel modules are signed on all new nodes in the + cluster unless explicitly overridden with + --no-enable-kernel-module-signature-enforcement when creating the + nodepool. Use --no-enable-kernel-module-signature-enforcement to + disable. + + Examples: + + $ gcloud container clusters update example-cluster \ + --enable-kernel-module-signature-enforcement + + --enable-kubernetes-unstable-apis=API,[API,...] + Enable Kubernetes beta API features on this cluster. Beta APIs are + not expected to be production ready and should be avoided in + production-grade environments. + + --enable-l4-ilb-subsetting + Enable Subsetting for L4 ILB services created on this cluster. + + --enable-legacy-authorization + Enables the legacy ABAC authentication for the cluster. User rights + are granted through the use of policies which combine attributes + together. For a detailed look at these properties and related + formats, see https://kubernetes.io/docs/admin/authorization/abac/. To + use RBAC permissions instead, create or update your cluster with the + option --no-enable-legacy-authorization. + + --enable-legacy-lustre-port + Allow the Lustre CSI driver to initialize LNet (the virtual network + layer for Lustre kernel module) using port 6988. This flag is + required to workaround a port conflict with the gke-metadata-server + on GKE nodes. + + --enable-multi-networking + Enables multi-networking on the cluster. Multi-networking is disabled + by default. + + --enable-network-policy + Enable network policy enforcement for this cluster. If you are + enabling network policy on an existing cluster the network policy + addon must first be enabled on the master by using + --update-addons=NetworkPolicy=ENABLED flag. + + --enable-private-nodes + Standard cluster: Enable private nodes as a default behavior for all + newly created node pools, if --enable-private-nodes is not provided + at node pool creation time. + + Modifications to this flag do not affect `--enable-private-nodes` state of the + existing node pools. + + Autopilot cluster: Force new and existing workloads, without explicit + cloud.google.com/private-node=true node selector, to run on nodes + with no public IP address. + + Modifications to this flag trigger a re-schedule operation on all existng + workloads to run on different node VMs. + + --enable-service-externalips + Enables use of services with externalIPs field. + + --enable-shielded-nodes + Enable Shielded Nodes for this cluster. Enabling Shielded Nodes will + enable a more secure Node credential bootstrapping implementation. + Starting with version 1.18, clusters will have Shielded GKE nodes by + default. + + --enable-slice-controller + Enable Slice Controller for the cluster. Use + --no-enable-slice-controller to disable. + + --enable-stackdriver-kubernetes + (DEPRECATED) Enable Cloud Operations for GKE. + + The --enable-stackdriver-kubernetes flag is deprecated and will be + removed in an upcoming release. Please use --logging and --monitoring + instead. For more information, please read: + https://cloud.google.com/kubernetes-engine/docs/concepts/about-logs + and + https://cloud.google.com/kubernetes-engine/docs/how-to/configure-metrics. + + Or at most one of these can be specified: + + Flags for vertical pod autoscaling: + + --enable-vertical-pod-autoscaling + Enable vertical pod autoscaling for a cluster. + + --gateway-api=GATEWAY_API + Enables GKE Gateway controller in this cluster. The value of the flag + specifies which Open Source Gateway API release channel will be used + to define Gateway resources. GATEWAY_API must be one of: + + disabled + Gateway controller will be disabled in the cluster. + + standard + Gateway controller will be enabled in the cluster. Resource + definitions from the standard OSS Gateway API release channel + will be installed. + + --generate-password + Ask the server to generate a secure password and use that as the + basic auth password, keeping the existing username. + + --hpa-profile=HPA_PROFILE + Set Horizontal Pod Autoscaler behavior. Accepted values are: none, + performance. For more information, see + https://cloud.google.com/kubernetes-engine/docs/how-to/horizontal-pod-autoscaling#hpa-profile. + + --in-transit-encryption=IN_TRANSIT_ENCRYPTION + Enable Dataplane V2 in-transit encryption. Dataplane v2 in-transit + encryption is disabled by default. IN_TRANSIT_ENCRYPTION must be one + of: inter-node-transparent, none. + + --logging-variant=LOGGING_VARIANT + Specifies the logging variant that will be deployed on all the nodes + in the cluster. Valid logging variants are MAX_THROUGHPUT, DEFAULT. + If no value is specified, DEFAULT is used. LOGGING_VARIANT must be + one of: + + DEFAULT + 'DEFAULT' variant requests minimal resources but may not + guarantee high throughput. + MAX_THROUGHPUT + 'MAX_THROUGHPUT' variant requests more node resources and is able + to achieve logging throughput up to 10MB per sec. + + --maintenance-window=START_TIME + Set a time of day when you prefer maintenance to start on this + cluster. For example: + + $ gcloud container clusters update example-cluster \ + --maintenance-window=12:43 + + The time corresponds to the UTC time zone, and must be in HH:MM + format. + + Non-emergency maintenance will occur in the 4 hour block starting at + the specified time. + + This is mutually exclusive with the recurring maintenance windows and + will overwrite any existing window. Compatible with maintenance + exclusions. + + To remove an existing maintenance window from the cluster, use + '--clear-maintenance-window'. + + --network-performance-configs=[PROPERTY1=VALUE1,...] + Configures network performance settings for the cluster. Node pools + can override with their own settings. + + total-egress-bandwidth-tier + Total egress bandwidth is the available outbound bandwidth from a + VM, regardless of whether the traffic is going to internal IP or + external IP destinations. The following tier values are allowed: + [TIER_UNSPECIFIED,TIER_1]. + + See + https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration + for more information. + + --node-creation-mode=NODE_CREATION_MODE + Configures node creation mode for the cluster, either via kubelet or + via control plane. NODE_CREATION_MODE must be one of: + + CONTROL_PLANE + registers nodes via control plane; kubelet registration will be + rejected. This selection will not take effect if you turn off + Shielded Nodes. + KUBELET + registers nodes via kubelet. + + --node-locations=ZONE,[ZONE,...] + The set of zones in which the specified node footprint should be + replicated. All zones must be in the same region as the cluster's + master(s), specified by the -location, --zone, or --region flag. + Additionally, for zonal clusters, --node-locations must contain the + cluster's primary zone. If not specified, all nodes will be in the + cluster's primary zone (for zonal clusters) or spread across three + randomly chosen zones within the cluster's region (for regional + clusters). + + Note that NUM_NODES nodes will be created in each zone, such that if + you specify --num-nodes=4 and choose two locations, 8 nodes will be + created. + + Multiple locations can be specified, separated by commas. For + example: + + $ gcloud container clusters update example-cluster \ + --location us-central1-a \ + --node-locations us-central1-a,us-central1-b + + --notification-config=[pubsub=ENABLED|DISABLED,pubsub-topic=TOPIC,...] + The notification configuration of the cluster. GKE supports + publishing cluster upgrade notifications to any Pub/Sub topic you + created in the same project. Create a subscription for the topic + specified to receive notification messages. See + https://cloud.google.com/pubsub/docs/admin on how to manage Pub/Sub + topics and subscriptions. You can also use the filter option to + specify which event types you'd like to receive from the following + options: SecurityBulletinEvent, UpgradeEvent, UpgradeInfoEvent, + UpgradeAvailableEvent. + + Examples: + + $ gcloud container clusters update example-cluster \ + --notification-config=pubsub=ENABLED,pubsub-topic=projects/\ + {project}/topics/{topic-name} + $ gcloud container clusters update example-cluster \ + --notification-config=pubsub=ENABLED,pubsub-topic=projects/\ + {project}/topics/{topic-name},\ + filter="SecurityBulletinEvent|UpgradeEvent" + + The project of the Pub/Sub topic must be the same one as the cluster. + It can be either the project ID or the project number. + + --patch-update=[PATCH_UPDATE] + The patch update to use for the cluster. + + Setting to 'accelerated' automatically upgrades the cluster to the + latest patch available within the cluster's current minor version and + release channel. Setting to 'default' automatically upgrades the + cluster to the default patch upgrade targetversion available within + the cluster's current minor version and release channel. + + PATCH_UPDATE must be one of: accelerated, default. + + --private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPE + Sets the type of private access to Google services over IPv6. + + PRIVATE_IPV6_GOOGLE_ACCESS_TYPE must be one of: + + bidirectional + Allows Google services to initiate connections to GKE pods in this + cluster. This is not intended for common use, and requires previous + integration with Google services. + + disabled + Default value. Disables private access to Google services over IPv6. + + outbound-only + Allows GKE pods to make fast, secure requests to Google services + over IPv6. This is the most common use of private IPv6 access. + + $ gcloud alpha container clusters create \ + --private-ipv6-google-access-type=disabled + $ gcloud alpha container clusters create \ + --private-ipv6-google-access-type=outbound-only + $ gcloud alpha container clusters create \ + --private-ipv6-google-access-type=bidirectional + + PRIVATE_IPV6_GOOGLE_ACCESS_TYPE must be one of: bidirectional, + disabled, outbound-only. + + --release-channel=CHANNEL + Subscribe or unsubscribe this cluster to a release channel. + + When a cluster is subscribed to a release channel, Google maintains + both the master version and the node version. Node auto-upgrade is + enabled by default for release channel clusters and can be controlled + via upgrade-scope exclusions + (https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#scope_of_maintenance_to_exclude). + + CHANNEL must be one of: + + None + Use 'None' to opt-out of any release channel. + + extended + Clusters subscribed to 'extended' can remain on a minor version + for 24 months from when the minor version is made available in + the Regular channel. + + rapid + 'rapid' channel is offered on an early access basis for customers + who want to test new releases. + + WARNING: Versions available in the 'rapid' channel may be subject + to unresolved issues with no known workaround and are not subject + to any SLAs. + + regular + Clusters subscribed to 'regular' receive versions that are + considered GA quality. 'regular' is intended for production users + who want to take advantage of new features. + + stable + Clusters subscribed to 'stable' receive versions that are known + to be stable and reliable in production. + + --remove-autopilot-workload-policies=REMOVE_WORKLOAD_POLICIES + Remove Autopilot workload policies from the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --remove-autopilot-workload-policies=allow-net-admin + + The only supported workload policy is 'allow-net-admin'. + + --remove-labels=[KEY,...] + Labels to remove from the Google Cloud resources in use by the + Kubernetes Engine cluster. These are unrelated to Kubernetes labels. + + Examples: + + $ gcloud container clusters update example-cluster \ + --remove-labels=label_a,label_b + + --remove-workload-policies=REMOVE_WORKLOAD_POLICIES + Remove Autopilot workload policies from the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --remove-workload-policies=allow-net-admin + + The only supported workload policy is 'allow-net-admin'. + + --security-group=SECURITY_GROUP + The name of the RBAC security group for use with Google security + groups in Kubernetes RBAC + (https://kubernetes.io/docs/reference/access-authn-authz/rbac/). + + To include group membership as part of the claims issued by Google + during authentication, a group must be designated as a security group + by including it as a direct member of this group. + + If unspecified, no groups will be returned for use with RBAC. + + --security-posture=SECURITY_POSTURE + Sets the mode of the Kubernetes security posture API's off-cluster + features. + + To enable advanced mode explicitly set the flag to + --security-posture=enterprise. + + To enable in standard mode explicitly set the flag to + --security-posture=standard + + To disable in an existing cluster, explicitly set the flag to + --security-posture=disabled. + + For more information on enablement, see + https://cloud.google.com/kubernetes-engine/docs/concepts/about-security-posture-dashboard#feature-enablement. + + SECURITY_POSTURE must be one of: disabled, standard, enterprise. + + --set-password + Set the basic auth password to the specified value, keeping the + existing username. + + --stack-type=STACK_TYPE + IP stack type of the cluster nodes. STACK_TYPE must be one of: ipv4, + ipv4-ipv6. + + --start-credential-rotation + Start the rotation of IP and credentials for this cluster. For + example: + + $ gcloud container clusters update example-cluster \ + --start-credential-rotation + + This causes the cluster to serve on two IPs, and will initiate a node + upgrade to point to the new IP. See documentation for more details: + https://cloud.google.com/kubernetes-engine/docs/how-to/credential-rotation. + + --start-ip-rotation + Start the rotation of this cluster to a new IP. For example: + + $ gcloud container clusters update example-cluster \ + --start-ip-rotation + + This causes the cluster to serve on two IPs, and will initiate a node + upgrade to point to the new IP. See documentation for more details: + https://cloud.google.com/kubernetes-engine/docs/how-to/ip-rotation. + + --tier=TIER + (DEPRECATED) Set the desired tier for the cluster. + + The --tier flag is deprecated. More info: + https://cloud.google.com/kubernetes-engine/docs/release-notes#September_02_2025. + TIER must be one of: standard, enterprise. + + --update-addons=[ADDON=ENABLED|DISABLED,...] + Cluster addons to enable or disable. Options are + HorizontalPodAutoscaling=ENABLED|DISABLED + HttpLoadBalancing=ENABLED|DISABLED + KubernetesDashboard=ENABLED|DISABLED NetworkPolicy=ENABLED|DISABLED + BackupRestore=ENABLED|DISABLED CloudRun=ENABLED|DISABLED + ConfigConnector=ENABLED|DISABLED NodeLocalDNS=ENABLED|DISABLED + GcePersistentDiskCsiDriver=ENABLED|DISABLED + GcpFilestoreCsiDriver=ENABLED|DISABLED + GcsFuseCsiDriver=ENABLED|DISABLED + NodeReadinessController=ENABLED|DISABLED + + --update-labels=[KEY=VALUE,...] + Labels to apply to the Google Cloud resources in use by the + Kubernetes Engine cluster. These are unrelated to Kubernetes labels. + + Examples: + + $ gcloud container clusters update example-cluster \ + --update-labels=label_a=value1,label_b=value2 + + --workload-policies=WORKLOAD_POLICIES + Add Autopilot workload policies to the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --workload-policies=allow-net-admin + + The only supported workload policy is 'allow-net-admin'. + + --workload-pool=WORKLOAD_POOL + Enable Workload Identity on the cluster. + + When enabled, Kubernetes service accounts will be able to act as + Cloud IAM Service Accounts, through the provided workload pool. + + Currently, the only accepted workload pool is the workload pool of + the Cloud project containing the cluster, PROJECT_ID.svc.id.goog. + + For more information on Workload Identity, see + + https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity + + --workload-vulnerability-scanning=WORKLOAD_VULNERABILITY_SCANNING + Sets the mode of the Kubernetes security posture API's workload + vulnerability scanning. + + To enable Advanced vulnerability insights mode explicitly set the + flag to --workload-vulnerability-scanning=enterprise. + + To enable in standard mode explicitly set the flag to + --workload-vulnerability-scanning=standard. + + To disable in an existing cluster, explicitly set the flag to + --workload-vulnerability-scanning=disabled. + + For more information on enablement, see + https://cloud.google.com/kubernetes-engine/docs/concepts/about-security-posture-dashboard#feature-enablement. + + WORKLOAD_VULNERABILITY_SCANNING must be one of: disabled, standard, + enterprise. + + Or at least one of these can be specified: + + --additional-ip-ranges=[subnetwork=NAME,pod-ipv4-range=NAME,...] + Add additional subnetworks named "my-subnet" with pod ipv4 range + named "my-range" to the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --additional-ip-ranges=subnetwork=my-subnet,\ + pod-ipv4-range=my-range + + --remove-additional-ip-ranges=[subnetwork=NAME,pod-ipv4-range=NAME,...] + Additional subnetworks to be removed from the cluster. + + Examples: + + Remove pod range named "my-range" under additional subnetwork named + "my-subnet" from the cluster. + + $ gcloud container clusters update example-cluster \ + --remove-additional-ip-ranges=subnetwork=my-subnet,\ + pod-ipv4-range=my-range + + Remove additional subnetwork named "my-subnet", including all the + pod ipv4 ranges under the subnetwork. + + $ gcloud container clusters update example-cluster \ + --remove-additional-ip-ranges=subnetwork=my-subnet + + Or at least one of these can be specified: + + --additional-pod-ipv4-ranges=NAME,[NAME,...] + Additional IP address ranges(by name) for pods that need to be + added to the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --additional-pod-ipv4-ranges=range1,range2 + + --remove-additional-pod-ipv4-ranges=NAME,[NAME,...] + Previously added additional pod ranges(by name) for pods that are + to be removed from the cluster. + + Examples: + + $ gcloud container clusters update example-cluster \ + --remove-additional-pod-ipv4-ranges=range1,range2 + + Or at least one of these can be specified: + + --auto-monitoring-scope=AUTO_MONITORING_SCOPE + Enables Auto-Monitoring for a specific scope within the cluster. + ALL: Enables Auto-Monitoring for all supported workloads within the + cluster. NONE: Disables Auto-Monitoring. AUTO_MONITORING_SCOPE must + be one of: ALL, NONE. + + --logging=[COMPONENT,...] + Set the components that have logging enabled. Valid component + values are: SYSTEM, WORKLOAD, API_SERVER, CONTROLLER_MANAGER, + SCHEDULER, KCP_HPA, KCP_VPA, NONE + + For more information, see + https://cloud.google.com/kubernetes-engine/docs/concepts/about-logs#available-logs + + Examples: + + $ gcloud container clusters update --logging=SYSTEM + $ gcloud container clusters update \ + --logging=SYSTEM,API_SERVER,WORKLOAD + $ gcloud container clusters update --logging=NONE + + --managed-otel-scope=MANAGED_OTEL_SCOPE + Specifies the scope of Managed OpenTelemetry within the cluster. + + COLLECTION_AND_INSTRUMENTATION_COMPONENTS: Enables GKE Managed + OpenTelemetry Collector and other Instrumentations components like + Instrumentation CRD within the cluster. NONE: Disables the GKE + Managed OpenTelemetry. + + MANAGED_OTEL_SCOPE must be one of: + COLLECTION_AND_INSTRUMENTATION_COMPONENTS, NONE. + + --monitoring=[COMPONENT,...] + Set the components that have monitoring enabled. Valid component + values are: SYSTEM, WORKLOAD (Deprecated), NONE, API_SERVER, + CONTROLLER_MANAGER, SCHEDULER, DAEMONSET, DEPLOYMENT, HPA, POD, + STATEFULSET, STORAGE, CADVISOR, KUBELET, DCGM, JOBSET + + Note: DAEMONSET, DEPLOYMENT, HPA, POD, STATEFULSET, STORAGE, + CADVISOR, KUBELET, DCGM, and JOBSET require Google Managed + Prometheus to be enabled. + + For more information, see + https://cloud.google.com/kubernetes-engine/docs/how-to/configure-metrics#available-metrics + + Examples: + + $ gcloud container clusters update --monitoring=SYSTEM,API_SERVER,POD + $ gcloud container clusters update --monitoring=NONE + + At most one of these can be specified: + + --disable-managed-prometheus + Disable managed collection for Managed Service for Prometheus. + + --enable-managed-prometheus + Enables managed collection for Managed Service for Prometheus in + the cluster. + + See + https://cloud.google.com/stackdriver/docs/managed-prometheus/setup-managed#enable-mgdcoll-gke + for more info. + + Enabled by default for cluster versions 1.27 or greater, use + --no-enable-managed-prometheus to disable. + + Or at least one of these can be specified: + + Flags for Binary Authorization: + + At most one of these can be specified: + + --binauthz-evaluation-mode=BINAUTHZ_EVALUATION_MODE + Enable Binary Authorization for this cluster. + BINAUTHZ_EVALUATION_MODE must be one of: disabled, + project-singleton-policy-enforce. + + --enable-binauthz + (DEPRECATED) Enable Binary Authorization for this cluster. + + The --enable-binauthz flag is deprecated. Please use + --binauthz-evaluation-mode instead. + + Or at least one of these can be specified: + + --clear-fleet-project + Remove the cluster from current fleet host project. Example: $ + gcloud container clusters update --clear-fleet-project + + --enable-fleet + Set cluster project as the fleet host project. This will register + the cluster to the same project. To register the cluster to a fleet + in a different project, please use + --fleet-project=FLEET_HOST_PROJECT. Example: $ gcloud container + clusters update --enable-fleet + + --fleet-project=PROJECT_ID_OR_NUMBER + Sets fleet host project for the cluster. If specified, the current + cluster will be registered as a fleet membership under the fleet + host project. + + Example: $ gcloud container clusters update + --fleet-project=my-project + + --membership-type=MEMBERSHIP_TYPE + Specify a membership type for the cluster's fleet membership. + Example: $ gcloud container clusters update + --membership-type=LIGHTWEIGHT. \ MEMBERSHIP_TYPE must be (only one + value is supported): + + LIGHTWEIGHT + Fleet membership representing this cluster will be lightweight. + + --unset-membership-type + Set the membership type for the cluster's fleet membership to + empty. Example: $ gcloud container clusters update + --unset-membership-type + + Or at least one of these can be specified: + + Flags for cluster disruption budget configuration: + + At most one of these can be specified: + + --clear-maintenance-minor-version-disruption-interval + Restore the default values for the minimum interval of time + between minor version cluster upgrades. + + --maintenance-minor-version-disruption-interval=MAINTENANCE_MINOR_VERSION_DISRUPTION_INTERVAL + Set the minimum interval of time between minor version cluster + upgrades. + + At most one of these can be specified: + + --clear-maintenance-patch-version-disruption-interval + Restore the default values for the minimum interval of time + between patch version cluster upgrades. + + --maintenance-patch-version-disruption-interval=MAINTENANCE_PATCH_VERSION_DISRUPTION_INTERVAL + Set the minimum interval of time between patch version cluster + upgrades. + + Or at most one of these can be specified: + + --clear-maintenance-window + If set, remove the maintenance window that was set with + --maintenance-window family of flags. + + --remove-maintenance-exclusion=NAME + Name of a maintenance exclusion to remove. If you hadn't specified + a name, one was auto-generated. Get it with $ gcloud container + clusters describe. + + Or at least one of these can be specified: + + Sets a period of time in which maintenance should not occur. This is + compatible with both daily and recurring maintenance windows. If + --add-maintenance-exclusion-scope is not specified, the exclusion + will exclude all upgrades. + + Examples: + + $ gcloud container clusters update example-cluster \ + --add-maintenance-exclusion-name=holidays-2000 \ + --add-maintenance-exclusion-start=2000-11-20T00:00:00 \ + --add-maintenance-exclusion-end=2000-12-31T23:59:59 \ + --add-maintenance-exclusion-scope=no_upgrades + + --add-maintenance-exclusion-name=NAME + A descriptor for the exclusion that can be used to remove it. If + not specified, it will be autogenerated. + + --add-maintenance-exclusion-scope=SCOPE + Scope of the exclusion window to specify the type of upgrades + that the exclusion will apply to. If not specified in an + exclusion, defaults to no_upgrades. SCOPE must be one of: + no_upgrades, no_minor_upgrades, no_minor_or_node_upgrades. + + --add-maintenance-exclusion-start=TIME_STAMP + Start time of the exclusion window (can occur in the past). If + not specified, the current time will be used. See $ gcloud topic + datetimes for information on time formats. + + Exactly one of these must be specified: + + --add-maintenance-exclusion-end=TIME_STAMP + End time of the exclusion window. Must take place after the + start time. See $ gcloud topic datetimes for information on + time formats. + + --add-maintenance-exclusion-until-end-of-support + End time of the exclusion window is the end of the cluster's + support. + + Or at least one of these can be specified: + + Set a flexible maintenance window by specifying a window that recurs + per an RFC 5545 RRULE. Non-emergency maintenance will occur in the + recurring windows. + + Examples: + + For a 9-5 Mon-Wed UTC-4 maintenance window: + + $ gcloud container clusters update example-cluster \ + --maintenance-window-start=2000-01-01T09:00:00-04:00 \ + --maintenance-window-end=2000-01-01T17:00:00-04:00 \ + --maintenance-window-recurrence='FREQ=WEEKLY;BYDAY=MO,TU,WE' + + For a daily window from 22:00 - 04:00 UTC: + + $ gcloud container clusters update example-cluster \ + --maintenance-window-start=2000-01-01T22:00:00Z \ + --maintenance-window-end=2000-01-02T04:00:00Z \ + --maintenance-window-recurrence=FREQ=DAILY + + --maintenance-window-recurrence=RRULE + An RFC 5545 RRULE, specifying how the window will recur. Note + that minimum requirements for maintenance periods will be + enforced. Note that FREQ=SECONDLY, MINUTELY, and HOURLY are not + supported. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --maintenance-window-start=TIME_STAMP + Start time of the first window (can occur in the past). The start + time influences when the window will start for recurrences. See $ + gcloud topic datetimes for information on time formats. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + Exactly one of these must be specified: + + --maintenance-window-duration=PT1H23M45S + The duration of maintenance windows, expressed as an ISO 8601 + duration (https://en.wikipedia.org/wiki/ISO_8601#Durations) in + hours, minutes, and seconds. You must set a maintenance window + to at least 4 hours (4H). Use this flag or the + --maintenance-window-end flag for the duration of the + maintenance window. + + --maintenance-window-end=TIME_STAMP + The end time for calculating the duration of the maintenance + window, as expressed by the amount of time after the + START_TIME, in the same format. The value for END_TIME must be + in the future, relative to START_TIME. This only calculates the + duration of the window, and doesn't set when the maintenance + window stops recurring. Maintenance windows only stop recurring + when they're removed. See $ gcloud topic datetimes for + information on time formats. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + Or at most one of these can be specified: + + Exports cluster's usage of cloud resources + + --clear-resource-usage-bigquery-dataset + Disables exporting cluster resource usage to BigQuery. + + Or at least one of these can be specified: + + --enable-network-egress-metering + Enable network egress metering on this cluster. + + When enabled, a DaemonSet is deployed into the cluster. Each + DaemonSet pod meters network egress traffic by collecting data + from the conntrack table, and exports the metered metrics to the + specified destination. + + Network egress metering is disabled if this flag is omitted, or + when --no-enable-network-egress-metering is set. + + --enable-resource-consumption-metering + Enable resource consumption metering on this cluster. + + When enabled, a table will be created in the specified BigQuery + dataset to store resource consumption data. The resulting table + can be joined with the resource usage table or with BigQuery + billing export. + + To disable resource consumption metering, set + --no-enable-resource-consumption- metering. If this flag is + omitted, then resource consumption metering will remain enabled + or disabled depending on what is already configured for this + cluster. + + --resource-usage-bigquery-dataset=RESOURCE_USAGE_BIGQUERY_DATASET + The name of the BigQuery dataset to which the cluster's usage of + cloud resources is exported. A table will be created in the + specified dataset to store cluster resource usage. The resulting + table can be joined with BigQuery Billing Export to produce a + fine-grained cost breakdown. + + Examples: + + $ gcloud container clusters update example-cluster \ + --resource-usage-bigquery-dataset=example_bigquery_dataset_name + + Or at least one of these can be specified: + + ClusterDNS + + --cluster-dns=CLUSTER_DNS + DNS provider to use for this cluster. CLUSTER_DNS must be one of: + + clouddns + Selects Cloud DNS as the DNS provider for the cluster. + default + Selects the default DNS provider (kube-dns) for the cluster. + kubedns + Selects Kube DNS as the DNS provider for the cluster. + + --cluster-dns-domain=CLUSTER_DNS_DOMAIN + DNS domain for this cluster. The default value is cluster.local. + This is configurable when --cluster-dns=clouddns and + --cluster-dns-scope=vpc are set. The value must be a valid DNS + subdomain as defined in RFC 1123. + + --cluster-dns-scope=CLUSTER_DNS_SCOPE + DNS scope for the Cloud DNS zone created - valid only with + --cluster-dns=clouddns. Defaults to cluster. + + CLUSTER_DNS_SCOPE must be one of: + + cluster + Configures the Cloud DNS zone to be private to the cluster. + vpc + Configures the Cloud DNS zone to be private to the VPC Network. + + At most one of these can be specified: + + --additive-vpc-scope-dns-domain=ADDITIVE_VPC_SCOPE_DNS_DOMAIN + The domain used in Additive VPC scope. Only works with Cluster + Scope. + + --disable-additive-vpc-scope + Disables Additive VPC Scope. + + Or at least one of these can be specified: + + At most one of these can be specified: + + --dataplane-v2-observability-mode=DATAPLANE_V2_OBSERVABILITY_MODE + (REMOVED) Select Advanced Datapath Observability mode for the + cluster. Defaults to DISABLED. + + Advanced Datapath Observability allows for a real-time view into + pod-to-pod traffic within your cluster. + + Examples: + + $ gcloud container clusters update \ + --dataplane-v2-observability-mode=DISABLED + + $ gcloud container clusters update \ + --dataplane-v2-observability-mode=INTERNAL_VPC_LB + + $ gcloud container clusters update \ + --dataplane-v2-observability-mode=EXTERNAL_LB + + Flag --dataplane-v2-observability-mode has been removed. + + DATAPLANE_V2_OBSERVABILITY_MODE must be one of: + + DISABLED + Disables Advanced Datapath Observability. + EXTERNAL_LB + Makes Advanced Datapath Observability available to the + external network. + INTERNAL_VPC_LB + Makes Advanced Datapath Observability available from the VPC + network. + + --disable-dataplane-v2-flow-observability + Disables Advanced Datapath Observability. + + --enable-dataplane-v2-flow-observability + Enables Advanced Datapath Observability which allows for a + real-time view into pod-to-pod traffic within your cluster. + + At most one of these can be specified: + + --disable-dataplane-v2-metrics + Stops exposing advanced datapath flow metrics on node port. + + --enable-dataplane-v2-metrics + Exposes advanced datapath flow metrics on node port. + + Or at most one of these can be specified: + + --disable-auto-ipam + Disable the Auto IP Address Management (Auto IPAM) feature for the + cluster. + + --enable-auto-ipam + Enable the Auto IP Address Management (Auto IPAM) feature for the + cluster. + + Or at most one of these can be specified: + + --disable-l4-lb-firewall-reconciliation + Disable reconciliation on the cluster for L4 Load Balancer VPC + firewalls targeting ingress traffic. + + --enable-l4-lb-firewall-reconciliation + Enable reconciliation on the cluster for L4 Load Balancer VPC + firewalls targeting ingress traffic. L4 LB VPC firewall + reconciliation is enabled by default. + + Or at most one of these can be specified: + + --disable-pod-snapshots + Disable the Pod Snapshot feature on the cluster. + + --enable-pod-snapshots + Enable the Pod Snapshot feature on the cluster. + + Or at least one of these can be specified: + + --enable-authorized-networks-on-private-endpoint + Enable enforcement of --master-authorized-networks CIDR ranges for + traffic reaching cluster's control plane via private IP. + + --enable-dns-access + Enable access to the cluster's control plane over DNS-based + endpoint. + + DNS-based control plane access is recommended. + + --enable-google-cloud-access + When you enable Google Cloud Access, any public IP addresses owned + by Google Cloud can reach the public control plane endpoint of your + cluster. + + --enable-ip-access + Enable access to the cluster's control plane over private IP and + public IP if --enable-private-endpoint is not enabled. + + --enable-k8s-certs-via-dns + Enable K8s client certificates Authentication to the cluster's + control plane over DNS-based endpoint. + + --enable-k8s-tokens-via-dns + Enable K8s Service Account tokens Authentication to the cluster's + control plane over DNS-based endpoint. + + --enable-master-global-access + Use with private clusters to allow access to the master's private + endpoint from any Google Cloud region or on-premises environment + regardless of the private cluster's region. + + --enable-private-endpoint + Enables cluster's control plane to be accessible using private IP + address only. + + Master Authorized Networks + + --enable-master-authorized-networks + Allow only specified set of CIDR blocks (specified by the + --master-authorized-networks flag) to connect to Kubernetes master + through HTTPS. Besides these blocks, the following have access as + well: + + 1) The private network the cluster connects to if + `--enable-private-nodes` is specified. + 2) Google Compute Engine Public IPs if `--enable-private-nodes` is not + specified. + + Use --no-enable-master-authorized-networks to disable. When + disabled, public internet (0.0.0.0/0) is allowed to connect to + Kubernetes master through HTTPS. + + --master-authorized-networks=NETWORK,[NETWORK,...] + The list of CIDR blocks (up to 100 for private cluster, 50 for + public cluster) that are allowed to connect to Kubernetes master + through HTTPS. Specified in CIDR notation (e.g. 1.2.3.4/30). Cannot + be specified unless --enable-master-authorized-networks is also + specified. + + Or at least one of these can be specified: + + Node autoprovisioning + + --enable-autoprovisioning + Enables node autoprovisioning for a cluster. + + Cluster Autoscaler will be able to create new node pools. Requires + maximum CPU and memory limits to be specified. + + At most one of these can be specified: + + --autoprovisioning-config-file=PATH_TO_FILE + Path of the JSON/YAML file which contains information about the + cluster's node autoprovisioning configuration. Currently it + contains a list of resource limits, identity defaults for + autoprovisioning, node upgrade settings, node management + settings, minimum cpu platform, image type, node locations for + autoprovisioning, disk type and size configuration, Shielded + instance settings, and customer-managed encryption keys settings. + + Resource limits are specified in the field 'resourceLimits'. Each + resource limits definition contains three fields: resourceType, + maximum and minimum. Resource type can be "cpu", "memory" or an + accelerator (e.g. "nvidia-tesla-t4" for NVIDIA T4). Use gcloud + compute accelerator-types list to learn about available + accelerator types. Maximum is the maximum allowed amount with the + unit of the resource. Minimum is the minimum allowed amount with + the unit of the resource. + + Identity default contains at most one of the below fields: + serviceAccount: The Google Cloud Platform Service Account to be + used by node VMs in autoprovisioned node pools. If not specified, + the project's default service account is used. scopes: A list of + scopes to be used by node instances in autoprovisioned node + pools. Multiple scopes can be specified, separated by commas. For + information on defaults, look at: + https://cloud.google.com/sdk/gcloud/reference/container/clusters/create#--scopes + + Node Upgrade settings are specified under the field + 'upgradeSettings', which has the following fields: + maxSurgeUpgrade: Number of extra (surge) nodes to be created on + each upgrade of an autoprovisioned node pool. + maxUnavailableUpgrade: Number of nodes that can be unavailable at + the same time on each upgrade of an autoprovisioned node pool. + + Node Management settings are specified under the field + 'management', which has the following fields: autoUpgrade: A + boolean field that indicates if node autoupgrade is enabled for + autoprovisioned node pools. autoRepair: A boolean field that + indicates if node autorepair is enabled for autoprovisioned node + pools. + + minCpuPlatform (deprecated): If specified, new autoprovisioned + nodes will be scheduled on host with specified CPU architecture + or a newer one. Note: Min CPU platform can only be specified in + Beta and Alpha. + + Autoprovisioned node image is specified under the 'imageType' + field. If not specified the default value will be applied. + + Autoprovisioning locations is a set of zones where new node pools + can be created by Autoprovisioning. Autoprovisioning locations + are specified in the field 'autoprovisioningLocations'. All zones + must be in the same region as the cluster's master(s). + + Disk type and size are specified under the 'diskType' and + 'diskSizeGb' fields, respectively. If specified, new + autoprovisioned nodes will be created with custom boot disks + configured by these settings. + + Shielded instance settings are specified under the + 'shieldedInstanceConfig' field, which has the following fields: + enableSecureBoot: A boolean field that indicates if secure boot + is enabled for autoprovisioned nodes. enableIntegrityMonitoring: + A boolean field that indicates if integrity monitoring is enabled + for autoprovisioned nodes. + + Customer Managed Encryption Keys (CMEK) used by new + auto-provisioned node pools can be specified in the + 'bootDiskKmsKey' field. + + Use a full or relative path to a local file containing the value + of autoprovisioning_config_file. + + Or at least one of these can be specified: + + Flags to configure autoprovisioned nodes + + --autoprovisioning-image-type=AUTOPROVISIONING_IMAGE_TYPE + Node Autoprovisioning will create new nodes with the specified + image type + + --autoprovisioning-locations=ZONE,[ZONE,...] + Set of zones where new node pools can be created by + autoprovisioning. All zones must be in the same region as the + cluster's master(s). Multiple locations can be specified, + separated by commas. + + --autoprovisioning-min-cpu-platform=PLATFORM + (DEPRECATED) If specified, new autoprovisioned nodes will be + scheduled on host with specified CPU architecture or a newer + one. + + The --autoprovisioning-min-cpu-platform flag is deprecated and + will be removed in an upcoming release. More info: + https://cloud.google.com/kubernetes-engine/docs/release-notes#March_08_2022 + + --max-cpu=MAX_CPU + Maximum number of cores in the cluster. + + Maximum number of cores to which the cluster can scale. + Required to be set when --enable-autoprovisioning is used. + + --max-memory=MAX_MEMORY + Maximum memory in the cluster. + + Maximum number of gigabytes of memory to which the cluster can + scale. Required to be set when --enable-autoprovisioning is + used. + + --min-cpu=MIN_CPU + Minimum number of cores in the cluster. + + Minimum number of cores to which the cluster can scale. + + --min-memory=MIN_MEMORY + Minimum memory in the cluster. + + Minimum number of gigabytes of memory to which the cluster can + scale. + + Flags to specify upgrade settings for autoprovisioned nodes: + + --autoprovisioning-max-surge-upgrade=AUTOPROVISIONING_MAX_SURGE_UPGRADE + Number of extra (surge) nodes to be created on each upgrade of + an autoprovisioned node pool. + + --autoprovisioning-max-unavailable-upgrade=AUTOPROVISIONING_MAX_UNAVAILABLE_UPGRADE + Number of nodes that can be unavailable at the same time on + each upgrade of an autoprovisioned node pool. + + --autoprovisioning-node-pool-soak-duration=AUTOPROVISIONING_NODE_POOL_SOAK_DURATION + Time in seconds to be spent waiting during blue-green upgrade + before deleting the blue pool and completing the update. This + argument should be used in conjunction with + --enable-autoprovisioning-blue-green-upgrade to take effect. + + --autoprovisioning-standard-rollout-policy=[batch-node-count=BATCH_NODE_COUNT,batch-percent=BATCH_NODE_PERCENTAGE,batch-soak-duration=BATCH_SOAK_DURATION,...] + Standard rollout policy options for blue-green upgrade. This + argument should be used in conjunction with + --enable-autoprovisioning-blue-green-upgrade to take effect. + + Batch sizes are specified by one of, batch-node-count or + batch-percent. The duration between batches is specified by + batch-soak-duration. + + Example: + --standard-rollout-policy=batch-node-count=3,batch-soak-duration=60s + --standard-rollout-policy=batch-percent=0.05,batch-soak-duration=180s + + Flag group to choose the top level upgrade option: + + At most one of these can be specified: + + --enable-autoprovisioning-blue-green-upgrade + Whether to use blue-green upgrade for the autoprovisioned + node pool. + + --enable-autoprovisioning-surge-upgrade + Whether to use surge upgrade for the autoprovisioned node + pool. + + Flags to specify identity for autoprovisioned nodes: + + --autoprovisioning-scopes=[SCOPE,...] + The scopes to be used by node instances in autoprovisioned node + pools. Multiple scopes can be specified, separated by commas. + For information on defaults, look at: + https://cloud.google.com/sdk/gcloud/reference/container/clusters/create#--scopes + + --autoprovisioning-service-account=AUTOPROVISIONING_SERVICE_ACCOUNT + The Google Cloud Platform Service Account to be used by node + VMs in autoprovisioned node pools. If not specified, the + project default service account is used. + + Flags to specify node management settings for autoprovisioned + nodes: + + --enable-autoprovisioning-autorepair + Enable node autorepair for autoprovisioned node pools. Use + --no-enable-autoprovisioning-autorepair to disable. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --enable-autoprovisioning-autoupgrade + Enable node autoupgrade for autoprovisioned node pools. Use + --no-enable-autoprovisioning-autoupgrade to disable. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + Arguments to set limits on accelerators: + + --max-accelerator=[type=TYPE,count=COUNT,...] + Sets maximum limit for a single type of accelerators (e.g. + GPUs) in cluster. + + type + (Required) The specific type (e.g. nvidia-tesla-t4 for + NVIDIA T4) of accelerator for which the limit is set. Use + gcloud compute accelerator-types list to learn about all + available accelerator types. + + count + (Required) The maximum number of accelerators to which the + cluster can be scaled. + + This flag argument must be specified if any of the other + arguments in this group are specified. + + --min-accelerator=[type=TYPE,count=COUNT,...] + Sets minimum limit for a single type of accelerators (e.g. + GPUs) in cluster. Defaults to 0 for all accelerator types if it + isn't set. + + type + (Required) The specific type (e.g. nvidia-tesla-t4 for + NVIDIA T4) of accelerator for which the limit is set. Use + gcloud compute accelerator-types list to learn about all + available accelerator types. + + count + (Required) The minimum number of accelerators to which the + cluster can be scaled. + + Or at least one of these can be specified: + + --enable-insecure-binding-system-authenticated + Allow using system:authenticated as a subject in + ClusterRoleBindings and RoleBindings. Allowing bindings that + reference system:authenticated is a security risk and is not + recommended. + + To disallow binding system:authenticated in a cluster, explicitly + set the --no-enable-insecure-binding-system-authenticated flag + instead. + + --enable-insecure-binding-system-unauthenticated + Allow using system:unauthenticated and system:anonymous as subjects + in ClusterRoleBindings and RoleBindings. Allowing bindings that + reference system:unauthenticated and system:anonymous are a + security risk and is not recommended. + + To disallow binding system:authenticated in a cluster, explicitly + set the --no-enable-insecure-binding-system-unauthenticated flag + instead. + + Or at least one of these can be specified: + + --logging-service=LOGGING_SERVICE + (DEPRECATED) Logging service to use for the cluster. Options are: + "logging.googleapis.com/kubernetes" (the Google Cloud Logging + service with Kubernetes-native resource model enabled), + "logging.googleapis.com" (the Google Cloud Logging service), "none" + (logs will not be exported from the cluster) + + The --logging-service flag is deprecated and will be removed in an + upcoming release. Please use --logging instead. For more + information, please read: + https://cloud.google.com/kubernetes-engine/docs/concepts/about-logs. + + --monitoring-service=MONITORING_SERVICE + (DEPRECATED) Monitoring service to use for the cluster. Options + are: "monitoring.googleapis.com/kubernetes" (the Google Cloud + Monitoring service with Kubernetes-native resource model enabled), + "monitoring.googleapis.com" (the Google Cloud Monitoring service), + "none" (no metrics will be exported from the cluster) + + The --monitoring-service flag is deprecated and will be removed in + an upcoming release. Please use --monitoring instead. For more + information, please read: + https://cloud.google.com/kubernetes-engine/docs/how-to/configure-metrics. + + Or at least one of these can be specified: + + --[no-]enable-ray-cluster-logging + Enable automatic log processing sidecar for Ray clusters. Use + --enable-ray-cluster-logging to enable and + --no-enable-ray-cluster-logging to disable. + + --[no-]enable-ray-cluster-monitoring + Enable automatic metrics collection for Ray clusters. Use + --enable-ray-cluster-monitoring to enable and + --no-enable-ray-cluster-monitoring to disable. + + Or at least one of these can be specified: + + Flags for Secret Manager configuration: + + --[no-]enable-secret-manager + Enables the Secret Manager CSI driver provider component. See + https://secrets-store-csi-driver.sigs.k8s.io/introduction + https://github.com/GoogleCloudPlatform/secrets-store-csi-driver-provider-gcp. + Use --enable-secret-manager to enable and + --no-enable-secret-manager to disable. + + --[no-]enable-secret-manager-rotation + Enables the rotation of secrets in the Secret Manager CSI driver + provider component. Use --enable-secret-manager-rotation to enable + and --no-enable-secret-manager-rotation to disable. + + --secret-manager-rotation-interval=SECRET_MANAGER_ROTATION_INTERVAL + Set the rotation period for secrets in the Secret Manager CSI + driver provider component. If you don't specify a time interval for + the rotation, it will default to a rotation period of two minutes. + + Or at least one of these can be specified: + + Flags for Secret Sync configuration: + + --[no-]enable-secret-sync + Enables the Secret Sync component. For details, see Synchronize + secrets to Kubernetes Secrets + (https://docs.cloud.google.com/secret-manager/docs/sync-k8-secrets). + Use --enable-secret-sync to enable and --no-enable-secret-sync to + disable. + + --[no-]enable-secret-sync-rotation + Enables the rotation of secrets in the Secret Sync component. Use + --enable-secret-sync-rotation to enable and + --no-enable-secret-sync-rotation to disable. + + --secret-sync-rotation-interval=SECRET_SYNC_ROTATION_INTERVAL + Set the rotation period for secrets in the Secret Sync component. + + Or at least one of these can be specified: + + Basic auth + + --password=PASSWORD + The password to use for cluster auth. Defaults to a + server-specified randomly-generated string. + + Options to specify the username. + + At most one of these can be specified: + + --enable-basic-auth + Enable basic (username/password) auth for the cluster. + --enable-basic-auth is an alias for --username=admin; + --no-enable-basic-auth is an alias for --username="". Use + --password to specify a password; if not, the server will + randomly generate one. For cluster versions before 1.12, if + neither --enable-basic-auth nor --username is specified, + --enable-basic-auth will default to true. After 1.12, + --enable-basic-auth will default to false. + + --username=USERNAME, -u USERNAME + The user name to use for basic auth for the cluster. Use + --password to specify a password; if not, the server will + randomly generate one. + +OPTIONAL FLAGS + --async + Return immediately, without waiting for the operation in progress to + complete. + + --cloud-run-config=[load-balancer-type=EXTERNAL,...] + Configurations for Cloud Run addon, requires --addons=CloudRun for + create and --update-addons=CloudRun=ENABLED for update. + + load-balancer-type + (Optional) Type of load-balancer-type EXTERNAL or INTERNAL. + + Examples: + + $ gcloud container clusters update example-cluster \ + --cloud-run-config=load-balancer-type=INTERNAL + + --node-pool=NODE_POOL + Node pool to be updated. + + At most one of these can be specified: + + --location=LOCATION + Compute zone or region (e.g. us-central1-a or us-central1) for the + cluster. Overrides the default compute/region or compute/zone value + for this command invocation. Prefer using this flag over the --region + or --zone flags. + + --region=REGION + Compute region (e.g. us-central1) for a regional cluster. Overrides + the default compute/region property value for this command + invocation. + + --zone=ZONE, -z ZONE + Compute zone (e.g. us-central1-a) for a zonal cluster. Overrides the + default compute/zone property value for this command invocation. + + Cluster autoscaling + + --location-policy=LOCATION_POLICY + Location policy specifies the algorithm used when scaling-up the node + pool. + + * BALANCED - Is a best effort policy that aims to balance the sizes + of available zones. + * ANY - Instructs the cluster autoscaler to prioritize utilization of + unused reservations, and reduces preemption risk for Spot VMs. + + LOCATION_POLICY must be one of: BALANCED, ANY. + + --max-nodes=MAX_NODES + Maximum number of nodes per zone in the node pool. + + Maximum number of nodes per zone to which the node pool specified by + --node-pool (or default node pool if unspecified) can scale. Ignored + unless --enable-autoscaling is also specified. + + --min-nodes=MIN_NODES + Minimum number of nodes per zone in the node pool. + + Minimum number of nodes per zone to which the node pool specified by + --node-pool (or default node pool if unspecified) can scale. Ignored + unless --enable-autoscaling is also specified. + + --total-max-nodes=TOTAL_MAX_NODES + Maximum number of all nodes in the node pool. + + Maximum number of all nodes to which the node pool specified by + --node-pool (or default node pool if unspecified) can scale. Ignored + unless --enable-autoscaling is also specified. + + --total-min-nodes=TOTAL_MIN_NODES + Minimum number of all nodes in the node pool. + + Minimum number of all nodes to which the node pool specified by + --node-pool (or default node pool if unspecified) can scale. Ignored + unless --enable-autoscaling is also specified. + +GCLOUD WIDE FLAGS + These flags are available to all commands: --access-token-file, --account, + --billing-project, --configuration, --flags-file, --flatten, --format, + --help, --impersonate-service-account, --log-http, --project, --quiet, + --trace-token, --user-output-enabled, --verbosity. + + Run $ gcloud help for details. diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs index 3c004e686e0..5854a577431 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs @@ -4,6 +4,55 @@ namespace ModularPipelines.OptionsGenerator.Tests.Generators; public partial class RequiredConstructorValidationTests { + [Test] + public async Task Gcloud_Composer_Updates_Preserve_Optional_Resource_Settings() + { + var command = await GcloudCapturedSemanticsTests.Scrape("composer environments update"); + var group = command.RequiredAlternativeGroups.Single(group => group.PropertyNames.Contains("MaxWorkers")); + await ValidateCapturedGroup(command, group, + [ + ("", false), + ("MaxWorkers", true), + ("SchedulerCount", true), + ("MaxWorkers,SchedulerCount", true), + ("NodeCount", true), + ("NodeCount,MaxWorkers", false), + ("MaintenanceWindowStart,MaintenanceWindowEnd,MaintenanceWindowRecurrence", true), + ("MaintenanceWindowStart", false), + ]); + } + + [Test] + public async Task Gcloud_Container_Autoprovisioning_Preserves_Optional_Settings() + { + var command = await GcloudCapturedSemanticsTests.Scrape("container clusters update"); + var group = command.RequiredAlternativeGroups.Single(group => group.PropertyNames.Contains("AutoprovisioningConfigFile")); + await ValidateCapturedGroup(command, group, + [ + ("AutoprovisioningConfigFile", true), + ("EnableAutoprovisioning,AutoprovisioningConfigFile", true), + ("AutoprovisioningConfigFile,AutoprovisioningMinCpuPlatform", false), + ]); + } + + [Test] + public async Task Gcloud_Cluster_Director_Updates_Do_Not_Require_Unrelated_Granular_Flags() + { + var command = await GcloudCapturedSemanticsTests.Scrape("cluster-director clusters update"); + var group = command.RequiredAlternativeGroups.Single(group => group.PropertyNames.Contains("Config")); + await ValidateCapturedGroup(command, group, + [ + ("", false), + ("Description", true), + ("RemoveLabels", true), + ("Description,RemoveLabels", true), + ("Config,UpdateMask", true), + ("Config", false), + ("UpdateMask", false), + ("Config,UpdateMask,Description", false), + ]); + } + [Test] public async Task Gcloud_Build_Trigger_Updates_Preserve_Documented_Nested_Choices() { @@ -75,7 +124,7 @@ await ValidateCapturedGroup(command, group, } [Test] - public async Task Gcloud_Agent_Identity_Oauth_Requires_Every_Selected_Branch_Member() + public async Task Gcloud_Agent_Identity_Oauth_Preserves_Optional_Members_Within_Exclusive_Branches() { var command = await GcloudCapturedSemanticsTests.Scrape("agent-identity auth-providers create"); var group = command.RequiredAlternativeGroups.Single(group => group.PropertyNames.Contains("ApiKey")); @@ -92,7 +141,8 @@ public async Task Gcloud_Agent_Identity_Oauth_Requires_Every_Selected_Branch_Mem foreach (var branch in new[] { threeLegged, twoLegged }) { var members = branch.Split(','); - cases.AddRange(members.Select(missing => (string.Join(',', members.Where(member => member != missing)), false))); + cases.AddRange(members.Select(missing => (string.Join(',', members.Where(member => member != missing)), true))); + cases.AddRange(members.Select(member => (member, true))); } await ValidateCapturedGroup(command, group, [.. cases]); diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs index ba493ed24a4..425f3086b92 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using ModularPipelines.OptionsGenerator.Generators; using ModularPipelines.OptionsGenerator.Models; using ModularPipelines.OptionsGenerator.Tests.Scrapers.Cli; @@ -130,8 +131,16 @@ private static async Task ValidateCapturedGroup(CliCommandDefinition command, Cl { var options = command.Options.Where(option => group.PropertyNames.Contains(option.PropertyName)).ToList(); var generated = await Generate(options, alternativeGroups: [group]); + var enums = await new EnumGenerator().GenerateAsync(new CliToolDefinition + { + ToolName = "tool", + NamespacePrefix = "Tool", + TargetNamespace = "ModularPipelines.Tool", + OutputDirectory = "src/ModularPipelines.Tool", + Commands = [command], + }); const string secretAttribute = "namespace ModularPipelines.Secrets { public sealed class SecretValueAttribute : System.Attribute; }"; - var optionsType = Compile(generated, secretAttribute).GetType("ModularPipelines.Tool.Options.ToolRunOptions")!; + var optionsType = Compile([generated, secretAttribute, .. enums.Select(file => file.Content)]).GetType("ModularPipelines.Tool.Options.ToolRunOptions")!; foreach (var (properties, valid) in cases) { var instance = Activator.CreateInstance(optionsType)!; diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs index 690d1a0f2ab..d1d996a771f 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs @@ -421,6 +421,15 @@ private static CliRequiredAlternativeGroup PreserveDocumentedChoices(CliRequired && group.PropertyNames.ToHashSet(StringComparer.Ordinal).SetEquals(candidate.PropertyNames)); return choice ?? group with { + // Adjacent flags inside a synopsis branch can all be optional. Only the + // documented FLAGS constraints establish mandatory companion members. + Members = [.. group.Members.Select(member => member with + { + IsRequired = member.IsRequired && documented.SelectMany(candidate => candidate.Members) + .Any(candidate => candidate.PropertyName == member.PropertyName && candidate.IsRequired), + })], + IsRequired = group.IsChoice ? documented.FirstOrDefault(candidate => candidate.IsChoice + && group.PropertyNames.ToHashSet(StringComparer.Ordinal).SetEquals(candidate.PropertyNames))?.IsRequired ?? group.IsRequired : group.IsRequired, Groups = [.. group.Groups.Select(child => PreserveDocumentedChoices(child, documented))], }; } From 07d8c4d513d6b468937a523a5da7759ec7bd89ed Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 22 Sep 2026 03:39:46 +0100 Subject: [PATCH 2/3] fix(generator): retain named conditional option requirements --- ...ConditionalRequiredGroupValidationTests.cs | 38 +++++++++++ .../GcloudNestedSynopsisValidationTests.cs | 9 ++- .../GcloudPeerResourceValidationTests.cs | 14 +++- .../InheritedPropertyCollisionResolver.cs | 4 ++ .../Generators/OptionsClassGenerator.cs | 7 ++ .../Models/CliRequiredAlternativeGroup.cs | 5 ++ .../Scrapers/Cli/CliScraperBase.cs | 2 +- ...cloudCliScraper.ConditionalRequirements.cs | 66 +++++++++++++++++++ .../Scrapers/Cli/GcloudCliScraper.cs | 1 + 9 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/ConditionalRequiredGroupValidationTests.cs create mode 100644 tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.ConditionalRequirements.cs diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/ConditionalRequiredGroupValidationTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/ConditionalRequiredGroupValidationTests.cs new file mode 100644 index 00000000000..cb543dfb38b --- /dev/null +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/ConditionalRequiredGroupValidationTests.cs @@ -0,0 +1,38 @@ +using System.ComponentModel.DataAnnotations; +using ModularPipelines.OptionsGenerator.Models; + +namespace ModularPipelines.OptionsGenerator.Tests.Generators; + +public partial class RequiredConstructorValidationTests +{ + [Test] + [Arguments("Enabled", null, false, true)] + [Arguments("Enabled", false, false, true)] + [Arguments("Enabled", true, false, false)] + [Arguments("Enabled", true, true, true)] + [Arguments("Enabled", null, true, true)] + [Arguments("Clone", false, false, true)] + [Arguments("Clone", true, false, false)] + [Arguments("Clone", true, true, true)] + public async Task Conditional_Requirement_Activates_Only_For_A_Present_Flag(string triggerName, bool? enabled, bool supplied, bool valid) + { + var generated = await Generate( + [ + new() { SwitchName = "--enabled", PropertyName = triggerName, CSharpType = "bool?", IsFlag = true }, + new() { SwitchName = "--value", PropertyName = "Value", CSharpType = "string?" }, + ], alternativeGroups: + [ + new CliRequiredAlternativeGroup + { + RequiredWhen = new() { PropertyName = triggerName, OptionSwitch = "--enabled" }, + IsChoice = false, + Members = [new() { PropertyName = "Value", OptionSwitch = "--value", IsRequired = true }], + }, + ]); + var type = Compile(generated).GetType("ModularPipelines.Tool.Options.ToolRunOptions")!; + var instance = Activator.CreateInstance(type)!; + type.GetProperties().Single(property => property.PropertyType == typeof(bool?)).SetValue(instance, enabled); + type.GetProperty("Value")!.SetValue(instance, supplied ? "value" : null); + await Assert.That(Validator.TryValidateObject(instance, new(instance), [], true)).IsEqualTo(valid); + } +} diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs index 5854a577431..a38c98e204c 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs @@ -26,11 +26,16 @@ await ValidateCapturedGroup(command, group, public async Task Gcloud_Container_Autoprovisioning_Preserves_Optional_Settings() { var command = await GcloudCapturedSemanticsTests.Scrape("container clusters update"); - var group = command.RequiredAlternativeGroups.Single(group => group.PropertyNames.Contains("AutoprovisioningConfigFile")); - await ValidateCapturedGroup(command, group, + await ValidateCapturedGroups(command, command.RequiredAlternativeGroups, [ + ("EnableAutoprovisioning", false), ("AutoprovisioningConfigFile", true), ("EnableAutoprovisioning,AutoprovisioningConfigFile", true), + ("MaxCpu", true), + ("MaxMemory", true), + ("EnableAutoprovisioning,MaxCpu", false), + ("EnableAutoprovisioning,MaxMemory", false), + ("EnableAutoprovisioning,MaxCpu,MaxMemory", true), ("AutoprovisioningConfigFile,AutoprovisioningMinCpuPlatform", false), ]); } diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs index 425f3086b92..0b822890cdf 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudPeerResourceValidationTests.cs @@ -126,11 +126,16 @@ await ValidateCapturedGroup(command, group, private static IEnumerable Descendants(IEnumerable groups) => groups.SelectMany(group => new[] { group }.Concat(Descendants(group.Groups))); - private static async Task ValidateCapturedGroup(CliCommandDefinition command, CliRequiredAlternativeGroup group, + private static Task ValidateCapturedGroup(CliCommandDefinition command, CliRequiredAlternativeGroup group, + (string Properties, bool Valid)[] cases) => ValidateCapturedGroups(command, [group], cases); + + private static async Task ValidateCapturedGroups(CliCommandDefinition command, IReadOnlyList groups, (string Properties, bool Valid)[] cases) { - var options = command.Options.Where(option => group.PropertyNames.Contains(option.PropertyName)).ToList(); - var generated = await Generate(options, alternativeGroups: [group]); + var names = groups.SelectMany(group => group.PropertyNames) + .Concat(groups.SelectMany(EnumerateGroups).Select(group => group.RequiredWhen?.PropertyName).OfType()).ToHashSet(StringComparer.Ordinal); + var options = command.Options.Where(option => names.Contains(option.PropertyName)).ToList(); + var generated = await Generate(options, alternativeGroups: groups); var enums = await new EnumGenerator().GenerateAsync(new CliToolDefinition { ToolName = "tool", @@ -171,5 +176,8 @@ private static async Task ValidateCapturedGroup(CliCommandDefinition command, Cl await Assert.That(Validator.TryValidateObject(instance, new(instance), errors, true)) .IsEqualTo(valid).Because($"Selected {properties}: {string.Join("; ", errors)}"); } + + static IEnumerable EnumerateGroups(CliRequiredAlternativeGroup group) => + new[] { group }.Concat(group.Groups.SelectMany(EnumerateGroups)); } } diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/InheritedPropertyCollisionResolver.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/InheritedPropertyCollisionResolver.cs index 2264853e138..ea416eb37c4 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/InheritedPropertyCollisionResolver.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/InheritedPropertyCollisionResolver.cs @@ -95,6 +95,10 @@ private static CliCommandDefinition ResolveCommand( .ToArray(); CliRequiredAlternativeGroup ResolveGroup(CliRequiredAlternativeGroup group) => group with { + RequiredWhen = group.RequiredWhen is { } trigger ? trigger with + { + PropertyName = ResolveAlternativeMemberName(command, options, positionalArguments, trigger), + } : null, Members = [.. group.Members.Select(member => member with { PropertyName = ResolveAlternativeMemberName(command, options, positionalArguments, member), diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs index 628f417f92e..6729b775f2a 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs @@ -493,6 +493,13 @@ private static void GenerateGroupValidation( } string Presence(string propertyName) => GetPresenceExpression(command, positionalArguments, propertyName); + if (group.RequiredWhen is { } trigger) + { + var triggerPresence = Presence(trigger.PropertyName); + activation = activation is null ? triggerPresence : $"({activation}) && ({triggerPresence})"; + required = true; + } + if (group.IsUsageFormChoice) { // Usage forms describe sufficient combinations. A complete form remains valid diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Models/CliRequiredAlternativeGroup.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Models/CliRequiredAlternativeGroup.cs index 9342e6345d4..ff7c25e6b9d 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Models/CliRequiredAlternativeGroup.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Models/CliRequiredAlternativeGroup.cs @@ -7,6 +7,11 @@ namespace ModularPipelines.OptionsGenerator.Models; /// public sealed record CliRequiredAlternativeGroup { + /// + /// An option whose presence activates this constraint; otherwise the constraint is inactive. + /// + public CliRequiredAlternativeMember? RequiredWhen { get; init; } + /// /// Whether the group must be present when its containing bundle is selected. /// diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs index 64cec36eb41..be7405710c4 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs @@ -1076,7 +1076,7 @@ private static IReadOnlyList ResolveRequiredAlterna // A richer required help constraint already enforces presence over these members. // Optional help constraints cannot replace a synopsis requirement. if (inferred.IsUsageFormChoice - || !groups.Any(group => group.IsRequired && identities.SetEquals(GetAlternativeGroupIdentities(group)))) + || !groups.Any(group => group.IsRequired && group.RequiredWhen is null && identities.SetEquals(GetAlternativeGroupIdentities(group)))) { groups.Add(inferred); } diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.ConditionalRequirements.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.ConditionalRequirements.cs new file mode 100644 index 00000000000..9b885167ae8 --- /dev/null +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.ConditionalRequirements.cs @@ -0,0 +1,66 @@ +using System.Text.RegularExpressions; +using ModularPipelines.OptionsGenerator.Models; + +namespace ModularPipelines.OptionsGenerator.Scrapers.Cli; + +public partial class GcloudCliScraper +{ + private static void ApplyNamedConditionalRequirements(IReadOnlyList options, + List constraints) + { + var dependencies = options.SelectMany(option => NamedRequirementPattern().Matches(option.Description ?? "") + .Select(match => (Option: option, Trigger: match.Groups["switch"].Value))) + .GroupBy(dependency => dependency.Trigger, StringComparer.Ordinal); + foreach (var dependency in dependencies) + { + var trigger = options.FirstOrDefault(option => option.SwitchName == dependency.Key); + if (trigger is null) + { + continue; + } + + var required = dependency.Select(item => item.Option.PropertyName).ToHashSet(StringComparer.Ordinal); + if (required.Contains(trigger.PropertyName)) + { + continue; + } + + // A configuration file can replace the inline settings containing the + // named requirements. Retain that documented exclusive alternative. + var alternative = constraints.SelectMany(EnumerateConstraints) + .Where(group => group.RequiredWhen is null && group.IsChoice && group.IsMutuallyExclusive + && !group.PropertyNames.Contains(trigger.PropertyName) + && group.Members.Count + group.Groups.Count > 1 + && group.Groups.Any(branch => required.IsSubsetOf(branch.PropertyNames))) + .OrderBy(group => group.PropertyNames.Count).FirstOrDefault(); + var conditional = alternative is null ? new CliRequiredAlternativeGroup + { + IsChoice = false, + Members = [.. dependency.DistinctBy(item => item.Option.PropertyName).Select(item => new CliRequiredAlternativeMember + { + PropertyName = item.Option.PropertyName, + OptionSwitch = item.Option.SwitchName, + IsRequired = true, + })], + } : MarkNamedRequiredMembers(alternative, required); + constraints.Add(conditional with + { + IsRequired = true, + RequiredWhen = new() { PropertyName = trigger.PropertyName, OptionSwitch = trigger.SwitchName }, + }); + } + } + + private static CliRequiredAlternativeGroup MarkNamedRequiredMembers(CliRequiredAlternativeGroup group, + IReadOnlySet required) => group with + { + Members = [.. group.Members.Select(member => member with + { + IsRequired = member.IsRequired || required.Contains(member.PropertyName), + })], + Groups = [.. group.Groups.Select(child => MarkNamedRequiredMembers(child, required))], + }; + + [GeneratedRegex(@"\bRequired\s+to\s+be\s+set\s+when\s+(?--[\w-]+)\s+is\s+used\b", RegexOptions.IgnoreCase)] + private static partial Regex NamedRequirementPattern(); +} diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs index d1d996a771f..89e72f5c64c 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs @@ -375,6 +375,7 @@ private static List ExtractFromSection(string helpText, string sectionNa } ReconcileRequiredSynopsisChoices(usage.ArgumentGroupSynopsis ?? usage.Synopsis, options, requiredAlternativeGroups); + ApplyNamedConditionalRequirements(options, requiredAlternativeGroups); return (options, argumentGroups, requiredAlternativeGroups, positionalArguments, usage); } From 720321deb6c03958700ce4669547cd8c1ded0a37 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 22 Sep 2026 03:44:08 +0100 Subject: [PATCH 3/3] refactor(generator): isolate conditional validation activation --- .../Generators/OptionsClassGenerator.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs index 6729b775f2a..9f27c492c6b 100644 --- a/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs +++ b/tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Generators/OptionsClassGenerator.cs @@ -493,12 +493,7 @@ private static void GenerateGroupValidation( } string Presence(string propertyName) => GetPresenceExpression(command, positionalArguments, propertyName); - if (group.RequiredWhen is { } trigger) - { - var triggerPresence = Presence(trigger.PropertyName); - activation = activation is null ? triggerPresence : $"({activation}) && ({triggerPresence})"; - required = true; - } + (required, activation) = ResolveConditionalActivation(group, required, activation, Presence); if (group.IsUsageFormChoice) { @@ -539,6 +534,18 @@ string GroupPresence(CliRequiredAlternativeGroup nested) => } } + private static (bool Required, string? Activation) ResolveConditionalActivation(CliRequiredAlternativeGroup group, + bool required, string? activation, Func presence) + { + if (group.RequiredWhen is not { } trigger) + { + return (required, activation); + } + + var triggerPresence = presence(trigger.PropertyName); + return (true, activation is null ? triggerPresence : $"({activation}) && ({triggerPresence})"); + } + private static string GetCompleteUsageExpression(CliRequiredAlternativeGroup group, Func presence) { var expressions = group.Members.Select(member => presence(member.PropertyName))