-
Notifications
You must be signed in to change notification settings - Fork 276
Delete Certificate for an Envoy for a Pod that was Terminated #1956
Delete Certificate for an Envoy for a Pod that was Terminated #1956
Conversation
ref #1719 |
2848660
to
3fce8c8
Compare
cc513be
to
f9b0d3c
Compare
Codecov Report
@@ Coverage Diff @@
## main #1956 +/- ##
==========================================
+ Coverage 57.30% 57.37% +0.07%
==========================================
Files 139 140 +1
Lines 5692 5739 +47
==========================================
+ Hits 3262 3293 +31
- Misses 2427 2443 +16
Partials 3 3
Continue to review full report at Codecov.
|
bbaebee
to
a8aafeb
Compare
c568549
to
0ed5cbc
Compare
0ed5cbc
to
85787b4
Compare
|
||
var errEventNotHandled = errors.New("event not handled") | ||
|
||
func (mc *MeshCatalog) releaseCertificate(ann announcements.Announcement) error { |
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.
I know the function is not exported but would you mind adding a comment for this function anyway?
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.
Good idea to document these! Added a docstring here!
|
||
func (mc *MeshCatalog) releaseCertificate(ann announcements.Announcement) error { | ||
whatWeGot := ann.Type | ||
whatWeCanHandle := announcements.PodDeleted |
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.
love these variable names
90e7993
The goal of this PR is to remove certificates for Pods that have been terminated. Without this we would continue to issue certificates and keep them in cache for the life of the OSM Controller pod.
This PR introduces 2 new functions (within Mesh Catalog):
releaseCertificate()
updateRelatedProxies()
These functions will be evaluated (sequentially) when an
Announcement
of typePodDeleted
arrives.To help find the certificate for a given Pod (identified by its Kubernetes UID), this PR introduces
podUIDToCN
into Mesh Catalog. This is a thread safe map, which will be populated with Pod UID to Certificate mapping.This PR will fix #1719
After this I am going to hand-off the work around refining and rearchitecting the OSM eventing to @eduser25 and @shashankram who will continue to hack on the signaling mechanism.
I hope that the changes I made here would be easily translated to whatever system we come up with to handle these events in the future. I deliberately did not go into future-proofing this - we could add the entire Kubernetes object in the Announcement or launch the handlers in goroutines to unblock. I'm leaving this for another iteration (and if at all necessary).
Affected area:
Please answer the following questions with yes/no.