Skip to content

Commit d67dcdc

Browse files
authored
fix: use dynamic ports from CometConfig in service builder (#500)
* fix: use dynamic ports from CometConfig in service builder - Change service p2p port to use crd.Spec.ChainSpec.Comet.P2PPort() - Change service rpc port to use crd.Spec.ChainSpec.Comet.RPCPort() - This fixes port mismatches when users configure custom rpcListenAddress or p2pListenAddress - Services now use the same dynamic port logic as container ports * test: update service builder tests to use dynamic ports - Replace hardcoded 26656 with crd.Spec.ChainSpec.Comet.P2PPort() - Replace hardcoded 26657 with crd.Spec.ChainSpec.Comet.RPCPort()
1 parent fe3fff5 commit d67dcdc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/fullnode/service_builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func BuildServices(crd *cosmosv1.CosmosFullNode) []diff.Resource[*corev1.Service
5858
{
5959
Name: "p2p",
6060
Protocol: corev1.ProtocolTCP,
61-
Port: p2pPort,
61+
Port: crd.Spec.ChainSpec.Comet.P2PPort(),
6262
TargetPort: intstr.FromString("p2p"),
6363
},
6464
}
@@ -148,7 +148,7 @@ func rpcService(crd *cosmosv1.CosmosFullNode) *corev1.Service {
148148
{
149149
Name: "rpc",
150150
Protocol: corev1.ProtocolTCP,
151-
Port: rpcPort,
151+
Port: crd.Spec.ChainSpec.Comet.RPCPort(),
152152
TargetPort: intstr.FromString("rpc"),
153153
},
154154
{

internal/fullnode/service_builder_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestBuildServices(t *testing.T) {
5151
{
5252
Name: "p2p",
5353
Protocol: corev1.ProtocolTCP,
54-
Port: 26656,
54+
Port: crd.Spec.ChainSpec.Comet.P2PPort(),
5555
TargetPort: intstr.FromString("p2p"),
5656
},
5757
},
@@ -92,7 +92,7 @@ func TestBuildServices(t *testing.T) {
9292
{
9393
Name: "p2p",
9494
Protocol: corev1.ProtocolTCP,
95-
Port: 26656,
95+
Port: crd.Spec.ChainSpec.Comet.P2PPort(),
9696
TargetPort: intstr.FromString("p2p"),
9797
},
9898
},
@@ -192,7 +192,7 @@ func TestBuildServices(t *testing.T) {
192192
{
193193
Name: "p2p",
194194
Protocol: corev1.ProtocolTCP,
195-
Port: 26656,
195+
Port: crd.Spec.ChainSpec.Comet.P2PPort(),
196196
TargetPort: intstr.FromString("p2p"),
197197
},
198198
},
@@ -310,7 +310,7 @@ func TestBuildServices(t *testing.T) {
310310
{
311311
Name: "rpc",
312312
Protocol: corev1.ProtocolTCP,
313-
Port: 26657,
313+
Port: crd.Spec.ChainSpec.Comet.RPCPort(),
314314
TargetPort: intstr.FromString("rpc"),
315315
},
316316
{

0 commit comments

Comments
 (0)