mirror of
https://github.com/kubescape/kubescape.git
synced 2026-03-02 01:30:19 +00:00
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package hostsensorutils
|
|
|
|
import (
|
|
"github.com/armosec/k8s-interface/k8sinterface"
|
|
"github.com/armosec/opa-utils/reporthandling/apis"
|
|
)
|
|
|
|
var (
|
|
KubeletConfiguration = "KubeletConfiguration"
|
|
OsReleaseFile = "OsReleaseFile"
|
|
KernelVersion = "KernelVersion"
|
|
LinuxSecurityHardeningStatus = "LinuxSecurityHardeningStatus"
|
|
OpenPortsList = "OpenPortsList"
|
|
LinuxKernelVariables = "LinuxKernelVariables"
|
|
KubeletCommandLine = "KubeletCommandLine"
|
|
|
|
MapResourceToApiGroup = map[string]string{
|
|
KubeletConfiguration: "hostdata.kubescape.cloud/v1beta0",
|
|
OsReleaseFile: "hostdata.kubescape.cloud/v1beta0/",
|
|
KubeletCommandLine: "hostdata.kubescape.cloud/v1beta0/",
|
|
KernelVersion: "hostdata.kubescape.cloud/v1beta0/",
|
|
LinuxSecurityHardeningStatus: "hostdata.kubescape.cloud/v1beta0/",
|
|
OpenPortsList: "hostdata.kubescape.cloud/v1beta0/",
|
|
LinuxKernelVariables: "hostdata.kubescape.cloud/v1beta0/",
|
|
}
|
|
)
|
|
|
|
func addInfoToMap(resource string, infoMap map[string]apis.StatusInfo, err error) {
|
|
group, version := k8sinterface.SplitApiVersion(MapResourceToApiGroup[resource])
|
|
r := k8sinterface.JoinResourceTriplets(group, version, resource)
|
|
infoMap[r] = apis.StatusInfo{
|
|
InnerStatus: apis.StatusSkipped,
|
|
InnerInfo: err.Error(),
|
|
}
|
|
}
|