Skip to content

Conversation

alexandref75
Copy link

@alexandref75 alexandref75 commented Aug 28, 2025

It is a little simpler than adding a config file.
It adds command line options, allowing changing network configuration.
The defaults are the original values.

Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
Copy link
Contributor

openshift-ci bot commented Aug 28, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alexandref75
Once this PR has been reviewed and has the lgtm label, please assign lstocchi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cfergeau
Copy link
Collaborator

cfergeau commented Sep 12, 2025

It is a little simpler than adding a config file. It adds command line options, allowing changing network configuration. The defaults are the original values.

I’ve finally moved forward with #484 which allows to set network/IP/… using a config file. I’m not opposed to also adding command line options to configure this, but ideally this would be partially automated (--subnetIP 10.0.0.0/8 would automatically set host IP/gateway IP and device IP to valid default values). --subnetIP could be named --subnet or --subnetCIDR

There is code which can help with this in

// Parse subnet address for further use
naddr, err := netip.ParsePrefix(config.Stack.Subnet)
if err != nil {
return config, fmt.Errorf("failed to parse subnet: %w", err)
}
fuaddr, err := getFirstUsableIPFromSubnet(naddr)
if err != nil {
return config, fmt.Errorf("failed to identify first usable address in subnet: %w", err)
}
luaddr, err := getLastUsableIPFromSubnet(naddr)
if err != nil {
return config, fmt.Errorf("failed to identify last usable address in subnet: %w", err)
}
, or some alternative API is used here
func linkLocal() *tcpip.Subnet {
_, parsedSubnet, _ := net.ParseCIDR(linkLocalSubnet) // CoreOS VM tries to connect to Amazon EC2 metadata service
subnet, _ := tcpip.NewSubnet(tcpip.AddrFromSlice(parsedSubnet.IP), tcpip.MaskFromBytes(parsedSubnet.Mask))
return &subnet
}

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.

2 participants