Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit ea43df2

Browse files
gcf-owl-bot[bot]Takashi Matsuo
andauthored
feat: [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance (#526)
* feat: [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance PiperOrigin-RevId: 408360267 Source-Link: googleapis/googleapis@8625cf0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d84247808680a19dec0d3f3b52a28e2d3050beaf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDg0MjQ3ODA4NjgwYTE5ZGVjMGQzZjNiNTJhMjhlMmQzMDUwYmVhZiJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: change node version for sample Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
1 parent 386f4c5 commit ea43df2

25 files changed

Lines changed: 1768 additions & 30 deletions

protos/google/cloud/redis/v1/cloud_redis.proto

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -165,7 +165,7 @@ service CloudRedis {
165165
};
166166
}
167167

168-
// Initiates a failover of the master node to current replica node for a
168+
// Initiates a failover of the primary node to current replica node for a
169169
// specific STANDARD tier Cloud Memorystore for Redis instance.
170170
rpc FailoverInstance(FailoverInstanceRequest) returns (google.longrunning.Operation) {
171171
option (google.api.http) = {
@@ -193,6 +193,15 @@ service CloudRedis {
193193
}
194194
}
195195

196+
// Node specific properties.
197+
message NodeInfo {
198+
// Output only. Node identifying string. e.g. 'node-0', 'node-1'
199+
string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
200+
201+
// Output only. Location of the node.
202+
string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
203+
}
204+
196205
// A Google Cloud Redis instance.
197206
message Instance {
198207
option (google.api.resource) = {
@@ -258,6 +267,21 @@ message Instance {
258267
PRIVATE_SERVICE_ACCESS = 2;
259268
}
260269

270+
// Read replicas mode.
271+
enum ReadReplicasMode {
272+
// If not set, Memorystore Redis backend will pick the mode based on other fields in
273+
// the request.
274+
READ_REPLICAS_MODE_UNSPECIFIED = 0;
275+
276+
// If disabled, read endpoint will not be provided and the instance cannot
277+
// scale up or down the number of replicas.
278+
READ_REPLICAS_DISABLED = 1;
279+
280+
// If enabled, read endpoint will be provided and the instance can scale
281+
// up and down the number of replicas.
282+
READ_REPLICAS_ENABLED = 2;
283+
}
284+
261285
// Required. Unique name of the resource in this scope including project and
262286
// location using the form:
263287
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
@@ -276,15 +300,17 @@ message Instance {
276300
map<string, string> labels = 3;
277301

278302
// Optional. The zone where the instance will be provisioned. If not provided,
279-
// the service will choose a zone for the instance. For STANDARD_HA tier,
280-
// instances will be created across two zones for protection against zonal
281-
// failures. If [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id] is also provided, it must be
282-
// different from [location_id][google.cloud.redis.v1.Instance.location_id].
303+
// the service will choose a zone from the specified region for the instance.
304+
// For standard tier, additional nodes will be added across multiple zones for
305+
// protection against zonal failures. If specified, at least one node will be
306+
// provisioned in this zone.
283307
string location_id = 4 [(google.api.field_behavior) = OPTIONAL];
284308

285-
// Optional. Only applicable to STANDARD_HA tier which protects the instance
286-
// against zonal failures by provisioning it across two zones. If provided, it
287-
// must be a different zone from the one provided in [location_id][google.cloud.redis.v1.Instance.location_id].
309+
// Optional. If specified, at least one node will be provisioned in this zone
310+
// in addition to the zone specified in location_id. Only applicable to
311+
// standard tier. If provided, it must be a different zone from the one
312+
// provided in [location_id]. Additional nodes beyond the first 2 will be
313+
// placed in zones selected by the service.
288314
string alternative_location_id = 5 [(google.api.field_behavior) = OPTIONAL];
289315

290316
// Optional. The version of Redis software.
@@ -294,12 +320,17 @@ message Instance {
294320
// * `REDIS_3_2` for Redis 3.2 compatibility
295321
// * `REDIS_4_0` for Redis 4.0 compatibility (default)
296322
// * `REDIS_5_0` for Redis 5.0 compatibility
323+
// * `REDIS_6_X` for Redis 6.x compatibility
297324
string redis_version = 7 [(google.api.field_behavior) = OPTIONAL];
298325

299-
// Optional. The CIDR range of internal addresses that are reserved for this
300-
// instance. If not provided, the service will choose an unused /29 block,
301-
// for example, 10.0.0.0/29 or 192.168.0.0/29. Ranges must be unique
302-
// and non-overlapping with existing subnets in an authorized network.
326+
// Optional. For DIRECT_PEERING mode, the CIDR range of internal addresses
327+
// that are reserved for this instance. Range must
328+
// be unique and non-overlapping with existing subnets in an authorized
329+
// network. For PRIVATE_SERVICE_ACCESS mode, the name of one allocated IP
330+
// address ranges associated with this private service access connection.
331+
// If not provided, the service will choose an unused /29 block, for
332+
// example, 10.0.0.0/29 or 192.168.0.0/29. For READ_REPLICAS_ENABLED
333+
// the default block size is /28.
303334
string reserved_ip_range = 9 [(google.api.field_behavior) = OPTIONAL];
304335

305336
// Output only. Hostname or IP address of the exposed Redis endpoint used by
@@ -309,11 +340,9 @@ message Instance {
309340
// Output only. The port number of the exposed Redis endpoint.
310341
int32 port = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
311342

312-
// Output only. The current zone where the Redis endpoint is placed. For Basic
313-
// Tier instances, this will always be the same as the [location_id][google.cloud.redis.v1.Instance.location_id]
314-
// provided by the user at creation time. For Standard Tier instances,
315-
// this can be either [location_id][google.cloud.redis.v1.Instance.location_id] or [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id] and can
316-
// change after a failover event.
343+
// Output only. The current zone where the Redis primary node is located. In
344+
// basic tier, this will always be the same as [location_id]. In
345+
// standard tier, this can be the zone of any node in the instance.
317346
string current_location_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
318347

319348
// Output only. The time the instance was created.
@@ -370,6 +399,27 @@ message Instance {
370399
// Optional. The network connect mode of the Redis instance.
371400
// If not provided, the connect mode defaults to DIRECT_PEERING.
372401
ConnectMode connect_mode = 22 [(google.api.field_behavior) = OPTIONAL];
402+
403+
// Optional. The number of replica nodes. Valid range for standard tier
404+
// is [1-5] and defaults to 1. Valid value for basic tier is 0 and defaults
405+
// to 0.
406+
int32 replica_count = 31 [(google.api.field_behavior) = OPTIONAL];
407+
408+
// Output only. Info per node.
409+
repeated NodeInfo nodes = 32 [(google.api.field_behavior) = OUTPUT_ONLY];
410+
411+
// Output only. Hostname or IP address of the exposed readonly Redis
412+
// endpoint. Standard tier only. Targets all healthy replica nodes in
413+
// instance. Replication is asynchronous and replica nodes will exhibit some
414+
// lag behind the primary. Write requests must target 'host'.
415+
string read_endpoint = 33 [(google.api.field_behavior) = OUTPUT_ONLY];
416+
417+
// Output only. The port number of the exposed readonly redis
418+
// endpoint. Standard tier only. Write requests should target 'port'.
419+
int32 read_endpoint_port = 34 [(google.api.field_behavior) = OUTPUT_ONLY];
420+
421+
// Optional. Read replica mode.
422+
ReadReplicasMode read_replicas_mode = 35 [(google.api.field_behavior) = OPTIONAL];
373423
}
374424

375425
// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
@@ -405,11 +455,12 @@ message ListInstancesResponse {
405455
//
406456
// If the `location_id` in the parent field of the request is "-", all regions
407457
// available to the project are queried, and the results aggregated.
408-
// If in such an aggregated query a location is unavailable, a dummy Redis
409-
// entry is included in the response with the `name` field set to a value of
410-
// the form `projects/{project_id}/locations/{location_id}/instances/`- and
411-
// the `status` field set to ERROR and `status_message` field set to "location
412-
// not available for ListInstances".
458+
// If in such an aggregated query a location is unavailable, a placeholder
459+
// Redis entry is included in the response with the `name` field set to a
460+
// value of the form
461+
// `projects/{project_id}/locations/{location_id}/instances/`- and the
462+
// `status` field set to ERROR and `status_message` field set to "location not
463+
// available for ListInstances".
413464
repeated Instance instances = 1;
414465

415466
// Token to retrieve the next page of results, or empty if there are no more
@@ -469,6 +520,7 @@ message UpdateInstanceRequest {
469520
// * `labels`
470521
// * `memorySizeGb`
471522
// * `redisConfig`
523+
// * `replica_count`
472524
google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED];
473525

474526
// Required. Update description.
@@ -568,7 +620,7 @@ message FailoverInstanceRequest {
568620

569621
// Instance failover will be protected with data loss control. More
570622
// specifically, the failover will only be performed if the current
571-
// replication offset diff between master and replica is under a certain
623+
// replication offset diff between primary and replica is under a certain
572624
// threshold.
573625
LIMITED_DATA_LOSS = 1;
574626

protos/protos.d.ts

Lines changed: 133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)