Skip to content

feat: add extraPortMappings support to ClusterSpec - #16

Open
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:feat/extra-port-mappings-v2
Open

feat: add extraPortMappings support to ClusterSpec#16
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:feat/extra-port-mappings-v2

Conversation

@Ladas

@Ladas Ladas commented Aug 31, 2026

Copy link
Copy Markdown

Closes #17

Summary

Test plan

  • Integration test with tests/fixtures/port-mappings.yaml
  • Validates non-zero ports and duplicate host ports
  • KIND config correctly generates extraPortMappings on first control-plane node
  • cargo test + cargo clippy clean (451 tests)

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review

Summary: Clean feature addition -- CreateClusterConfig struct is a good refactor, port generation is correct (first CP node only), validation catches zero ports and duplicates, test coverage is solid. One validation gap where cluster port bindAddress isn't checked.

Severity Count
Critical 0
Large 0
Medium 1

Comment thread src/config/validate.rs
)));
}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Medium] check_cluster_ports validates non-zero ports and unique host ports but does not validate bind_address as a valid IP when present. Service ports already do this via check_port_bind_address (line 275). Without it, a cluster port mapping with bindAddress: "not-an-ip" passes validation and produces a malformed KIND config that fails opaquely at kind create cluster time.

Add a bind_address check inside the port loop:

if let Some(addr) = &pm.bind_address {
    if addr.parse::<std::net::IpAddr>().is_err() {
        return Err(ForgeError::Validation(format!(
            "cluster {:?}: port mapping bind address {:?} is not a valid IP",
            cluster.name, addr,
        )));
    }
}

Expose KIND extraPortMappings in the forge config schema via a new
ports field on ClusterSpec. Enables mapping host ports to container
NodePorts for accessing services (Grafana, Prometheus, MLflow) from
the host machine.

Includes config validation, KIND config generation, and integration
test with a port-mappings fixture.

Signed-off-by: Ladislav Smola <lsmola@redhat.com>
@Ladas
Ladas force-pushed the feat/extra-port-mappings-v2 branch from f92470b to 326515b Compare September 1, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose KIND NodePorts to the host via extraPortMappings

2 participants