Skip to content

Commit

Permalink
[KOGITO-8276] Fix setup log
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <[email protected]>
  • Loading branch information
desmax74 committed Aug 3, 2023
1 parent 89edffd commit 3a4465b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ package api
const (
// ComponentName just a name to identify this package/component/application
ComponentName = "sonataflow"
LogName = "sonataflow-operator"
)
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
- --v=0
command:
- /usr/local/bin/manager
env:
Expand Down
1 change: 1 addition & 0 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ spec:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- "--v=0"
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
- /usr/local/bin/manager
args:
- --leader-elect
- '-v=2'
- --v=2
image: controller:latest
name: manager
securityContext:
Expand Down
22 changes: 22 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ In order to build the project, you need to comply with the following requirement
- [operator-sdk-v1.25.0+](https://sdk.operatorframework.io/docs/building-operators/golang/installation/)
- [Go 1.19+](https://go.dev/dl/)
- [Kubebuilder 3.7.0+](https://github.com/kubernetes-sigs/kubebuilder/releases)
- [CEKit 4.8.0+](https://cekit.io/)

GNU Make:
Used to define composite build actions. This should be already installed or available as a
Expand Down Expand Up @@ -137,6 +138,27 @@ make deploy
make undeploy
```

### Change log level
By Default the log level is set to show only ERRORS with
```sh
- "--v=0"
```
inside the manager_auth_proxy_patch.yaml in the containers' section of kube-rbac-proxy and manager.

With the
```sh
make generate-all
```
whese values will be replicated on operator.yaml and on sonataflow-operator.clusterserviceversion.yaml containers' sections.

If you want to see the INFO msg replace v=0 with v=2 in the files during the development or in the deployment files on the cluster

The available levels are:
- v=0 > Error
- v=1 > Warning
- v=2 >Info
- v=3 > Debug

### Running the operator on the cluster

See the section on [README](../README.md#getting-started)
Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (
"flag"
"os"

"github.com/kiegroup/kogito-serverless-operator/api"

"k8s.io/klog/v2/klogr"

"k8s.io/klog/v2"

"github.com/kiegroup/kogito-serverless-operator/utils"
Expand Down Expand Up @@ -62,6 +66,8 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
flag.Parse()

ctrl.SetLogger(klogr.New().WithName(api.LogName))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Expand Down
1 change: 1 addition & 0 deletions operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,7 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
- --v=0
command:
- /usr/local/bin/manager
env:
Expand Down

0 comments on commit 3a4465b

Please sign in to comment.