Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Suppress deprecation warnings #3558

Merged
merged 1 commit into from
Nov 1, 2021
Merged

Suppress deprecation warnings #3558

merged 1 commit into from
Nov 1, 2021

Conversation

dimbleby
Copy link
Contributor

Fixes #3554

Fixes #3554

Signed-off-by: David Hotham <david.hotham@metaswitch.com>
@kingdonb
Copy link
Member

Thank you! This looks like what we discussed at the dev meeting. Let me test it out now that I am done traveling for a while.

@kingdonb
Copy link
Member

We are going to get some feedback from @squaremo before this can be merged, thanks for your patience.

@squaremo
Copy link
Member

I had to remind myself how this stuff worked :-S It checks out though, with the (very reasonable, and possibly already verified?) assumption that the warnings are coming from trying to list resources during garbage collection. This happens in

func (c *Cluster) listAllowedResources(
and it uses the dynamic client. This is the only use of the dynamic client so far as I can tell.

So this is indeed an incisive fix -- nicely done @dimbleby and @kingdonb.

@kingdonb kingdonb self-requested a review October 29, 2021 19:52
@kingdonb
Copy link
Member

kingdonb commented Nov 1, 2021

I would like to understand why this one deprecation warning still comes through, when all the others are suppressed:

W1101 19:44:22.571730       7 warnings.go:70] batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use batch/v1 CronJob

I think these errors must be emitted from the getWorkload method on *cronJobKind, which calls the batch/v1beta1 CronJob client explicitly, (and that would need to be addressed some day, if Flux v1 should actually live long enough to see Kubernetes v1.25, but that'll still be quite some time down the road...) :

cronJob, err := c.client.BatchV1beta1().CronJobs(namespace).Get(context.TODO(), name, meta_v1.GetOptions{})

This happens only because Flux understands CronJob as a workload type that can be subject to automated upgrades.

These are probably the particular "real important deprecation warnings" that I was actually looking to see, so they are indeed preserved by this change, and the overall volume of deprecation warning spam has gone down to practically zero as desired. I'm satisfied after testing the change and will approve this, then merge it to create a new release this week. 👍

Thanks all, for the help you've provided to resolve this issue!

Copy link
Member

@kingdonb kingdonb left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@kingdonb kingdonb merged commit 5c6a964 into fluxcd:master Nov 1, 2021
@kingdonb kingdonb added this to the 1.24.2 milestone Nov 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flux produces warning logs about deprecated API versions for kubernetes objects that do not exist
3 participants