-
Notifications
You must be signed in to change notification settings - Fork 345
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
Set OwnerReference on Plugin resources #845
Conversation
5f73888
to
17b70f1
Compare
Marking this as a draft until I add some tests for |
17b70f1
to
f9a01da
Compare
Codecov Report
@@ Coverage Diff @@
## master #845 +/- ##
==========================================
+ Coverage 46.29% 46.67% +0.38%
==========================================
Files 75 75
Lines 4800 4831 +31
==========================================
+ Hits 2222 2255 +33
Misses 2448 2448
+ Partials 130 128 -2
Continue to review full report at Codecov.
|
pkg/plugin/aggregation/update.go
Outdated
func GetAggregatorPodName(client kubernetes.Interface, namespace string) (string, error) { | ||
ap, err := GetAggregatorPod(client, namespace) | ||
|
||
if _, ok := err.(NoPodWithLabelError); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: when doing multi-step error checking like this I tend to prefer a switch statement so it is a single block and the if err != nil
section doesn't drift away from the call generating the error.
if err != nil {
switch err.(type) {
case * NoPodWithLabelError:
fmt.Println(err.Error())
default:
fmt.Println("ah!?")
}
}
It is one extra layer of indentation, but effectively one unit of error handling. (again, just a nit)
f9a01da
to
4147bfb
Compare
4147bfb
to
f01c97a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just squash to 1 commit and ensure it is signed off.
Good to merge after that.
When creating Pod or DaemonSet resources when running plugins, we didn't mark them as owned by the Sonobuoy aggregator pod. This meant that if the aggregator pod was deleted, the resources created by that pod would be orphaned and would have to be deleted manually. This change sets the OwnerReference for all resources to be the Sonobuoy aggregator pod so that when the aggregator is deleted, all child resources are also deleted. Signed-off-by: Bridget McErlean <[email protected]>
687e71a
to
86d4c6f
Compare
What this PR does / why we need it:
When creating Pod or DaemonSet resources when running plugins, we didn't
mark them as owned by the Sonobuoy aggregator pod. This meant that if
the aggregator pod was deleted, the resources created by that pod would
be orphaned and would have to be deleted manually. This change sets the
OwnerReference for all resources to be the Sonobuoy aggregator pod so
that when the aggregator is deleted, all child resources are also
deleted.
Signed-off-by: Bridget McErlean [email protected]
Which issue(s) this PR fixes
Release note: