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

eliminate all instances of default filter in roles => var should have a default defined only once #11822

Open
Tracked by #10697
VannTen opened this issue Dec 19, 2024 · 2 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@VannTen
Copy link
Contributor

VannTen commented Dec 19, 2024

We have lots of instances of this pattern:

"{{ some_var | d(some_default_value) }}"

Where the same value is repeated multiples places in the code base
-> that default should be defined only once.

We should instead define those defaults in roles defaults/ directories, either

  • in the role where it's used
  • in kubespray-defaults (main.yml) if it's used in several roles.

Where possible, the default definition should also be accompanied by a comment defining the use of the variable, and possibly a commented examples for variable with a complex internal structure.

The two benefits:

  • the code is more readable when not littered with default filters
  • variables are defined in one place

(by the way, this also apply to variable which we check with is defined -> we shouldn't have to do that if we define a default)
There is no need to tackle every instance at once, but this is pretty good way to start working on the code base for new contributors.

/help
/good-first-issue

@VannTen
Copy link
Contributor Author

VannTen commented Dec 19, 2024

/help
/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@VannTen:
This request has been marked as suitable for new contributors.

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-good-first-issue command.

In response to this:

/help
/good-first-issue

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 good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

2 participants