Skip to content

Commit

Permalink
add readerEndpoint to replicationGroup AtProvider
Browse files Browse the repository at this point in the history
Signed-off-by: David Adelowo <[email protected]>
  • Loading branch information
amotolani committed Jul 12, 2024
1 parent d17c9da commit 84f1b88
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
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

0 comments on commit 84f1b88

Please sign in to comment.