Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMTRIAGE-7093 #406

Merged
merged 6 commits into from
Jul 11, 2024
Merged

CASMTRIAGE-7093 #406

merged 6 commits into from
Jul 11, 2024

Conversation

rustydb
Copy link
Contributor

@rustydb rustydb commented Jul 10, 2024

Summary and Scope

Issue Type

  • Bugfix Pull Request
  • RFE Pull Request

The main purpose of this PR is resolving the ifcfg file generation for CASMTRIAGE-7093.

Several other updates were factored in that allow CSI to have parity with the BASH scripts in Cray-HPE/metal-init#80

Extras:

  • Pretty-print data.json every time, before it was only pretty-printed after csi patch ca was invoked.
  • New "parent device" and "interface name" attributes for networking.IPV4Network, networking.IPV4Subnet, and initialize.NCNNetwork structs
  • New initialize.NCNNetwork.Gateway value
  • Reusable templates for DNSMasq subnets
  • Speed/optimization of basecamp data.json generation

Prerequisites

  • I have included documentation in my PR (or it is not required)
  • I tested this on internal system (if yes, please include results or a description of the test)
  • I tested this on a vshasta system (if yes, please include results or a description of the test)

Idempotency

Risks and Mitigations

@rustydb
Copy link
Contributor Author

rustydb commented Jul 10, 2024

This is rebased on #405, marking as a draft until #405 merges.

@rustydb rustydb requested a review from spillerc-hpe July 10, 2024 16:40
@rustydb rustydb marked this pull request as ready for review July 10, 2024 17:45
@rustydb rustydb requested a review from a team as a code owner July 10, 2024 17:45
@rustydb rustydb requested a review from jpdavis-prof July 10, 2024 17:45
rustydb added 6 commits July 10, 2024 15:23
Since wicked-0.6.76 bond0 apparently needs to start with `auto` to ensure it's up when child devices are upped.
I am tired of needing to press a hot-key to format generated `data.json` files. Just format it to begin with.
The JSON is formatted anyway after we run `csi patch ca` on a live system.
This adds the ability to define a "parent device" to `networking.IPV4Network`, `networking.IPV4Subnet`, and `initialize.NCNNetwork` structs. Allowing one to define which network interface owns the given network.

`networking.IPV4Subnet` has a new polymorphic function for generating an interface name (`GenInterfaceName()`). When working with a network type, such as a VLAN, where an underlying Ethernet device is required, the `networking.IPV4Subnet.InterfaceName` will contain the subnet's resulting interface. E.g. `IPV4Subnet{ParentInterface: bond0, NetName: FOO}` would return `IPV4Subnet.InterfaceName="bond0.foo0"`.

`sls.GenDefaultHMN` and `sls.GenDefaultNMN` were removed, now their returned defaults are stored in variables like the other networks.

Each `Default` network in `sls` was updated to leverage the new `ParentDevice` if applicable.

Lastly this adds a `.Gateway` key to the `initialize.NCNNetwork`, this will be useful for some simplification in a few upcoming commits.

Remove `bond0` hardcode in `ifcfg`

Leverage the new `ParentInterfaceName` value and remove all hardcoded
`bond0`.
The `initialize.MakeBaseCampfromNCNs()` function was modified to remove a nested for-loop along with several hardcodes for parent devices.

The loop for constructing the `ncnIPAM` dictionary now leverages the each NCN's `NCNNetwork` struct, as well as the struct's new `ParentInterfaceName` and `Gateway` values. These new values no longer require us to loop through the larger, arbitrary `shastaNetworks` slice.
This reduces the DNSMasq templates to a few reusable templates, making use of the new `.InterfaceName` attribute in `networking.IPV4Subnet`.
@rustydb
Copy link
Contributor Author

rustydb commented Jul 10, 2024

This was moved out of a draft today in order to ping everyone for reviews.
#405 just merged, this PR was rebased main.

@rustydb rustydb merged commit e5e4223 into main Jul 11, 2024
8 checks passed
@rustydb rustydb deleted the CASMTRIAGE-7093 branch July 11, 2024 15:02
rustydb added a commit that referenced this pull request Jul 16, 2024
PR #406 consolidated our DNSMasq templates but neglected to preserve the `packages.local` CNAME critical for our cloud-init deployment.
@rustydb rustydb mentioned this pull request Jul 16, 2024
3 tasks
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