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

Use Sprig template functions #2033

Open
fahhem opened this issue Jan 29, 2025 · 5 comments · May be fixed by #2038
Open

Use Sprig template functions #2033

fahhem opened this issue Jan 29, 2025 · 5 comments · May be fixed by #2038
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@fahhem
Copy link

fahhem commented Jan 29, 2025

What would you like to be added:
https://github.com/Masterminds/sprig

This library provides ease-of-use helpers, like split and replace.

Why is this needed:

Currently, I cannot use system.dmiid.product_name because the value has a space in it, and spaces are disallowed in labels. If I could do {{.Value | replace " " "-" }} it would fix it for me. As a result, I have to match the product_names I expect and manually write labels for them.

This will be true of any data that's not controlled by the cluster operator to be put into the content of a label.

@fahhem fahhem added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 29, 2025
@marquiz
Copy link
Contributor

marquiz commented Jan 29, 2025

Thanks @fahhem for the suggestion. This would be a very good enhancement. Would you be willing to work on this? 😉

The same issue has been discussed also here:
https://kubernetes.slack.com/archives/C01A82FKSQK/p1736747630626349

In addition, we could add some nfd-specific functions, say labelize to sanitize a value to be accepted as a kubernetes label value.

@marquiz
Copy link
Contributor

marquiz commented Jan 29, 2025

/help

@k8s-ci-robot
Copy link
Contributor

@marquiz:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jan 29, 2025
fahhem added a commit to SonicInfra/node-feature-discovery that referenced this issue Jan 29, 2025
@fahhem
Copy link
Author

fahhem commented Jan 29, 2025

Thanks @marquiz, sent a PR to do this: #2038

I went with asLabelValue vs labelize because the key of a label has more limitations and I'm not ready to re-implement one of these functions in Go: https://github.com/kubeflow/kfp-tekton/blob/master/sdk/python/kfp_tekton/compiler/_k8s_helper.py#L20

@marquiz
Copy link
Contributor

marquiz commented Jan 30, 2025

sent a PR to do this: #2038

Great work! Reviewed

I went with asLabelValue vs labelize because the key of a label has more limitations and I'm not ready to re-implement one of these functions in Go: https://github.com/kubeflow/kfp-tekton/blob/master/sdk/python/kfp_tekton/compiler/_k8s_helper.py#L20

That's good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants