-
Notifications
You must be signed in to change notification settings - Fork 3.4k
ClusterMesh: improve validation of remote endpoints and identities #32785
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
ClusterMesh: improve validation of remote endpoints and identities #32785
Conversation
/test |
cc38a40
to
3542a55
Compare
Rebased onto main to fix conflict. |
/test |
Ensure that the unmarshaled data matches the kvstore key it was retrieved from, to ensure consistency and prevent the propagation of corrupted data. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
3542a55
to
dbffa40
Compare
Rebased onto main to fix conflict. |
/test |
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, thanks! 🚀
Just a non-blocking suggestion left inline.
Take the clusterID as parameter, rather than retrieving it from the global option. This allows to reuse the same methods also for clusterIDs different from the one configured locally. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Fix the handling of CiliumIdentity events received from the k8s informer to correctly compare the old and new object, rather than the new one with itself, and propagate modification events as expected. Although identities are never expected to be modified (only added and removed), this ensures that the corresponding warnings are emitted as expected. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
In preparation for the subsequent commits, and to simplify the overall logic, let's remove the difference between Add and Modify events, in favor of a single Upsert one. Identities are never expected to be modified (only added and removed), hence this change is effectively a no-op. However, differentiating add and modify events is typically fragile and can lead to possible inconsistencies (e.g., if incomplete or invalid Add events are filtered out, while subsequent updates are propagated). Additionally, the downstream logic is already designed to correctly handle (and ignore, when appropriate) updates. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
In preparation for the subsequent commit, let's introduce the possibility of configuring additional validators to filter out invalid identity events received from CRD or kvstore. Upsert events marked as invalid are directly skipped. Deletions, instead, are propagated for previously known identities only, to avoid leaving stale identities behind. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Explicitly validate that the identities retrieved from a remote cluster match the expected range based on the corresponding clusterID, to ensure improved consistency and prevent the propagation of corrupted data. Additionally, ensure that said identities include the cluster label matching the expected cluster name for the given cluster. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
dbffa40
to
0a40f14
Compare
/test |
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.
Nice 💯
Explicitly validate that the identities retrieved from a remote cluster match the expected range based on the corresponding clusterID, to ensure improved consistency and prevent the propagation of corrupted data. Additionally, ensure that said identities include the cluster label matching the expected cluster name for the given cluster. Similarly, ensure that the unmarshaled endpoint data matches the kvstore key it was retrieved from.
Please review commit by commit, and refer to the individual descriptions for additional details.
Related: #29602, #32749