Skip to content

Add hostname propagation to ironcore-net NetworkInterfaces#681

Draft
ushabelgur wants to merge 2 commits intomainfrom
enh/hostname
Draft

Add hostname propagation to ironcore-net NetworkInterfaces#681
ushabelgur wants to merge 2 commits intomainfrom
enh/hostname

Conversation

@ushabelgur
Copy link
Contributor

@ushabelgur ushabelgur commented Jan 28, 2026

Proposed Changes

  • Pass machineName as hostaname to ironcore-net NetworkInterfaces while creating machine
  • Update testcase
  • Update ironcore-net dependency

Fixes #538

Summary by CodeRabbit

  • New Features

    • Network interfaces now support hostname configuration; hostnames are automatically assigned from machine identifiers to improve network identification and management.
  • Dependencies

    • Updated the ironcore-net dependency to a newer release.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Walkthrough

Adds a HostName field to NetworkInterfaceSpec, sets it to the machine ID during machine creation, and propagates it through the apinet plugin into the ironcore-net NetworkInterface spec. Also bumps the ironcore-net module version.

Changes

Cohort / File(s) Summary
Core API Extension
api/machine.go
Added HostName string (JSON hostName,omitempty) to NetworkInterfaceSpec.
Plugin Implementation
internal/plugins/networkinterface/apinet/apinet.go
Populate APInet NetworkInterface.Spec.Hostname from spec.HostName when constructing the apinet object.
Machine Creation Logic
internal/server/machine_create.go
Set HostName = iriMachine.Metadata.Id on each api.NetworkInterfaceSpec during machine creation.
Dependency Update
go.mod
Bumped github.com/ironcore-dev/ironcore-net from v0.2.4 to v0.2.5-0.20260123094402-a0b32fb0e8ff.

Sequence Diagram

sequenceDiagram
    participant Client
    participant MachineCreate as Machine Create Handler
    participant APISpec as NetworkInterfaceSpec
    participant APINETPlugin as APINet Plugin
    participant IronNetAPI as IronCore-Net API

    Client->>MachineCreate: Create Machine Request
    MachineCreate->>APISpec: Construct NetworkInterfaceSpec
    MachineCreate->>APISpec: Set HostName = Machine.ID
    MachineCreate->>APINETPlugin: Create NetworkInterface with Spec
    APINETPlugin->>APISpec: Read HostName from Spec
    APINETPlugin->>IronNetAPI: Create NetworkInterface (includes Hostname)
    IronNetAPI->>APINETPlugin: Confirm Creation
    APINETPlugin->>MachineCreate: Return Result
    MachineCreate->>Client: Machine Created
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: adding hostname propagation to ironcore-net NetworkInterfaces.
Description check ✅ Passed The PR description covers all required aspects: passing machineName as hostname, updating testcases, and dependency updates, with proper issue reference.
Linked Issues check ✅ Passed The PR successfully implements the requirements from issue #538: adds HostName field to NetworkInterfaceSpec [538], propagates hostname through apinet plugin [538], and updates dependencies [538].
Out of Scope Changes check ✅ Passed All changes are in-scope: adding hostname field to API, propagating it in machine creation and apinet plugin, and updating ironcore-net dependency to support the feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enh/hostname

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added enhancement New feature or request size/S labels Jan 28, 2026
@ushabelgur ushabelgur self-assigned this Jan 28, 2026
@ushabelgur ushabelgur added the integration-tests to run integration tests label Jan 28, 2026
@ushabelgur ushabelgur force-pushed the enh/hostname branch 2 times, most recently from b53f555 to e41fa2f Compare January 28, 2026 06:32
@hardikdr hardikdr added this to Roadmap Jan 28, 2026
@ushabelgur ushabelgur marked this pull request as ready for review January 28, 2026 08:10
@ushabelgur ushabelgur requested a review from a team as a code owner January 28, 2026 08:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/server/machine_create.go (1)

57-67: ⚠️ Potential issue | 🔴 Critical

HostName field will be empty string because iriMachine.Metadata.Id is not populated in requests.

At line 64, the HostName is set to iriMachine.Metadata.Id, but the IRI request's Metadata object never includes an Id field—it's only present in the response after being generated by the server. All test cases confirm that incoming Machine.Metadata contains only labels, not an id.

The PR objective states "Pass machineName as hostname," but the IRI Machine request provides no machine name field. The available option in the request is the Labels map (which contains a UID label, not a human-readable name). The server's generated internal ID at line 71 comes too late and is not the IRI machine's identifier anyway.

To fix this: determine whether to use a label value (if machine name is stored there), or reconsider the approach for obtaining the machine identifier at the point where NetworkInterfaceSpec is created.

@afritzler
Copy link
Member

Screenshot 2026-02-09 at 10 11 34

@ushabelgur ushabelgur marked this pull request as draft February 9, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compute enhancement New feature or request integration-tests to run integration tests size/S

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add hostname propagation to ironcore-net NetworkInterfaces

4 participants