|
|
|
@ -41,16 +41,18 @@ func init() { |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
var ( |
|
|
|
|
metricsAddr string |
|
|
|
|
enableLeaderElection bool |
|
|
|
|
probeAddr string |
|
|
|
|
enableCertSigning bool |
|
|
|
|
enableServiceMonitors bool |
|
|
|
|
enableTLSServiceMonitors bool |
|
|
|
|
enableGateway bool |
|
|
|
|
enableGatewayRoute bool |
|
|
|
|
enablePrometheusAlerts bool |
|
|
|
|
enableGrafanaLabsAnalytics bool |
|
|
|
|
metricsAddr string |
|
|
|
|
enableLeaderElection bool |
|
|
|
|
probeAddr string |
|
|
|
|
enableCertSigning bool |
|
|
|
|
enableServiceMonitors bool |
|
|
|
|
enableTLSServiceMonitors bool |
|
|
|
|
enableGateway bool |
|
|
|
|
enableGatewayRoute bool |
|
|
|
|
enablePrometheusAlerts bool |
|
|
|
|
enableGrafanaLabsAnalytics bool |
|
|
|
|
enableAlertingRuleWebhooks bool |
|
|
|
|
enableRecordingRuleWebhooks bool |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") |
|
|
|
@ -70,6 +72,10 @@ func main() { |
|
|
|
|
flag.BoolVar(&enablePrometheusAlerts, "with-prometheus-alerts", false, "Enables prometheus alerts.") |
|
|
|
|
flag.BoolVar(&enableGrafanaLabsAnalytics, "with-grafana-labs-analytics", true, |
|
|
|
|
"Enables Grafana Labs analytics.\nMore info: https://grafana.com/docs/loki/latest/configuration/#analytics") |
|
|
|
|
flag.BoolVar(&enableAlertingRuleWebhooks, "with-alerting-rule-webhooks", true, |
|
|
|
|
"Enables AlertingRule validation webhooks.") |
|
|
|
|
flag.BoolVar(&enableRecordingRuleWebhooks, "with-recording-rule-webhooks", true, |
|
|
|
|
"Enables RecordingRule validation webhooks.") |
|
|
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
|
logger := log.NewLogger("loki-operator") |
|
|
|
@ -132,9 +138,11 @@ func main() { |
|
|
|
|
logger.Error(err, "unable to create controller", "controller", "AlertingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
if err = (&lokiv1beta1.AlertingRule{}).SetupWebhookWithManager(mgr); err != nil { |
|
|
|
|
logger.Error(err, "unable to create webhook", "webhook", "AlertingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
if enableAlertingRuleWebhooks { |
|
|
|
|
if err = (&lokiv1beta1.AlertingRule{}).SetupWebhookWithManager(mgr); err != nil { |
|
|
|
|
logger.Error(err, "unable to create webhook", "webhook", "AlertingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err = (&controllers.RecordingRuleReconciler{ |
|
|
|
|
Client: mgr.GetClient(), |
|
|
|
@ -144,9 +152,11 @@ func main() { |
|
|
|
|
logger.Error(err, "unable to create controller", "controller", "RecordingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
if err = (&lokiv1beta1.RecordingRule{}).SetupWebhookWithManager(mgr); err != nil { |
|
|
|
|
logger.Error(err, "unable to create webhook", "webhook", "RecordingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
if enableRecordingRuleWebhooks { |
|
|
|
|
if err = (&lokiv1beta1.RecordingRule{}).SetupWebhookWithManager(mgr); err != nil { |
|
|
|
|
logger.Error(err, "unable to create webhook", "webhook", "RecordingRule") |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err = (&controllers.RulerConfigReconciler{ |
|
|
|
|
Client: mgr.GetClient(), |
|
|
|
|