cluster autoscaler: Add variable `service_monitor`
* This variable will enable or disable creation of `ServiceMonitor` for
cluster autoscaler.
* This commit also adds a label makes sure that the `ServiceMonitor`
created for cluster autoscaler is selected by the prometheus operator
shipped with Lokomotive.
@@ -65,6 +65,14 @@ extraArgs:
podDisruptionBudget: []
kubeTargetVersionOverride: v1.17.2
+
+{{ if .ServiceMonitor }}
+serviceMonitor:
+ enabled: true
+ namespace: {{ .Namespace }}
+ selector:
+ release: prometheus-operator
+{{ end }}
`
func init() {
@@ -88,6 +96,9 @@ type component struct {
ScaleDownUnreadyTime time.Duration
ScaleDownUnreadyTimeRaw string `hcl:"scale_down_unready_time,optional"`
+ // Prometheus Operator related parameters.
+ ServiceMonitor bool `hcl:"service_monitor,optional"`
+
// Packet-specific parameters
Packet *packetConfiguration `hcl:"packet,block"`
}
@@ -113,6 +124,7 @@ func newComponent() *component {
ScaleDownUnneededTime: 10 * time.Minute,
ScaleDownDelayAfterAdd: 10 * time.Minute,
ScaleDownUnreadyTime: 20 * time.Minute,
+ ServiceMonitor: false,
}
switch c.Provider {
