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

feat(replicationGroup): Add readerEndpoint to status #2077

Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions apis/cache/v1beta1/replication_group_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ type NodeGroup struct {
// node group (shard).
PrimaryEndpoint Endpoint `json:"primaryEndpoint,omitempty"`

// ReaderEndpoint is the endpoint of the replica nodes in this node group (shard).
ReaderEndpoint Endpoint `json:"readerEndpoint,omitempty"`

// Slots is the keyspace for this node group (shard).
Slots string `json:"slots,omitempty"`

Expand Down
1 change: 1 addition & 0 deletions apis/cache/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions package/crds/cache.aws.crossplane.io_replicationgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,19 @@ spec:
on.
type: integer
type: object
readerEndpoint:
description: ReaderEndpoint is the endpoint of the replica
nodes in this node group (shard).
properties:
address:
description: Address is the DNS hostname of the cache
node.
type: string
port:
description: Port number that the cache engine is listening
on.
type: integer
type: object
slots:
description: Slots is the keyspace for this node group (shard).
type: string
Expand Down
12 changes: 12 additions & 0 deletions pkg/clients/elasticache/elasticache.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,18 @@ func generateNodeGroup(ng elasticachetypes.NodeGroup) v1beta1.NodeGroup {
Slots: pointer.StringValue(ng.Slots),
Status: pointer.StringValue(ng.Status),
}
if ng.ReaderEndpoint != nil {
r.ReaderEndpoint = v1beta1.Endpoint{
Address: pointer.StringValue(ng.ReaderEndpoint.Address),
Port: int(ng.ReaderEndpoint.Port),
}
}
if ng.PrimaryEndpoint != nil {
r.PrimaryEndpoint = v1beta1.Endpoint{
Address: pointer.StringValue(ng.PrimaryEndpoint.Address),
Port: int(ng.PrimaryEndpoint.Port),
}
}
if len(ng.NodeGroupMembers) != 0 {
r.NodeGroupMembers = make([]v1beta1.NodeGroupMember, len(ng.NodeGroupMembers))
for i, m := range ng.NodeGroupMembers {
Expand Down
4 changes: 4 additions & 0 deletions pkg/clients/elasticache/elasticache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ func TestGenerateObservation(t *testing.T) {
Address: pointer.ToOrNilIfZeroValue("random-12"),
Port: 124,
},
ReaderEndpoint: &elasticachetypes.Endpoint{
Address: pointer.ToOrNilIfZeroValue("random-12-ro"),
Port: 124,
},
NodeGroupMembers: []elasticachetypes.NodeGroupMember{
{
CacheClusterId: pointer.ToOrNilIfZeroValue("my-cache-cluster"),
Expand Down
Loading