RHsyseng / openshift-checks

A collection of scripts to check the health of an OpenShift cluster
53 stars 44 forks source link

Adding clarification about the Node subnet #109

Closed ptrnull closed 1 year ago

ptrnull commented 1 year ago

The actual calculations for the node subnet are based in /24 networks. The logic remains the same for /23 networks since mp0 IP will always be "gatewayIP of the range which is for example 10.131.0.1 + increment that by one" which is 10.131.0.2. Adding some comments in the README and the code to clarify that.

The Golang logic that OVNK uses is:

// GetNodeGatewayIfAddr returns the node logical switch gateway address
// (the ".1" address)
func GetNodeGatewayIfAddr(subnet *net.IPNet) *net.IPNet {
    return &net.IPNet{IP: NextIP(subnet.IP), Mask: subnet.Mask}
}

// GetNodeManagementIfAddr returns the node logical switch management port address
// (the ".2" address)
func GetNodeManagementIfAddr(subnet *net.IPNet) *net.IPNet {
    gwIfAddr := GetNodeGatewayIfAddr(subnet)
    return &net.IPNet{IP: NextIP(gwIfAddr.IP), Mask: subnet.Mask}
}