Add ClusterUID field to RuntimeAlertK8sDetails#602
Merged
Conversation
Add a new ClusterUID field to the RuntimeAlertK8sDetails struct to store the UID of the kube-system namespace, which provides a stable cluster identifier. This field will be populated by the node-agent and private-node-agent at startup by fetching the kube-system namespace UID from the Kubernetes API. The field is optional and uses omitempty to maintain backward compatibility with existing consumers of the API. Signed-off-by: Ben <ben@armosec.io>
📝 WalkthroughWalkthroughA new public field Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
slashben
added a commit
to kubescape/node-agent
that referenced
this pull request
Feb 1, 2026
This change adds support for enriching runtime alerts with a stable cluster identifier (ClusterUID) based on the kube-system namespace UID. Changes: - Update armoapi-go dependency to v0.0.672 (includes ClusterUID field) - Add GetClusterUID utility function to fetch kube-system namespace UID - Update HTTPExporter to accept and store clusterUID - Update InitExporters to accept clusterUID parameter - Populate ClusterUID in createRuleAlert and createMalwareAlert - Fetch ClusterUID at agent startup in main.go The ClusterUID is fetched once at startup and passed to all exporters. If the kube-system namespace cannot be accessed (e.g., RBAC restrictions), a warning is logged and the field remains empty, allowing the agent to continue operating normally. Related PR: armosec/armoapi-go#602 Signed-off-by: Ben <ben@armosec.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
ClusterUIDfield to theRuntimeAlertK8sDetailsstruct to enable runtime alerts to include a stable cluster identifier based on the kube-system namespace UID.Changes
ClusterUID stringfield toRuntimeAlertK8sDetailsstruct inarmotypes/runtimeincidents.goomitemptyto maintain backward compatibilityMotivation
This field provides a stable, unique identifier for Kubernetes clusters that can be used to:
Implementation Details
The ClusterUID will be fetched by agents at startup by reading the UID of the
kube-systemnamespace via the Kubernetes API. If the namespace cannot be accessed (e.g., due to RBAC restrictions or running on non-Kubernetes hosts), the field will be left empty.Next Steps
After this PR is merged and a new version is released:
Testing
No behavior changes in this PR - only a new optional field is added. Existing tests continue to pass.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.