Skip to content

feat: implement expansion template pod status#2598

Merged
davis-haba merged 22 commits into
open-policy-agent:masterfrom
davis-haba:expansion-status
Apr 5, 2023
Merged

feat: implement expansion template pod status#2598
davis-haba merged 22 commits into
open-policy-agent:masterfrom
davis-haba:expansion-status

Conversation

@davis-haba
Copy link
Copy Markdown
Contributor

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

Implements byPod status for ExpansionTemplates.

Fixes: #2302

@davis-haba davis-haba changed the title implement expansion template pod status [feat] implement expansion template pod status Feb 23, 2023
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.

Directionally, this is looking really good. Have a few nit comments (and it looks like this may still be WIP)

Comment thread apis/addtoscheme_status_v1alpha1.go Outdated
Comment thread apis/expansion/unversioned/expansiontemplate_types.go Outdated
Comment thread apis/expansion/v1alpha1/expansiontemplate_types.go Outdated
Comment thread apis/status/v1alpha1/expansiontemplatepodstatus_types.go Outdated
Comment thread cmd/gator/test/test.go Outdated
Comment thread pkg/controller/expansionstatus/expansionstatus_controller.go Outdated
Comment thread pkg/expansion/system.go Outdated
Comment thread pkg/readiness/ready_tracker.go Outdated
@JaydipGabani
Copy link
Copy Markdown
Contributor

@davis-haba I'd really appreciate if you can explain what is the need behind this PR. As I have not looked at how expansion templates work I do not have enough background. So I am a little confused and curious.

@maxsmythe
Copy link
Copy Markdown
Contributor

Davis can probably give better context, but it's similar to the reasoning behind constraint/constrainttemplate/mutator statuses (make the ingestion state of a config across the fleet of pods visible)

@davis-haba davis-haba changed the title [feat] implement expansion template pod status feat: implement expansion template pod status Mar 3, 2023
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 4, 2023

Codecov Report

Patch coverage: 39.52% and project coverage change: -0.42 ⚠️

Comparison is base (143e8cf) 53.27% compared to head (c03e842) 52.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2598      +/-   ##
==========================================
- Coverage   53.27%   52.85%   -0.42%     
==========================================
  Files         120      123       +3     
  Lines       10594    10926     +332     
==========================================
+ Hits         5644     5775     +131     
- Misses       4515     4695     +180     
- Partials      435      456      +21     
Flag Coverage Δ
unittests 52.85% <39.52%> (-0.42%) ⬇️

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

Impacted Files Coverage Δ
apis/status/v1beta1/zz_generated.deepcopy.go 0.00% <0.00%> (ø)
pkg/webhook/policy.go 37.76% <0.00%> (-1.32%) ⬇️
...status/v1beta1/expansiontemplatepodstatus_types.go 8.69% <8.69%> (ø)
apis/status/v1beta1/util.go 76.31% <25.00%> (ø)
pkg/controller/expansion/stats_reporter.go 54.05% <45.83%> (ø)
pkg/controller/expansion/expansion_controller.go 55.47% <61.22%> (ø)
pkg/readiness/ready_tracker.go 69.19% <65.30%> (-0.46%) ⬇️
apis/status/v1beta1/constraintpodstatus_types.go 80.64% <100.00%> (ø)
...tatus/v1beta1/constrainttemplatepodstatus_types.go 73.91% <100.00%> (ø)
apis/status/v1beta1/mutatorpodstatus_types.go 80.00% <100.00%> (ø)
... and 2 more

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@davis-haba
Copy link
Copy Markdown
Contributor Author

davis-haba commented Mar 10, 2023

@JaydipGabani

@davis-haba I'd really appreciate if you can explain what is the need behind this PR. As I have not looked at how expansion templates work I do not have enough background. So I am a little confused and curious.

The byPod status, present on Constraints, Mutators, and now ExpansionTemplates, is designed to report the status of each resource as observed by each Pod.

For example, suppose you have 3 validation webhook replicas. You might be interested in guaranteeing that all 3 of the replicas have all of the necessary ExpansionTemplates or Constraints registered. If only 2/3 of them have a config registered, this could lead to under-enforcement or nondeterministic behavior.

The design doc has much more detail if you're interested.

Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Comment thread apis/expansion/unversioned/expansiontemplate_types.go Outdated
Comment thread test/bats/test.bats Outdated
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.

Code LGTM barring a nit. Waiting on testing TODOs otherwise.

Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Comment thread cmd/build/helmify/kustomization.yaml
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
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

@maxsmythe maxsmythe requested review from ritazh and sozercan March 24, 2023 21:22
Comment thread apis/expansion/unversioned/expansiontemplate_types.go Outdated
Comment thread apis/status/v1beta1/expansiontemplatepodstatus_types.go Outdated
Comment thread apis/status/v1beta1/expansiontemplatepodstatus_types.go Outdated
davis-haba and others added 3 commits March 27, 2023 13:57
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
@davis-haba
Copy link
Copy Markdown
Contributor Author

@ritazh
I accepted your comment suggestions (thanks btw).

Was there anything else to address?

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

Comment thread apis/expansion/v1alpha1/expansiontemplate_types.go Outdated
Comment thread config/crd/bases/expansion.gatekeeper.sh_expansiontemplate.yaml Outdated
davis-haba and others added 3 commits April 4, 2023 17:03
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
Signed-off-by: davis-haba <davishaba@google.com>
@davis-haba davis-haba merged commit 7c519b4 into open-policy-agent:master Apr 5, 2023
salaxander pushed a commit to salaxander/gatekeeper that referenced this pull request Apr 5, 2023
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Xander Grzywinski <xandergr@microsoft.com>
salaxander pushed a commit to salaxander/gatekeeper that referenced this pull request Apr 5, 2023
Signed-off-by: Davis Haba <52938648+davis-haba@users.noreply.github.com>
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.

Add status to ExpansionTemplates

5 participants