external DNS: Add variable `service_monitor`
* This variable will enable or disable creation of `ServiceMonitor` for
external DNS.
* This commit also adds a label makes sure that the `ServiceMonitor`
created for external DNS is selected by the prometheus operator
shipped with Lokomotive.
@@ -47,6 +47,16 @@ txtOwnerId: {{ .OwnerID }}
{{- end }}
policy: {{ .Policy }}
replicas: 3
+
+{{ if .ServiceMonitor }}
+metrics:
+ enabled: true
+ serviceMonitor:
+ enabled: true
+ namespace: {{ .Namespace }}
+ selector:
+ release: prometheus-operator
+{{ end }}
`
func init() {
@@ -67,6 +77,7 @@ type component struct {
Namespace string `hcl:"namespace,optional"`
Metrics bool `hcl:"metrics,optional"`
Policy string `hcl:"policy,optional"`
+ ServiceMonitor bool `hcl:"service_monitor,optional"`
AwsConfig AwsConfig `hcl:"aws,block"`
OwnerID string `hcl:"owner_id"`
}
@@ -80,6 +91,7 @@ func newComponent() *component {
},
Policy: "upsert-only",
Metrics: false,
+ ServiceMonitor: false,
}
}
