Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTA-1029: Add CVO Log level API #1492

Closed
wants to merge 1 commit into from
Closed

Conversation

Davoska
Copy link

@Davoska Davoska commented Oct 9, 2023

This enhancement describes the API changes needed to provide a simple way of dynamically changing the Cluster Version Operator's log level.

This pull request references https://issues.redhat.com/browse/OTA-1029

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 9, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 9, 2023

@Davoska: This pull request references OTA-1029 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set.

In response to this:

This enhancement describes the API changes needed to provide a simple way of dynamically changing the Cluster Version Operator's log level.

This pull request references https://issues.redhat.com/browse/OTA-1029

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-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 9, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@Davoska
Copy link
Author

Davoska commented Oct 9, 2023

/test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 9, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sdodson for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Davoska
Copy link
Author

Davoska commented Oct 9, 2023

/test all

@petr-muller
Copy link
Member

/cc

@Davoska Davoska force-pushed the cvo-logging branch 5 times, most recently from 1056f05 to 8380ff6 Compare October 12, 2023 14:51
@Davoska Davoska requested a review from wking October 12, 2023 14:54
@Davoska Davoska marked this pull request as ready for review October 17, 2023 11:06
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2023
The CVO needs to change the log level dynamically without redeploying itself. The CVO currently uses the package [`klog`](https://github.com/kubernetes/klog) for logging. This package does not provide a simple way of changing the log level dynamically. However, it is possible, and there already exists a function
[`SetLogLevel`](https://github.com/openshift/library-go/blame/8477ec72b72554c01afff4df9c6a90c0e492ea87/pkg/operator/loglevel/util.go#L63-L103) in the [`openshift/library-go`](https://github.com/openshift/library-go) repository to remedy this issue.

#### Hypershift [optional]
Copy link
Author

@Davoska Davoska Nov 1, 2023

Choose a reason for hiding this comment

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

Hello @enxebre, @csrwng, @sjenning 👋

This enhancement proposes to add a log level API change to the ClusterVersion resource.

After the enhancement is merged, the API change is merged, and the implementation is done in the CVO repository, a hosted cluster administrator could set an undesirable log level for its hosted CVO by modifying this new field in the hosted ClusterVersion. This enhancement proposes to fix this by implementing a reconciliation of a fixed value in the below-mentioned section in the HyperShift codebase after the API change is merged and before the implementation in the CVO repository is done.

Is this proposition for the HyperShift use case acceptable?

@Davoska
Copy link
Author

Davoska commented Nov 1, 2023

PTAL, reviewers @LalatenduMohanty @wking @petr-muller

@Davoska
Copy link
Author

Davoska commented Nov 1, 2023

PTAL, API approver @deads2k


```go
// +kubebuilder:validation:Enum="";Normal;Debug;Trace;TraceAll
type CVOLogLevel string
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer we use the same types as https://github.com/openshift/api/blob/36ce464529eb357673342c06be5886c5463cfc50/operator/v1/types.go#L92 I do not see any value changing the names when we are doing the exact same thing.

Copy link
Author

Choose a reason for hiding this comment

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

I have made the reasoning more explicit in the new commit, see

The type of the newly created `OperatorLogLevel` field of the CVO **cannot** be of the same type as above mentioned [`LogLevel`](https://github.com/openshift/api/blob/36ce464529eb357673342c06be5886c5463cfc50/operator/v1/types.go#L91-L107), which is defined in the `github.com/openshift/api/operator/v1` package.
Importing the `github.com/openshift/api/operator/v1` package from inside the `github.com/openshift/api/config/v1` package causes import cycles.
To ensure consistency across the operators and to not cause import cycles, this type will be redefined in the
[api/config/v1/types_cluster_version.go](https://github.com/openshift/api/blob/master/config/v1/types_cluster_version.go) file.

I have also added an alternative to the proposed solution, see

* The proposed solution doesn't strictly follow the DRY principle as the `LogLevel` type is copied over to the `github.com/openshift/api/config/v1` package to solve the import cycle. Another solution could be moving the data type `LogLevel` from its package `github.com/openshift/api/operator/v1` to a newly created package or to the `github.com/openshift/api/config/v1` package.
* `github.com/openshift/api/operator/v1` package would include a modified definition for its type `LogLevel` so that no changes are required in other files.
```go
type LogLevel configv1.LogLevel
```
* `github.com/openshift/api/config/v1` package would include the original definition of the `LogLevel`.
* This solution doesn't create any import cycles and doesn't duplicate any code. However, it moves a stable definition of a type corresponding to its package where it's heavily being used to another less logically corresponding package only due to an importing issue.

Copy link
Contributor

openshift-ci bot commented Nov 20, 2023

@Davoska: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.


## Alternatives

* The proposed solution doesn't strictly follow the DRY principle as the `LogLevel` type is copied over to the `github.com/openshift/api/config/v1` package to solve the import cycle. Another solution could be moving the data type `LogLevel` from its package `github.com/openshift/api/operator/v1` to a newly created package or to the `github.com/openshift/api/config/v1` package.
Copy link
Author

Choose a reason for hiding this comment

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

I am a little bit impartial regarding what option is better. Any feedback or opinions are welcomed 👍

// Defaults to "Normal".
// +optional
// +kubebuilder:default=Normal
OperatorLogLevel CVOLogLevel `json:"operatorLogLevel,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry if I come late to the party but I wonder whether we should future-proof a bit and carve out a substruct that clearly configures CVO (as opposed to "configures cluster"), to have a nested place for future CVO knobs?

Something like:

type ClusterVersionSpec struct {
	...
        OperatorOptions CVOOptions 
}
type CVOOptions struct {
	// operatorLogLevel controls the logging level of the cluster version operator.
	OperatorLogLevel CVOLogLevel `json:"operatorLogLevel,omitempty"`
}

@openshift-bot
Copy link

Inactive enhancement proposals go stale after 28d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

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

If this proposal 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 Dec 27, 2023
@openshift-bot
Copy link

Stale enhancement proposals rot after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

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

If this proposal 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 Jan 3, 2024
@petr-muller
Copy link
Member

/remove-lifecycle rotten

@openshift-ci openshift-ci bot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jan 10, 2024

The Cluster Version Operator (CVO) logs a lot of useful information. However, there is currently no way to easily change the log level for the CVO.

It would be useful to provide functionality for the cluster administrators and OpenShift engineers to easily modify the log level to a desired level.
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like the sort of thing other cluster operators might benefit from, too. Do they already have their own implementation for managing the log level?

@dhellmann
Copy link
Contributor

#1555 is changing the enhancement template in a way that will cause the header check in the linter job to fail for existing PRs. If this PR is merged within the development period for 4.16 you may override the linter if the only failures are caused by issues with the headers (please make sure the markdown formatting is correct). If this PR is not merged before 4.16 development closes, please update the enhancement to conform to the new template.

@openshift-bot
Copy link

Inactive enhancement proposals go stale after 28d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

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

If this proposal 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 Mar 13, 2024
@openshift-bot
Copy link

Stale enhancement proposals rot after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

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

If this proposal 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 Mar 20, 2024
@openshift-bot
Copy link

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

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

/close

@openshift-ci openshift-ci bot closed this Mar 28, 2024
Copy link
Contributor

openshift-ci bot commented Mar 28, 2024

@openshift-bot: Closed this PR.

In response to this:

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Reopen the proposal by commenting /reopen.
Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Exclude this proposal 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.

@dhellmann
Copy link
Contributor

dhellmann commented Mar 29, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

5 similar comments
@dhellmann
Copy link
Contributor

dhellmann commented Apr 5, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

@dhellmann
Copy link
Contributor

dhellmann commented Apr 5, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

@dhellmann
Copy link
Contributor

dhellmann commented Apr 12, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

@dhellmann
Copy link
Contributor

dhellmann commented Apr 19, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

@dhellmann
Copy link
Contributor

dhellmann commented Apr 26, 2024

(automated message) This pull request is closed with lifecycle/rotten. The associated Jira ticket, OTA-1029, has status "Code Review". Should the PR be reopened, updated, and merged? If not, removing the lifecycle/rotten label will tell this bot to ignore it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. 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.

None yet

7 participants