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

Set log.Default's output to io.Discard #1215

Merged

Conversation

ulucinar
Copy link
Collaborator

Description of your changes

Fixes #974
Fixes #854

This PR sets a default io.Discard logger for the controller-runtime if debug logging is not enabled. If debug logging is enabled, then the controller-runtime uses a debug mode zap logger as usual.

It also sets the log.Default's output to io.Discard. According to our experiments with a VPC.ec2 and a Cluster.eks, this prevents the noisy logs from the underlying Terraform provider. We still need to check for direct log messages via the fmt variants, such as fmt.Println.

In a further iteration, we will also consider making the underlying provider's logs available in a structured format.

This PR also switches to the standard-runners branch of upbound/uptest because the larger runners are not available in the crossplane-contrib organization.

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested manually with VPC.ec2 & Cluster.eks example manifests. The Cluster.eks has dependencies from the ec2 & iam API groups.

if debug logging is not enabled.

- Set log.Default's output to io.Discard.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
@ulucinar
Copy link
Collaborator Author

/test-examples="examples/ec2/vpc.yaml"

Copy link
Collaborator

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @ulucinar LGTM!

@ulucinar
Copy link
Collaborator Author

The linter job is expected to fail on this branch. And @turkenf has successfully ran make lint on his local machine for this PR.

The failure of the publish-artifacts is also expected on the standard hosted runners. That job has been covered by running a successful uptest here.

@ulucinar ulucinar merged commit 7b18c59 into crossplane-contrib:release-0.47 Mar 14, 2024
8 of 10 checks passed
@ulucinar ulucinar deleted the release-0.47-fix-logs branch March 14, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants