Skip to content

fix: index readiness trackers by GK (not GVK)#2635

Merged
ritazh merged 2 commits into
open-policy-agent:masterfrom
davis-haba:ai-tracker-fix
Mar 27, 2023
Merged

fix: index readiness trackers by GK (not GVK)#2635
ritazh merged 2 commits into
open-policy-agent:masterfrom
davis-haba:ai-tracker-fix

Conversation

@davis-haba
Copy link
Copy Markdown
Contributor

Signed-off-by: davis-haba davishaba@google.com

What this PR does / why we need it:

Readiness tracking for the AssignImage mutator was not working properly because the generic Mutation controller was hard coded to use version v1 to look up its tracker, however AssignImage is still in v1alpha1.

Indexing trackers by version is unnecessary. The same tracker can be used to track resources of the same GK but different versions, with no impact to the current behavior.

Fixes #2634

Why not change objKey struct to store GK instead of GVK? This presents some complications. objKey is not strictly being used as a key, but also as a data store to denote a list of GVK's to watch. These use cases would have to be decoupled, which is a much more significant refactor than the change proposed here.

Signed-off-by: davis-haba <davishaba@google.com>
@davis-haba davis-haba requested a review from maxsmythe March 23, 2023 00:59
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 23, 2023

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 53.29%. Comparing base (30eaf1b) to head (e442ff1).
Report is 634 commits behind head on master.

Files with missing lines Patch % Lines
pkg/readiness/ready_tracker.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2635      +/-   ##
==========================================
+ Coverage   53.19%   53.29%   +0.10%     
==========================================
  Files         120      120              
  Lines       10594    10594              
==========================================
+ Hits         5635     5646      +11     
+ Misses       4522     4513       -9     
+ Partials      437      435       -2     
Flag Coverage Δ
unittests 53.29% <85.71%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for fixing this!

@maxsmythe maxsmythe requested review from ritazh and sozercan March 24, 2023 01:55
@sozercan sozercan added this to the v3.12.0 RC milestone Mar 27, 2023
Copy link
Copy Markdown
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for the PR!

@ritazh ritazh merged commit 73d6a17 into open-policy-agent:master Mar 27, 2023
davis-haba added a commit to davis-haba/gatekeeper that referenced this pull request Mar 31, 2023
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
salaxander pushed a commit to salaxander/gatekeeper that referenced this pull request Apr 5, 2023
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Xander Grzywinski <xandergr@microsoft.com>
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.

Readiness tracker does not acknowledge AssignImage if resource exists prior to control plane bootstrapping

5 participants