Skip to content
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
1 change: 1 addition & 0 deletions framework/.changeset/v0.14.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Expose P2P only in K8s
15 changes: 5 additions & 10 deletions framework/components/clnode/clnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,15 @@ func generateEntryPoint() []string {

// natPortsToK8sFormat transforms nat.PortMap
// to Pods port pair format: $external_port:$internal_port
func natPortsToK8sFormat(nat nat.PortMap) []string {
func natPortsToK8sFormat(in *Input, nat nat.PortMap) []string {
out := make([]string, 0)
for port, portBinding := range nat {
for _, b := range portBinding {
out = append(out, fmt.Sprintf("%s:%s", b.HostPort, strconv.Itoa(port.Int())))
}
}
// we are exposing P2P port in K8s via service
out = append(out, fmt.Sprintf("%d:%s", in.Node.P2PPort, DefaultP2PPort))
return out
}

Expand All @@ -200,21 +202,14 @@ func natPortsToK8sFormat(nat nat.PortMap) []string {
// exposes custom_ports in format "host:docker" or map 1-to-1 if only "host" port is provided
func generatePortBindings(in *Input) ([]string, nat.PortMap, error) {
httpPort := fmt.Sprintf("%s/tcp", DefaultHTTPPort)
p2pPort := fmt.Sprintf("%s/udp", DefaultP2PPort)
exposedPorts := []string{httpPort, p2pPort}
exposedPorts := []string{httpPort}
portBindings := nat.PortMap{
nat.Port(httpPort): []nat.PortBinding{
{
HostIP: "0.0.0.0",
HostPort: strconv.Itoa(in.Node.HTTPPort),
},
},
nat.Port(p2pPort): []nat.PortBinding{
{
HostIP: "0.0.0.0",
HostPort: strconv.Itoa(in.Node.P2PPort),
},
},
}
if os.Getenv("CTF_CLNODE_DLV") == "true" {
innerDebuggerPort := fmt.Sprintf("%d/tcp", DefaultDebuggerPort)
Expand Down Expand Up @@ -328,7 +323,7 @@ func newNode(ctx context.Context, in *Input, pgOut *postgres.Output) (*NodeOut,
Env: pods.EnvsFromMap(in.Node.EnvVars),
Requests: pods.ResourcesMedium(),
Limits: pods.ResourcesMedium(),
Ports: natPortsToK8sFormat(portBindings),
Ports: natPortsToK8sFormat(in, portBindings),
ContainerSecurityContext: &v1.SecurityContext{
// these are specific things we need for staging cluster
RunAsNonRoot: pods.Ptr(true),
Expand Down
2 changes: 1 addition & 1 deletion framework/examples/myproject/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/go-resty/resty/v2 v2.16.5
github.com/jhump/protoreflect v1.17.0
github.com/smartcontractkit/chainlink-testing-framework/framework v0.12.6
github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake v0.0.0-20250707095700-c7855f06ddd1
github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake v0.14.1-0.20260213164828-895e6febd040
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.10
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.51.2
github.com/smartcontractkit/chainlink/v2 v2.20.0
Expand Down
4 changes: 2 additions & 2 deletions framework/tmpl_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type TestCfg struct {
NodeSets []*ns.Input `toml:"nodesets" validate:"required"`
}

// TestSmokeGenerateDevEnv top-down approach tests until all the environment variations aren't stable
func TestSmokeGenerateDevEnv(t *testing.T) {
// TestGenerateDevEnv top-down approach tests until all the environment variations aren't stable
func TestGenerateDevEnv(t *testing.T) {
tests := []struct {
name string
cliName string
Expand Down
Loading