-
-
Notifications
You must be signed in to change notification settings - Fork 14
[Rule] Detect duplicate label keys #313
Copy link
Copy link
Open
Description
Rule Description
- Category: best-practice?
- Severity: error
- Fixable: no
Problematic Code Example
Provide an example of code that would trigger this rule.
services:
app:
[...]
labels:
- "service.foo=bar"
- "service.foo=baz"Correct Code Example
Provide an example of the code that would pass the rule.
services:
app:
[...]
labels:
- "service.foo=bar"
- "service.bar=baz"Rule Details
Explain the rule in detail and why it should be added:
It can happen that one accidentally creates a label where the key of the label already exists. What seems to happen when this is run that the last label value wins. It is often hard to detect manually and requires troubleshooting.
An example where this just happened to us is using Ofelia to define jobs. It also has happened to me with traefik labels before.
Where it might not be appropriate: It might be possible that someone wants to deliberately overwrite a label to use a different value (e.g., when using multiple compose files that get merged).
Supported Options
n/a
References
n/a
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels