Skip to content

Conversation

@synackd
Copy link
Collaborator

@synackd synackd commented Dec 10, 2025

Pull Request Template

Thank you for your contribution! Please ensure the following before submitting:

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar
    • All referenced licenses are present in the LICENSES/ directory

Description

Introduce node_pattern, bmc_pattern, and domain configuration keys to allow custom hostnames to be set for nodes and BMCs (respectively) that are stored in SMD. The default behavior before was effectively to set node_pattern=nid{04d}, meaning that the default format is nid followed by a three-zero-padded node ID (e.g. nid001). The optional domain key allows a domain to be specified that is appended to hostnames, making them fully qualified.

Here's a snippet of documentation of these keys from examples/coredhcp/coredhcp.conf:

# CUSTOM HOSTNAMES:
#
# For node_pattern and bmc_pattern, custom hostname patterns can be
# specified to dynamically generate custom hostnames for BMCs and nodes in
# SMD.
#
# Hostname Placeholder Syntax:
#
#   {Nd} - Zero-padded NID where N is the number of digits
#          Examples: {04d} -> 0001, 0042, 1234
#                    {02d} -> 01, 42, 99
#                    {05d} -> 00001, 00042, 12345
#   {id} - Component xname (e.g., x3000c0s0b0n0 for nodes, x3000c0s0b1 for 
#          BMCs)
#
# Literal text can be mixed with placeholders:
#
#   "compute-{04d}" -> compute-0001, compute-0042
#   "node-{id}"     -> node-x3000c0s0b0n0
#   "dev-s{02d}"    -> dev-s01, dev-s42
#
# CUSTOM DOMAINS:
#
# If 'domain' is specified, a custom domain will be appended to hostnames
# generated using the custom hostname mechanism above, making generated
# hostnames fully-qualified.
#
# For instance, for the following configuration:
#
#   - coresmd: ... node_pattern="{id}" bmc_pattern="{id}" domain=cluster.local
#
# {id} will be expanded to the node/BMC's xname and the domain cluster.local
# will be appended. For example:
#
#   BMC hostname:  x3000c0s0b1.cluster.local
#   Node hostname: x3000c0s0b1n0.cluster.local

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

For more info, see Contributing Guidelines.

@synackd
Copy link
Collaborator Author

synackd commented Dec 10, 2025

Creating this draft PR to build testable container images. Before this is ready for review/merge, #37 should be merged since this is based off of that, and it should be rebased onto the new main.

@synackd synackd force-pushed the feat/hostname-patterns branch 2 times, most recently from d8d413a to 49acc58 Compare December 10, 2025 22:42
Two new coresmd configurations for CoreDHCP are added:

- node_pattern: a pattern to format node hostnames that supports
  component IDs
  - Default: 'nid{04d}'
  - Example: 'compute{03d}' for NID 10 would resolve to 'compute010'
- bmc_pattern: a pattern to format BMC hostnames that supports node IDs
  - Default: 'bmc{04d}'
  - Example: 'bmc{04d}' for ID 3 would resolve to 'bmc0003'

Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
@synackd synackd force-pushed the feat/hostname-patterns branch from 49acc58 to 7e1e68f Compare December 10, 2025 23:06
@synackd synackd closed this Dec 10, 2025
@synackd synackd deleted the feat/hostname-patterns branch December 10, 2025 23:07
@synackd synackd restored the feat/hostname-patterns branch December 10, 2025 23:07
@synackd synackd reopened this Dec 10, 2025
@synackd synackd marked this pull request as ready for review December 10, 2025 23:08
@synackd synackd merged commit c6e3742 into main Dec 10, 2025
7 checks passed
@synackd synackd deleted the feat/hostname-patterns branch December 10, 2025 23:15
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