Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis MRR Support #5449

Merged
merged 7 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions mmv1/products/redis/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,56 @@ objects:
output: true
description: |
Sha1 Fingerprint of the certificate.
- !ruby/object:Api::Type::Integer
name: replicaCount
description: |
Optional. The number of replica nodes. Valid range for standard tier is [1-5]
and defaults to 2. Valid value for basic tier is 0 and defaults to 0.
min_version: beta
- !ruby/object:Api::Type::Array
name: nodes
description: |
Info per node
output: true
min_version: beta
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'id'
output: true
description: |
Node identifying string. e.g. 'node-0', 'node-1'
- !ruby/object:Api::Type::String
name: 'zone'
output: true
description: |
Location of the node.
- !ruby/object:Api::Type::String
name: readEndpoint
description: |
Hostname or IP address of the exposed readonly Redis endpoint. Standard tier only.
Targets all healthy replica nodes in instance. Replication is asynchronous and replica
nodes will exhibit some lag behind the primary. Write requests must target 'host'.
output: true
min_version: beta
- !ruby/object:Api::Type::Integer
name: readEndpointPort
description: |
The port number of the exposed readonly redis endpoint. Standard tier only.
Write requests should target 'port'.
output: true
min_version: beta
- !ruby/object:Api::Type::Enum
name: readReplicasMode
description: |
Optional. Read replica mode.
If not set, Memorystore Redis backend will pick the mode based on other fields in the request.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks from the docs like the default is always READ_REPLICAS_DISABLED - is that not the case?

https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#readreplicasmode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the description.

- READ_REPLICAS_DISABLED: If disabled, read endpoint will not be provided and the
instance cannot scale up or down the number of replicas.
- READ_REPLICAS_ENABLED: If enabled, read endpoint will be provided and the instance
can scale up and down the number of replicas.
values:
- :READ_REPLICAS_DISABLED
- :READ_REPLICAS_ENABLED
default_value: :READ_REPLICAS_DISABLED
min_version: beta
9 changes: 9 additions & 0 deletions mmv1/products/redis/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ overrides: !ruby/object:Overrides::ResourceOverrides
network_name: "redis-test-network"
test_vars_overrides:
network_name: 'BootstrapSharedTestNetwork(t, "redis-private")'
- !ruby/object:Provider::Terraform::Examples
name: "redis_instance_mrr"
primary_resource_id: "cache"
vars:
instance_name: "mrr-memory-cache"
network_name: "redis-test-network"
test_vars_overrides:
network_name: 'BootstrapSharedTestNetwork(t, "redis-mrr")'
min_version: beta
properties:
alternativeLocationId: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
Expand Down
34 changes: 34 additions & 0 deletions mmv1/templates/terraform/examples/redis_instance_mrr.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
name = "<%= ctx[:vars]['instance_name'] %>"
tier = "STANDARD_HA"
memory_size_gb = 5

location_id = "us-central1-a"
alternative_location_id = "us-central1-f"

authorized_network = data.google_compute_network.redis-network.id

redis_version = "REDIS_6_X"
display_name = "Terraform Test Instance"
reserved_ip_range = "192.168.0.0/29"
replica_count = 5
read_replicas_mode = "READ_REPLICAS_ENABLED"

labels = {
my_key = "my_val"
other_key = "other_val"
}
}

// This example assumes this network already exists.
// The API creates a tenant network per network authorized for a
// Redis instance and that network is not deleted when the user-created
// network (authorized_network) is deleted, so this prevents issues
// with tenant network quota.
// If this network hasn't been created and you are using this example in your
// config, add an additional network resource or change
// this from "data"to "resource"
data "google_compute_network" "redis-network" {
name = "<%= ctx[:vars]['network_name'] %>"
}