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

Do not trigger a watch of pods for status owner ref #754

Merged
merged 7 commits into from
Jul 28, 2020

Conversation

maxsmythe
Copy link
Contributor

@maxsmythe maxsmythe commented Jul 25, 2020

Signed-off-by: Max Smythe smythe@google.com

What this PR does / why we need it:

This PR should avoid triggering a watch of all pods in the cluster when getting the self-referenced pod.

This also re-adds the ability to run Gatekeeper outside of a Kubernetes cluster for testing purposes, per #738

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #742

Special notes for your reviewer:

Signed-off-by: Max Smythe <smythe@google.com>
Signed-off-by: Max Smythe <smythe@google.com>
Signed-off-by: Max Smythe <smythe@google.com>
@grosser
Copy link
Contributor

grosser commented Jul 27, 2020

that did the trick!

Screen Shot 2020-07-26 at 5 00 41 PM

first bump is redeploy of previous version and next bump is deploy of 244b191 from this pr 🎉

@@ -317,14 +321,28 @@ func (r *ReconcileConstraint) Reconcile(request reconcile.Request) (reconcile.Re
}

func (r *ReconcileConstraint) defaultGetPod() (*corev1.Pod, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be reused between the 2 controllers without copy-pasting it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unified the two functions, PTAL.

Signed-off-by: Max Smythe <smythe@google.com>
Signed-off-by: Max Smythe <smythe@google.com>
Copy link
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

@maxsmythe maxsmythe merged commit e072cf7 into open-policy-agent:master Jul 28, 2020
Divya063 pushed a commit to Divya063/gatekeeper that referenced this pull request Jul 28, 2020
…t#754)

* Do not trigger a watch of pods for status owner ref

Signed-off-by: Max Smythe <smythe@google.com>

* Run goimports

Signed-off-by: Max Smythe <smythe@google.com>

* Do not use cache for retrieving pod

Signed-off-by: Max Smythe <smythe@google.com>

* Unify getPod and add flag to toggle enabling fake get pod

Signed-off-by: Max Smythe <smythe@google.com>

* Fix lint errors

Signed-off-by: Max Smythe <smythe@google.com>

* Fix nil pointer error

Signed-off-by: Max Smythe <smythe@google.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.

Memory usage doubled in recent relese
3 participants