Skip to content

Conversation

@ringerc
Copy link

@ringerc ringerc commented May 13, 2022

Description of the change:

Add a short example showing how to configure the Zap log level for the operator with Kustomize.

Patches https://sdk.operatorframework.io/docs/building-operators/golang/references/logging/

Motivation for the change:

The Zap logger framework does not appear to support using environment-variables for setting the log level etc, so users need to be able to modify the command line to set log levels.

Kustomize is very commonly used to deploy operators. Document how to set the log level with a Kustomize patch, without having to copy the whole Deployment and hack it by hand.

Ideally the controller would support log level configuration in the environment and document it, so a simple ConfigMap with envFrom could be used to control logging instead. But in the absence of this, documenting how to set up log levels somehow is desirable.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@ringerc
Copy link
Author

ringerc commented May 13, 2022

On a semi-related side-note, Kustomize's inability to use xpath/jsonpath like selectors to match patch targets is agony - we can't write /spec/template/spec/containers/[?.name=="controller-manager"]/args/- for example...

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

This looks good to me but would like to get some input from @asmacdo and @jmrodri

Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

Two minor issues otherwise looks great. Once those two items are addressed, my review can be overridden.

@ringerc
Copy link
Author

ringerc commented Jun 4, 2022

@jmrodri I've merged your changes. I will need to satisfy the DCO too, then I can merge this.

The Zap logger framework does not appear to support using environment-variables for setting the log level etc, so users need to be able to modify the command line to set log levels.

Kustomize is very commonly used to deploy operators. Document how to set the log level with a Kustomize patch, without having to copy the whole Deployment and hack it by hand.

Ideally the controller would support log level configuration in the environment and document it, so a simple `ConfigMap` with `envFrom` could be used to control logging instead. But in the absence of this, documenting how to set up log levels somehow is desirable.

Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
@ringerc
Copy link
Author

ringerc commented Jun 4, 2022

@jmrodri I have rebased to apply your wording changes as fixups to this PR to make the DCO checker happy. Once your approval state is changed I will merge. Thanks for the review.

@ringerc
Copy link
Author

ringerc commented Jun 9, 2022

Failed to merge because

External link https://kind.sigs.k8s.io/ failed: got a time out (response code 0)

@jmrodri

Suspect just needs a retry

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 7, 2022
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 8, 2022
@jmrodri
Copy link
Member

jmrodri commented Oct 8, 2022

/lifecycle frozen

@openshift-ci
Copy link

openshift-ci bot commented Oct 8, 2022

@jmrodri: The lifecycle/frozen label cannot be applied to Pull Requests.

In response to this:

/lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Nov 7, 2022
@openshift-ci
Copy link

openshift-ci bot commented Nov 7, 2022

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants