Skip to content

Commit

Permalink
Fix monitoring logs (#277)
Browse files Browse the repository at this point in the history
* Revert "Remove logs from metrics after operator-sdk upgrade (#263)"

This reverts commit afbc990.

* Fix role for operator-sdk 0.12.0

Signed-off-by: Quique Llorente <[email protected]>
  • Loading branch information
qinqon authored and phoracek committed Nov 28, 2019
1 parent 6251cdb commit 4591898
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ func serveCRMetrics(cfg *rest.Config) error {
if err != nil {
return err
}

// To bypass ugly metrics logs after operator-sdk 0.12.0 upgrade
// https://github.com/operator-framework/operator-sdk/issues/1858#issuecomment-548323725
operatorNs := ""

// Get the namespace the operator is currently deployed in.
operatorNs, err := k8sutil.GetOperatorNamespace()
if err != nil {
return err
}
// To generate metrics in other namespaces, add the values below.
ns := []string{operatorNs}
// Generate and serve custom resource specific metrics.
Expand Down
2 changes: 2 additions & 0 deletions deploy/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rules:
- events
- configmaps
- secrets
- pods
verbs:
- '*'
- apiGroups:
Expand Down Expand Up @@ -62,3 +63,4 @@ rules:
verbs:
- get
- list
- watch

2 comments on commit 4591898

@obrienrobert
Copy link

@obrienrobert obrienrobert commented on 4591898 Dec 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qinqon I am also experiencing this issue on another project. I hope you don't mind me asking, but is the fix to update the role.yml file, as you have above? I am using operator-sdk 0.12.0.

@qinqon
Copy link
Member Author

@qinqon qinqon commented on 4591898 Dec 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@obrientrobert for k8s 1.15 changing the role.yaml fixed it, but you also may need something else in case your operator is cluster scoped instead of namespaces.

Please sign in to comment.