Closed felipesere closed 7 months ago
Unless you can provide a sample file there's not much we can do here.
👋 Circling back to this. I have a small file that I easily reproduces the issue I face:
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deployment-notifier
namespace: tools
spec:
podSelector:
matchLabels:
app: deployment-notifier
policyTypes:
- Ingress
- Egress
egress:
- to:
- namespaceSelector:
matchLabels:
name: opentelemetry-operator-system
ports:
- port: 1
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: deployment-notifier
namespace: tools
spec:
groups:
- name: ./deployment-notifier.rules
rules:
- alert: DeploymentNotifierSwarmiaProviderErrors
annotations:
summary: Something something...
expr: 1 > 0
for: 10m
labels:
severity: not-that-critical
Above yaml is a snippet of what my helm chart produces. If I keep the order as is I get zero lint failures with the config from my previous comment. If I change the order of the documents to have the PromRule first, I get the expected lint error.
That's because current yaml parser doesn't correctly read all documents from a multi-document file. If you have a file with:
---
some:
yaml
---
some more:
yaml
then only first some:yaml
document is read, that's a bug and I hope to fix it one day but don't have much time for it at the moment.
Fixed in #894
We use
helm
to produce a single, largemanifest.yaml
for each application that contains many YAML docs. When runningpint
against it, my expectation is that it would find the right documents withkind: PrometheusRule
and then apply the lints there. At the moment, it just silently fails. If I just extract the PrometheusRules from thatmanifest.yaml
and run them individually pint correctly finds issues.Here is our pint config: