-
Notifications
You must be signed in to change notification settings - Fork 247
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
pkg/apis/nfd: stricter format checking for template labels #668
pkg/apis/nfd: stricter format checking for template labels #668
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marquiz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
An alternative to solution would be to ditch the default value ("true") and e.g. just error out if the value part is missing (i.e. the expanded template value does not have an equals sign). I'm fine with that solution, too, if people like it more. The reasoning behind the default "true" value is that it aligns with the format of hooks and feature files |
Will change this |
fa853ae
to
a8057b1
Compare
Changed the PR to behave like this. /unhold |
a8057b1
to
9758ece
Compare
Require that the expanded LabelsTemplate has values. That is, the (expanded) template must consist of key=value pairs separated by newlines. No default value will be assigned and we now return an error if a (non-empty) line not conforming with the key=value format is encountered. Commit c8d7366 described that the value defaults to "true" if not specified. That was not the case and we defaulted to an empty string, instead. An example: - name: "my rule" labelsTemplate: | my.label.1=foo my.label.2= Would create these labels: "my.label.1": "foo" "my.label.2": "" Further, the following: - name: "my failing rule" labelsTemplate: | my.label.3 will cause an error in the rule processing.
9758ece
to
8a4d316
Compare
We can make the API more restrictive and loosen up when needed, the other way around could be problematic. /lgtm |
Require that the expanded LabelsTemplate has values. That is, the
(expanded) template must consist of key=value pairs separated by
newlines. No default value will be assigned and we now return an error
if a (non-empty) line not conforming with the key=value format is
encountered.
Commit c8d7366 described that the value defaults to "true" if not
specified. That was not the case and we defaulted to an empty string,
instead.
An example:
Would create these labels:
Further, the following:
will cause an error in the rule processing.