[Issue - 10441] Improved k8s cluster discovery#5291
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
we need to hold off merging this PR. I believe this change conflicts with how we build platformids when scanning manifests. I need to take a look how to set this up such that it works for both manifests and clusters |
|
This PR makes sure we have more stable platform IDs for k8s assets. With the previous implementation different platform IDs were generating for all workloads depending whether the scan would discover the cluster asset or not. With this change the platform ids should always be the same: When scanning a cluster: <-- this is different from the current implementation
When scanning manifests: <-- this has not changed
|
czunker
left a comment
There was a problem hiding this comment.
I can currently only think of two one cases where this might not work:
- The user has no privileges to access kube-system. Are we still able to get the uuid from the namespace list?
Did I read this correctly, that we do not discover the cluster when a namespace filter is set?
| inv, err := resources.Discover(pluginRuntime, cnquery.Features{}) | ||
| require.NoError(t, err) | ||
| require.Len(t, inv.Spec.Assets, 2) | ||
| require.Len(t, inv.Spec.Assets, 3) |
There was a problem hiding this comment.
According to the comments in this PR, the manifest part didn't change. Why did this increase?
There was a problem hiding this comment.
we discover the namespaces now. Before we skipped over them which was actually a bug. We turned on namespace discovery for api scans, but not for manifests
|
I have read the Mondoo CLA Document and I hereby sign the CLA |
|
@czunker we cannot do anything about the case when a user has no access to list cluster namespaces. The only solution is to explicitly state which namespaces you want to scan, e.g. |
czunker
left a comment
There was a problem hiding this comment.
LGTM
Thanks @Chichichkin @imilchev
…Namespaces discovery instead. NewNamespacePlatformId also refactored in order to generate correct PlatformID. Some small changes to address redundancy in provider.go Signed-off-by: Aleksandr Chagochkin <chagochkin@mondoo.com>
Signed-off-by: Ivan Milchev <ivan@mondoo.com>
Signed-off-by: Ivan Milchev <ivan@mondoo.com>
bc4b7ee to
d367408
Compare
🚀 Overview
Addressing the issue 👉 #10441
🎯 User-facing change?
✅ The new way of building the platform IDs relies solely on the namespaces now.
🟢 n/a