cert-manager: Add variable `service_monitor`
* This variable will enable or disable creation of `ServiceMonitor` for
cert-manager.
* This commit also adds a label makes sure that the `ServiceMonitor`
created for cert-manager is selected by the prometheus operator shipped
with Lokomotive.
@@ -35,12 +35,14 @@ type component struct {
Email string `hcl:"email,attr"`
Namespace string `hcl:"namespace,optional"`
Webhooks bool `hcl:"webhooks,optional"`
+ ServiceMonitor bool `hcl:"service_monitor,optional"`
}
func newComponent() *component {
return &component{
Namespace: "cert-manager",
Webhooks: true,
+ ServiceMonitor: false,
}
}
@@ -48,6 +50,13 @@ const chartValuesTmpl = `
email: {{.Email}}
webhook:
enabled: {{.Webhooks}}
+{{ if .ServiceMonitor }}
+prometheus:
+ servicemonitor:
+ enabled: true
+ labels:
+ release: prometheus-operator
+{{ end }}
`
func (c *component) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContext) hcl.Diagnostics {
