Closed TheSpiritXIII closed 6 months ago
I'm finding it a bit hard to split because the validation methods call the methods to generate the Prometheus configurations and moving all of those doesn't make sense to live in the validation file. The end result was that the _validation
files were small because the Validate
methods are only a single line. Instead I moved the generation methods to _config.go
and kept the validate local to _types.go
. Thoughts?
Changes
In my opinion, this is where rules generation should live. In my ideal world, types would be a separate package than the operator, and external tools could import the types package and validate them. Two examples of where this would be useful is a prometheus-operator converter (which would even be able to compare resulting Prometheus configurations this way) and a dedicated webhook package.
This is also consistent with the monitoring types.
RuleGroupsConfig
is analogous toScrapeConfigs
.Expand rules generation tests to validate that forbidden labels return an error.
Move monitoring defaulters to inline in the types.
Moved around monitoring types methods to be local to each class (e.g. PodMonitoring methods next to other PodMonitoring methods, instead of interleaved methods all over).
The monitoring and rules validate methods no longer take dummy projects, names and locations. This makes the code less confusing.