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

crd: Fix type mismatch warning #1979

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Conversation

tpapagian
Copy link
Member

When we update a tracing policy (i.e. apply a policy with the same name as an existing policy), we check if the new tracing policy has the same type (i.e. TracingPolicy or TracingPolicyNamespaced) as the old one.

Now we print the warning about type mismatch even if the types are the same. This patch fixes that by returing right after the actual update.

Do not print a warning during tracing policy updates when both old and new tracing policies have the same type.

@tpapagian tpapagian added the release-note/misc This PR makes changes that have no direct user impact. label Jan 15, 2024
Copy link

netlify bot commented Jan 15, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 2fd5e5c
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/65a529fe0d8484000836a00a
😎 Deploy Preview https://deploy-preview-1979--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tpapagian tpapagian marked this pull request as ready for review January 15, 2024 13:46
@tpapagian tpapagian requested a review from a team as a code owner January 15, 2024 13:46
@tpapagian tpapagian requested a review from olsajiri January 15, 2024 13:46
@@ -143,6 +141,7 @@ func updateTracingPolicy(ctx context.Context, log logrus.FieldLogger, s *sensors
"new": newTp.TpName(),
}).Info("updating tracing policy")
update(oldTp, newTp)
return
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm rather than putting more returns here maybe we could have update return an error and then if (err) ... print the warning?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this may be a cleaner solution there. I will try to make that better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated that a bit. The error is not due to the update but on the different types of tracing policies. I believe it is cleaner now.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah that is much clearer to me what the issue was. thanks.

When we update a tracing policy (i.e. apply a policy with the same name
as an existing policy), we check if the new tracing policy has the same
type (i.e. TracingPolicy or TracingPolicyNamespaced) as the old one.

Now we print the warning about type mismatch even if the types are the
same. This patch fixes that by returing right after the actual update.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
@tpapagian tpapagian force-pushed the pr/apapag/fix_crd_type_mismatch branch from 2fd5e5c to e0b1dce Compare January 17, 2024 08:23
@jrfastab jrfastab merged commit c20f335 into main Jan 17, 2024
31 checks passed
@jrfastab jrfastab deleted the pr/apapag/fix_crd_type_mismatch branch January 17, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants