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

Expand Hardware spec fields available as template data in Templates: #807

Merged
merged 7 commits into from
Apr 9, 2024

Conversation

jacobweinstock
Copy link
Member

@jacobweinstock jacobweinstock commented Oct 6, 2023

Description

This improves the templating of Templates. This was requested by quite a few folks in the community.

Why is this needed

Fixes: #

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.89%. Comparing base (1a8fd1b) to head (70184bf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #807      +/-   ##
==========================================
+ Coverage   50.61%   50.89%   +0.28%     
==========================================
  Files          36       36              
  Lines        1549     1558       +9     
==========================================
+ Hits          784      793       +9     
  Misses        712      712              
  Partials       53       53              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobweinstock jacobweinstock marked this pull request as ready for review October 6, 2023 21:45
type netInterface struct {
MAC string
VLANID string
DHCP dhcp
Copy link
Member

Choose a reason for hiding this comment

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

I know we've been around this loop but lets go again: do we think DHCP is here to stay with the network interface data? I.e. would we introduce any feature where DHCP isn't specified? If so, how can I easily determine if the DHCP config is available from template language?

Copy link
Member Author

@jacobweinstock jacobweinstock Oct 9, 2023

Choose a reason for hiding this comment

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

Question: do we think DHCP is here to stay with the network interface data? Not necessarily.
Response: We could change this to IPAM or something more generic and remove non IPAM data. If the answer to this question is no, what would you say are our alternatives?

Question: would we introduce any feature where DHCP isn't specified?
Response: I can't think of any at the moment.

Question: If so, how can I easily determine if the DHCP config is available from template language?
Answer: I dont know if i understand what you're asking. How is this done with any data from the template language? I dont know if this is what you're asking but we could write some functions for retrieving this DHCP data.

Copy link
Member

@chrisdoherty4 chrisdoherty4 Oct 9, 2023

Choose a reason for hiding this comment

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

I think I'm inventing possibilities to challenge this because its meant to be a stable contract. I don't know how productive trying to provide stability here really is though. I feel like we'd be better off just plumbing through the raw Hardware.Spec and when that becomes stable this contract inherently becomes stable.

Given we've had numerous requests to get various fields, mostly network interface data, how do you feel about including that and declaring this 'stable' contract a deprecated experiment (but we'll leave it in for now)?

Copy link
Member

Choose a reason for hiding this comment

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

@jacobweinstock What did we conclude - I don't recall?

docs/Template.md Outdated Show resolved Hide resolved
chrisdoherty4
chrisdoherty4 previously approved these changes Oct 25, 2023
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This expands the available Hardware data to
Templates for templating. Using sprig functions
allows us to remove some custom template funcs we
had. Sprig also gives us lots of other useful templating
functions.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Has updated features and fixes.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
If a value used in the template contract is nil,
handle properly.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
@jacobweinstock jacobweinstock changed the title Add DHCP info to available template data: Expand Hardware spec fields available as template data in Templates: Apr 6, 2024
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
@jacobweinstock jacobweinstock added the ready-to-merge Signal to Mergify to merge the PR. label Apr 9, 2024
@mergify mergify bot merged commit a143c63 into tinkerbell:main Apr 9, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants