loki
loki copied to clipboard
fix(helm): correct PodLogs namespaceSelector for v1alpha2 CRD
What this PR does / why we need it
This PR fixes an incompatibility in the Helm chart’s PodLogs template when using monitoring.grafana.com/v1alpha2 as the PodLogs API version. The template is updated to render matchLabels instead of matchNames for v1alpha2, since the v1alpha2 PodLogs CRD does not support matchNames.
This ensures that the generated PodLogs resource correctly scopes log collection to the Loki namespace and prevents unintended cluster-wide log scraping.
Which issue(s) this PR fixes
Fixes #19737
Special notes for your reviewer
- This patch maintains full backward compatibility with existing API versions.
- The change only affects the PodLogs resource generated by selfMonitoring.
- The logic matches the CRD schema for v1alpha2, which accepts only matchLabels and matchExpressions.
Checklist
- [x] Reviewed the
CONTRIBUTING.mdguide (required) - [ ] Documentation added
- [ ] Tests updated
- [x] Title matches the required conventional commits format, see here
-
Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such,
featPRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
-
Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such,
- [ ] Changes that require user attention or interaction to upgrade are documented in
docs/sources/setup/upgrade/_index.md - [ ] If the change is deprecating or removing a configuration option, update the
deprecated-config.yamlanddeleted-config.yamlfiles respectively in thetools/deprecated-config-checkerdirectory. Example PR