From 00975ce0d77d16c037dcad39bcead39c39d61075 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:41:12 -0800 Subject: [PATCH] feat: Adds named reservation to InstancePolicy (#3672) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Adds named reservation to InstancePolicy --- docs:Remove "not yet implemented" for Accelerator & Refine Volume API docs --- docs: update the job id format requirement PiperOrigin-RevId: 489501779 Source-Link: https://github.com/googleapis/googleapis/commit/488a4bdeebf9c7f505f48bed23f0b95fcbbec0bb Source-Link: https://github.com/googleapis/googleapis-gen/commit/5b3d3a550015e9367ad13ee5f9febe0c3f84cf33 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiI1YjNkM2E1NTAwMTVlOTM2N2FkMTNlZTVmOWZlYmUwYzNmODRjZjMzIn0= * feat: Adds named reservation to InstancePolicy --- docs:Remove "not yet implemented" for Accelerator & Refine Volume API docs --- docs: update the job id format requirement PiperOrigin-RevId: 489502315 Source-Link: https://github.com/googleapis/googleapis/commit/db1cc1139fe0def1e87ead1fffbc5bedbeccb887 Source-Link: https://github.com/googleapis/googleapis-gen/commit/fcc564ef064c7dff31d7970e12318ad084703ac6 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiJmY2M1NjRlZjA2NGM3ZGZmMzFkNzk3MGUxMjMxOGFkMDg0NzAzYWM2In0= * docs: fix minor docstring formatting PiperOrigin-RevId: 490003354 Source-Link: https://github.com/googleapis/googleapis/commit/9afb89b5d45cf63a44aab5fe0c9c251a635e21e2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c51774cd8dd5804d5ec6f335b1855c28d1171a56 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiJjNTE3NzRjZDhkZDU4MDRkNWVjNmYzMzViMTg1NWMyOGQxMTcxYTU2In0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .../protos/google/cloud/batch/v1/batch.proto | 5 +- .../protos/google/cloud/batch/v1/job.proto | 7 ++- .../protos/google/cloud/batch/v1/volume.proto | 42 +++++++++-------- .../google/cloud/batch/v1alpha/batch.proto | 5 +- .../google/cloud/batch/v1alpha/job.proto | 12 +++-- .../google/cloud/batch/v1alpha/volume.proto | 46 ++++++++++--------- .../google-cloud-batch/protos/protos.d.ts | 6 +++ packages/google-cloud-batch/protos/protos.js | 23 ++++++++++ .../google-cloud-batch/protos/protos.json | 4 ++ .../generated/v1/batch_service.create_job.js | 5 +- ...nippet_metadata.google.cloud.batch.v1.json | 2 +- .../v1alpha/batch_service.create_job.js | 5 +- ...t_metadata.google.cloud.batch.v1alpha.json | 2 +- .../src/v1/batch_service_client.ts | 5 +- .../src/v1alpha/batch_service_client.ts | 5 +- 15 files changed, 111 insertions(+), 63 deletions(-) diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1/batch.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1/batch.proto index 5dfe9cad737..1fa330088f6 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1/batch.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1/batch.proto @@ -107,8 +107,9 @@ message CreateJobRequest { ]; // ID used to uniquely identify the Job within its parent scope. - // This field should contain at most 63 characters. - // Only alphanumeric characters or '-' are accepted. + // This field should contain at most 63 characters and must start with + // lowercase characters. + // Only lowercase characters, numbers and '-' are accepted. // The '-' character cannot be the first or the last one. // A system generated ID will be used if the field is not set. // diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1/job.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1/job.proto index 69305e41cce..0519f68f45d 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1/job.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1/job.proto @@ -263,7 +263,7 @@ message AllocationPolicy { string disk_interface = 6; } - // A new or an existing persistent disk or a local ssd attached to a VM + // A new or an existing persistent disk (PD) or a local ssd attached to a VM // instance. message AttachedDisk { oneof attached { @@ -280,7 +280,7 @@ message AllocationPolicy { string device_name = 3; } - // Accelerator describes Compute Engine accelerators to be attached to VMs. + // Accelerator describes Compute Engine accelerators to be attached to the VM. message Accelerator { // The accelerator type. For example, "nvidia-tesla-t4". // See `gcloud compute accelerator-types list`. @@ -309,11 +309,10 @@ message AllocationPolicy { ProvisioningModel provisioning_model = 4; // The accelerators attached to each VM instance. - // Not yet implemented. repeated Accelerator accelerators = 5; // Non-boot disks to be attached for each VM created by this InstancePolicy. - // New disks will be deleted when the attached VM is deleted. + // New disks will be deleted when the VM is deleted. repeated AttachedDisk disks = 6; } diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1/volume.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1/volume.proto index 45399ccc6e1..7b6ebac48fb 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1/volume.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1/volume.proto @@ -25,46 +25,50 @@ option objc_class_prefix = "GCB"; option php_namespace = "Google\\Cloud\\Batch\\V1"; option ruby_package = "Google::Cloud::Batch::V1"; -// Volume and mount parameters to be associated with a TaskSpec. A TaskSpec -// might describe zero, one, or multiple volumes to be mounted as part of the -// task. +// Volume describes a volume and parameters for it to be mounted to a VM. message Volume { // The source for the volume. oneof source { - // An NFS source for the volume (could be a Filestore, for example). + // A Network File System (NFS) volume. For example, a + // Filestore file share. NFS nfs = 1; - // A Google Cloud Storage source for the volume. + // A Google Cloud Storage (GCS) volume. GCS gcs = 3; - // Device name of an attached disk + // Device name of an attached disk volume, which should align with a + // device_name specified by + // job.allocation_policy.instances[0].policy.disks[i].device_name or + // defined by the given instance template in + // job.allocation_policy.instances[0].instance_template. string device_name = 6; } - // Mount path for the volume, e.g. /mnt/share + // The mount path for the volume, e.g. /mnt/disks/share. string mount_path = 4; - // Mount options - // For Google Cloud Storage, mount options are the global options supported by - // gcsfuse tool. Batch will use them to mount the volume with the following - // command: - // "gcsfuse [global options] bucket mountpoint". - // For PD, NFS, mount options are these supported by /etc/fstab. Batch will - // use Fstab to mount such volumes. - // https://help.ubuntu.com/community/Fstab + // For Google Cloud Storage (GCS), mount options are the options supported by + // the gcsfuse tool (https://github.com/GoogleCloudPlatform/gcsfuse). + // For existing persistent disks, mount options provided by the + // mount command (https://man7.org/linux/man-pages/man8/mount.8.html) except + // writing are supported. This is due to restrictions of multi-writer mode + // (https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms). + // For other attached disks and Network File System (NFS), mount options are + // these supported by the mount command + // (https://man7.org/linux/man-pages/man8/mount.8.html). repeated string mount_options = 5; } -// Represents an NFS server and remote path: : +// Represents an NFS volume. message NFS { - // URI of the NFS server, e.g. an IP address. + // The IP address of the NFS. string server = 1; - // Remote source path exported from NFS, e.g., "/share". + // Remote source path exported from the NFS, e.g., "/share". string remote_path = 2; } -// Represents a Google Cloud Storage volume source config. +// Represents a Google Cloud Storage volume. message GCS { // Remote path, either a bucket name or a subdirectory of a bucket, e.g.: // bucket_name, bucket_name/subdirectory/ diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/batch.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/batch.proto index 97b3171ca42..cc6dd16a536 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/batch.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/batch.proto @@ -107,8 +107,9 @@ message CreateJobRequest { ]; // ID used to uniquely identify the Job within its parent scope. - // This field should contain at most 63 characters. - // Only alphanumeric characters or '-' are accepted. + // This field should contain at most 63 characters and must start with + // lowercase characters. + // Only lowercase characters, numbers and '-' are accepted. // The '-' character cannot be the first or the last one. // A system generated ID will be used if the field is not set. // diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/job.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/job.proto index dc224aa4328..27d2b538110 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/job.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/job.proto @@ -318,7 +318,7 @@ message AllocationPolicy { string disk_interface = 6; } - // A new or an existing persistent disk or a local ssd attached to a VM + // A new or an existing persistent disk (PD) or a local ssd attached to a VM // instance. message AttachedDisk { oneof attached { @@ -335,7 +335,7 @@ message AllocationPolicy { string device_name = 3; } - // Accelerator describes Compute Engine accelerators to be attached to VMs. + // Accelerator describes Compute Engine accelerators to be attached to the VM. message Accelerator { // The accelerator type. For example, "nvidia-tesla-t4". // See `gcloud compute accelerator-types list`. @@ -367,12 +367,14 @@ message AllocationPolicy { ProvisioningModel provisioning_model = 4; // The accelerators attached to each VM instance. - // Not yet implemented. repeated Accelerator accelerators = 5; // Non-boot disks to be attached for each VM created by this InstancePolicy. - // New disks will be deleted when the attached VM is deleted. + // New disks will be deleted when the VM is deleted. repeated AttachedDisk disks = 6; + + // If specified, VMs will be allocated only inside the matching reservation. + string reservation = 7; } // Either an InstancePolicy or an instance template. @@ -451,7 +453,7 @@ message AllocationPolicy { // Deprecated: please use instances[0].template instead. repeated string instance_templates = 3 [deprecated = true]; - // Deprecated: please use instances[i].policy.provisioning_model instead. + // Deprecated: please use instances[0].policy.provisioning_model instead. repeated ProvisioningModel provisioning_models = 4 [deprecated = true]; // Deprecated: please use service_account instead. diff --git a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/volume.proto b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/volume.proto index b71a62bb8b9..4112d2363a6 100644 --- a/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/volume.proto +++ b/packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/volume.proto @@ -25,49 +25,53 @@ option objc_class_prefix = "GCB"; option php_namespace = "Google\\Cloud\\Batch\\V1alpha"; option ruby_package = "Google::Cloud::Batch::V1alpha"; -// Volume and mount parameters to be associated with a TaskSpec. A TaskSpec -// might describe zero, one, or multiple volumes to be mounted as part of the -// task. +// Volume describes a volume and parameters for it to be mounted to a VM. message Volume { // The source for the volume. oneof source { - // An NFS source for the volume (could be a Filestore, for example). + // A Network File System (NFS) volume. For example, a + // Filestore file share. NFS nfs = 1; - // A persistent disk source for the volume. + // Deprecated: please use device_name instead. PD pd = 2 [deprecated = true]; - // A Google Cloud Storage source for the volume. + // A Google Cloud Storage (GCS) volume. GCS gcs = 3; - // Device name of an attached disk + // Device name of an attached disk volume, which should align with a + // device_name specified by + // job.allocation_policy.instances[0].policy.disks[i].device_name or + // defined by the given instance template in + // job.allocation_policy.instances[0].instance_template. string device_name = 6; } - // Mount path for the volume, e.g. /mnt/share + // The mount path for the volume, e.g. /mnt/disks/share. string mount_path = 4; - // Mount options - // For Google Cloud Storage, mount options are the global options supported by - // gcsfuse tool. Batch will use them to mount the volume with the following - // command: - // "gcsfuse [global options] bucket mountpoint". - // For PD, NFS, mount options are these supported by /etc/fstab. Batch will - // use Fstab to mount such volumes. - // https://help.ubuntu.com/community/Fstab + // For Google Cloud Storage (GCS), mount options are the options supported by + // the gcsfuse tool (https://github.com/GoogleCloudPlatform/gcsfuse). + // For existing persistent disks, mount options provided by the + // mount command (https://man7.org/linux/man-pages/man8/mount.8.html) except + // writing are supported. This is due to restrictions of multi-writer mode + // (https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms). + // For other attached disks and Network File System (NFS), mount options are + // these supported by the mount command + // (https://man7.org/linux/man-pages/man8/mount.8.html). repeated string mount_options = 5; } -// Represents an NFS server and remote path: : +// Represents an NFS volume. message NFS { - // URI of the NFS server, e.g. an IP address. + // The IP address of the NFS. string server = 1; - // Remote source path exported from NFS, e.g., "/share". + // Remote source path exported from the NFS, e.g., "/share". string remote_path = 2; } -// Represents a GCP persistent disk +// Deprecated: please use device_name instead. message PD { // PD disk name, e.g. pd-1. string disk = 1; @@ -82,7 +86,7 @@ message PD { bool existing = 3 [deprecated = true]; } -// Represents a Google Cloud Storage volume source config. +// Represents a Google Cloud Storage volume. message GCS { // Remote path, either a bucket name or a subdirectory of a bucket, e.g.: // bucket_name, bucket_name/subdirectory/ diff --git a/packages/google-cloud-batch/protos/protos.d.ts b/packages/google-cloud-batch/protos/protos.d.ts index 9cad5679648..ea9304fe1db 100644 --- a/packages/google-cloud-batch/protos/protos.d.ts +++ b/packages/google-cloud-batch/protos/protos.d.ts @@ -7790,6 +7790,9 @@ export namespace google { /** InstancePolicy disks */ disks?: (google.cloud.batch.v1alpha.AllocationPolicy.IAttachedDisk[]|null); + + /** InstancePolicy reservation */ + reservation?: (string|null); } /** Represents an InstancePolicy. */ @@ -7819,6 +7822,9 @@ export namespace google { /** InstancePolicy disks. */ public disks: google.cloud.batch.v1alpha.AllocationPolicy.IAttachedDisk[]; + /** InstancePolicy reservation. */ + public reservation: string; + /** * Creates a new InstancePolicy instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-batch/protos/protos.js b/packages/google-cloud-batch/protos/protos.js index d4e217e945a..b87066cf74a 100644 --- a/packages/google-cloud-batch/protos/protos.js +++ b/packages/google-cloud-batch/protos/protos.js @@ -20144,6 +20144,7 @@ * @property {google.cloud.batch.v1alpha.AllocationPolicy.ProvisioningModel|null} [provisioningModel] InstancePolicy provisioningModel * @property {Array.|null} [accelerators] InstancePolicy accelerators * @property {Array.|null} [disks] InstancePolicy disks + * @property {string|null} [reservation] InstancePolicy reservation */ /** @@ -20212,6 +20213,14 @@ */ InstancePolicy.prototype.disks = $util.emptyArray; + /** + * InstancePolicy reservation. + * @member {string} reservation + * @memberof google.cloud.batch.v1alpha.AllocationPolicy.InstancePolicy + * @instance + */ + InstancePolicy.prototype.reservation = ""; + /** * Creates a new InstancePolicy instance using the specified properties. * @function create @@ -20251,6 +20260,8 @@ if (message.disks != null && message.disks.length) for (var i = 0; i < message.disks.length; ++i) $root.google.cloud.batch.v1alpha.AllocationPolicy.AttachedDisk.encode(message.disks[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.reservation != null && Object.hasOwnProperty.call(message, "reservation")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.reservation); return writer; }; @@ -20315,6 +20326,10 @@ message.disks.push($root.google.cloud.batch.v1alpha.AllocationPolicy.AttachedDisk.decode(reader, reader.uint32())); break; } + case 7: { + message.reservation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -20391,6 +20406,9 @@ return "disks." + error; } } + if (message.reservation != null && message.hasOwnProperty("reservation")) + if (!$util.isString(message.reservation)) + return "reservation: string expected"; return null; }; @@ -20461,6 +20479,8 @@ message.disks[i] = $root.google.cloud.batch.v1alpha.AllocationPolicy.AttachedDisk.fromObject(object.disks[i]); } } + if (object.reservation != null) + message.reservation = String(object.reservation); return message; }; @@ -20486,6 +20506,7 @@ object.machineType = ""; object.minCpuPlatform = ""; object.provisioningModel = options.enums === String ? "PROVISIONING_MODEL_UNSPECIFIED" : 0; + object.reservation = ""; } if (message.allowedMachineTypes && message.allowedMachineTypes.length) { object.allowedMachineTypes = []; @@ -20508,6 +20529,8 @@ for (var j = 0; j < message.disks.length; ++j) object.disks[j] = $root.google.cloud.batch.v1alpha.AllocationPolicy.AttachedDisk.toObject(message.disks[j], options); } + if (message.reservation != null && message.hasOwnProperty("reservation")) + object.reservation = message.reservation; return object; }; diff --git a/packages/google-cloud-batch/protos/protos.json b/packages/google-cloud-batch/protos/protos.json index 27e3c3e470e..b202b6c8c7a 100644 --- a/packages/google-cloud-batch/protos/protos.json +++ b/packages/google-cloud-batch/protos/protos.json @@ -1897,6 +1897,10 @@ "rule": "repeated", "type": "AttachedDisk", "id": 6 + }, + "reservation": { + "type": "string", + "id": 7 } } }, diff --git a/packages/google-cloud-batch/samples/generated/v1/batch_service.create_job.js b/packages/google-cloud-batch/samples/generated/v1/batch_service.create_job.js index 18a14e9840f..92cc56148bd 100644 --- a/packages/google-cloud-batch/samples/generated/v1/batch_service.create_job.js +++ b/packages/google-cloud-batch/samples/generated/v1/batch_service.create_job.js @@ -35,8 +35,9 @@ function main(parent, job) { // const parent = 'abc123' /** * ID used to uniquely identify the Job within its parent scope. - * This field should contain at most 63 characters. - * Only alphanumeric characters or '-' are accepted. + * This field should contain at most 63 characters and must start with + * lowercase characters. + * Only lowercase characters, numbers and '-' are accepted. * The '-' character cannot be the first or the last one. * A system generated ID will be used if the field is not set. * The job.name field in the request will be ignored and the created resource diff --git a/packages/google-cloud-batch/samples/generated/v1/snippet_metadata.google.cloud.batch.v1.json b/packages/google-cloud-batch/samples/generated/v1/snippet_metadata.google.cloud.batch.v1.json index 5cc98a27927..b0145dc7df3 100644 --- a/packages/google-cloud-batch/samples/generated/v1/snippet_metadata.google.cloud.batch.v1.json +++ b/packages/google-cloud-batch/samples/generated/v1/snippet_metadata.google.cloud.batch.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 83, + "end": 84, "type": "FULL" } ], diff --git a/packages/google-cloud-batch/samples/generated/v1alpha/batch_service.create_job.js b/packages/google-cloud-batch/samples/generated/v1alpha/batch_service.create_job.js index 067dc8ad458..8207e50d060 100644 --- a/packages/google-cloud-batch/samples/generated/v1alpha/batch_service.create_job.js +++ b/packages/google-cloud-batch/samples/generated/v1alpha/batch_service.create_job.js @@ -35,8 +35,9 @@ function main(parent, job) { // const parent = 'abc123' /** * ID used to uniquely identify the Job within its parent scope. - * This field should contain at most 63 characters. - * Only alphanumeric characters or '-' are accepted. + * This field should contain at most 63 characters and must start with + * lowercase characters. + * Only lowercase characters, numbers and '-' are accepted. * The '-' character cannot be the first or the last one. * A system generated ID will be used if the field is not set. * The job.name field in the request will be ignored and the created resource diff --git a/packages/google-cloud-batch/samples/generated/v1alpha/snippet_metadata.google.cloud.batch.v1alpha.json b/packages/google-cloud-batch/samples/generated/v1alpha/snippet_metadata.google.cloud.batch.v1alpha.json index e08a69a62d9..194150b18bb 100644 --- a/packages/google-cloud-batch/samples/generated/v1alpha/snippet_metadata.google.cloud.batch.v1alpha.json +++ b/packages/google-cloud-batch/samples/generated/v1alpha/snippet_metadata.google.cloud.batch.v1alpha.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 83, + "end": 84, "type": "FULL" } ], diff --git a/packages/google-cloud-batch/src/v1/batch_service_client.ts b/packages/google-cloud-batch/src/v1/batch_service_client.ts index 6719d99cbaf..4995bca520d 100644 --- a/packages/google-cloud-batch/src/v1/batch_service_client.ts +++ b/packages/google-cloud-batch/src/v1/batch_service_client.ts @@ -471,8 +471,9 @@ export class BatchServiceClient { * Pattern: "projects/{project}/locations/{location}" * @param {string} request.jobId * ID used to uniquely identify the Job within its parent scope. - * This field should contain at most 63 characters. - * Only alphanumeric characters or '-' are accepted. + * This field should contain at most 63 characters and must start with + * lowercase characters. + * Only lowercase characters, numbers and '-' are accepted. * The '-' character cannot be the first or the last one. * A system generated ID will be used if the field is not set. * diff --git a/packages/google-cloud-batch/src/v1alpha/batch_service_client.ts b/packages/google-cloud-batch/src/v1alpha/batch_service_client.ts index 09340a18772..099eb126a43 100644 --- a/packages/google-cloud-batch/src/v1alpha/batch_service_client.ts +++ b/packages/google-cloud-batch/src/v1alpha/batch_service_client.ts @@ -475,8 +475,9 @@ export class BatchServiceClient { * Pattern: "projects/{project}/locations/{location}" * @param {string} request.jobId * ID used to uniquely identify the Job within its parent scope. - * This field should contain at most 63 characters. - * Only alphanumeric characters or '-' are accepted. + * This field should contain at most 63 characters and must start with + * lowercase characters. + * Only lowercase characters, numbers and '-' are accepted. * The '-' character cannot be the first or the last one. * A system generated ID will be used if the field is not set. *