Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions central/sensor/service/pipeline/all/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/stackrox/rox/central/sensor/service/pipeline/namespaces"
"github.com/stackrox/rox/central/sensor/service/pipeline/networkflowupdate"
"github.com/stackrox/rox/central/sensor/service/pipeline/networkpolicies"
"github.com/stackrox/rox/central/sensor/service/pipeline/nodeinventory"
"github.com/stackrox/rox/central/sensor/service/pipeline/nodes"
"github.com/stackrox/rox/central/sensor/service/pipeline/nodescansv2"
"github.com/stackrox/rox/central/sensor/service/pipeline/podevents"
"github.com/stackrox/rox/central/sensor/service/pipeline/processindicators"
"github.com/stackrox/rox/central/sensor/service/pipeline/reprocessing"
Expand Down Expand Up @@ -66,7 +66,7 @@ func (s *factoryImpl) PipelineForCluster(ctx context.Context, clusterID string)
auditlogstateupdate.GetPipeline(),
}
if features.RHCOSNodeScanning.Enabled() {
pipelines = append(pipelines, nodescansv2.GetPipeline())
pipelines = append(pipelines, nodeinventory.GetPipeline())
}
if features.ComplianceOperatorCheckResults.Enabled() {
pipelines = append(pipelines,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nodescansv2
package nodeinventory

import (
"context"
Expand Down
2 changes: 2 additions & 0 deletions compliance/collection/nodeinventorizer/fake_nodeinventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
timestamp "github.com/gogo/protobuf/types"
"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/logging"
"github.com/stackrox/rox/pkg/uuid"
)

var (
Expand All @@ -18,6 +19,7 @@ type FakeNodeInventorizer struct {
func (f *FakeNodeInventorizer) Scan(nodeName string) (*storage.NodeInventory, error) {
log.Infof("Generating fake scan result message...")
msg := &storage.NodeInventory{
NodeId: uuid.Nil.String(),
NodeName: nodeName,
ScanTime: timestamp.TimestampNow(),
Components: &storage.NodeInventory_Components{
Expand Down
2 changes: 2 additions & 0 deletions compliance/collection/nodeinventorizer/nodeinventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nodeinventorizer
import (
timestamp "github.com/gogo/protobuf/types"
"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/uuid"
"github.com/stackrox/scanner/database"
scannerV1 "github.com/stackrox/scanner/generated/scanner/api/v1"
"github.com/stackrox/scanner/pkg/analyzer/nodes"
Expand Down Expand Up @@ -41,6 +42,7 @@ func (n *NodeInventoryCollector) Scan(nodeName string) (*storage.NodeInventory,
// which only exists in certified versions. Therefore, no specific notes needed
// if uncertifiedRHEL can be true in the future, we can add Note_CERTIFIED_RHEL_SCAN_UNAVAILABLE
m := &storage.NodeInventory{
NodeId: uuid.Nil.String(),
NodeName: nodeName,
ScanTime: timestamp.TimestampNow(),
Components: protoComponents,
Expand Down
288 changes: 170 additions & 118 deletions generated/storage/node.pb.go

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions proto/storage/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ message NodeScan {
}

message NodeInventory {
string node_name = 1;
google.protobuf.Timestamp scan_time = 2;
string node_id = 1;
string node_name = 2;
google.protobuf.Timestamp scan_time = 3;
Comment on lines +87 to +89
Copy link
Copy Markdown
Contributor Author

@vikin91 vikin91 Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for backwards compatibility here as this object is fully protected by the feature flag and has not been used by our customers before.


// Components represents a subset of the scannerV1.Components proto message containing only fields required for RHCOS node scanning.
// Keep scanner Components and NodeInventory_Components in sync to the degree defined by fuctions:
// func convertAndDedupRHELComponents (in pkg 'nodeinventorizer'), and the respective reverse convertion in pkg 'clairify'.
// We are not using scannerV1.Components here for the following reasons:
// - to avoid conflicts between v1 and scannerV1 APIs when generating the code in central/graphql/resolvers/generated.go
// - to not expose scanner v1 API over stackrox graphql API
Components components = 3 [(gogoproto.moretags) = 'sql:"-"'];
Components components = 4;
message Components {
string namespace = 1;
repeated RHELComponent rhel_components = 2;
Expand All @@ -119,7 +120,7 @@ message NodeInventory {
}

// Note represents scannerV1.Note
repeated Note notes = 4;
repeated Note notes = 5;
enum Note {
OS_CVES_UNAVAILABLE = 0;
OS_CVES_STALE = 1;
Expand Down
11 changes: 8 additions & 3 deletions proto/storage/proto.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10197,16 +10197,21 @@
"fields": [
{
"id": 1,
"name": "node_name",
"name": "node_id",
"type": "string"
},
{
"id": 2,
"name": "node_name",
"type": "string"
},
{
"id": 3,
"name": "scan_time",
"type": "google.protobuf.Timestamp"
},
{
"id": 3,
"id": 4,
"name": "components",
"type": "Components",
"options": [
Expand All @@ -10217,7 +10222,7 @@
]
},
{
"id": 4,
"id": 5,
"name": "notes",
"type": "Note",
"is_repeated": true
Expand Down
2 changes: 2 additions & 0 deletions sensor/common/compliance/node_inventory_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
timestamp "github.com/gogo/protobuf/types"
"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/concurrency"
"github.com/stackrox/rox/pkg/uuid"
"github.com/stretchr/testify/suite"
"go.uber.org/goleak"
)
Expand All @@ -18,6 +19,7 @@ func TestNodeInventoryHandler(t *testing.T) {

func fakeNodeInventory(nodeName string) *storage.NodeInventory {
msg := &storage.NodeInventory{
NodeId: uuid.Nil.String(),
NodeName: nodeName,
ScanTime: timestamp.TimestampNow(),
Components: &storage.NodeInventory_Components{
Expand Down