Skip to content

Commit

Permalink
patch - make prometheus-rule controller optional (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrNovo authored Sep 19, 2023
1 parent d0aafbe commit 86eb41e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Or with `regin` and `api-key` flags
```sh
$ go run main.go -region EUROPE2 -api-key xxx-xxx-xxx
```
For not running the prometheusRule controller set the `prometheus-rule-controller` flag to `false`
```sh
$ go run main.go -prometheus-rule-controller=false
```
Or build and push your image to a registry
```sh
make docker-build docker-push IMG=<some-registry>/coralogix-operator:tag
Expand Down
19 changes: 12 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func main() {
apiKey := os.Getenv("CORALOGIX_API_KEY")
flag.StringVar(&apiKey, "api-key", apiKey, "The proper api-key based on your Coralogix cluster's region")

var prometheusRuleController bool
flag.BoolVar(&prometheusRuleController, "prometheus-rule-controller", true, "Determine if the prometheus rule controller should be started. Default is true.")

opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
flag.Parse()
Expand Down Expand Up @@ -144,13 +147,15 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "Alert")
os.Exit(1)
}
if err = (&controllers.PrometheusRuleReconciler{
CoralogixClientSet: clientset.NewClientSet(targetUrl, apiKey),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RecordingRuleGroup")
os.Exit(1)
if prometheusRuleController {
if err = (&controllers.PrometheusRuleReconciler{
CoralogixClientSet: clientset.NewClientSet(targetUrl, apiKey),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RecordingRuleGroup")
os.Exit(1)
}
}
if err = (&alphacontrollers.RecordingRuleGroupSetReconciler{
CoralogixClientSet: clientset.NewClientSet(targetUrl, apiKey),
Expand Down

0 comments on commit 86eb41e

Please sign in to comment.