Make osquery-perf aware of kubequery so that hosts are not reported as such erroneously (#7949)

This commit is contained in:
Martin Angers
2022-09-26 15:39:39 -04:00
committed by GitHub
parent b9927eade4
commit 1fd6844bb0
+7
View File
@@ -786,6 +786,7 @@ func (a *agent) processQuery(name, query string) (handled bool, results []map[st
hostDetailQueryPrefix = "fleet_detail_query_"
)
statusOK := fleet.StatusOK
statusNotOK := fleet.OsqueryStatus(1)
switch {
case strings.HasPrefix(name, hostPolicyQueryPrefix):
@@ -864,6 +865,12 @@ func (a *agent) processQuery(name, query string) (handled bool, results []map[st
results = a.diskSpace()
}
return true, results, &ss
case name == hostDetailQueryPrefix+"kubequery_info" && a.os != "kubequery":
// Real osquery running on hosts would return no results if it was not
// running kubequery (due to discovery query). Returning true here so that
// the caller knows it is handled, will not try to return lorem-ipsum-style
// results.
return true, nil, &statusNotOK
default:
// Look for results in the template file.
if t := a.templates.Lookup(name); t == nil {