-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add manager type to nodemanager process node flow #3630
Conversation
@@ -98,6 +98,7 @@ func gatherInfoForNode(msg message.ChefRun) (*manager.NodeMetadata, error) { | |||
EndTime: timestamp, | |||
Status: status, | |||
}, | |||
ManagerType: "chef", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have the managed type of "Chef" does that include Effortless/Chef Solo Runs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now this code is just putting "chef" on anything coming through the ingest service -- so ya those would also get "chef" as the manager
I have to think about this more but this test is ensuring we are only filtering on nodes with an empty Manager. Where before an empty manager meant it was a client runs node.
|
Here is the code where we only filter nodes that have an empty manager.
|
I just confirmed locally that this does break the project filtering on the nodemanager APIs for client run nodes. I wonder why the cypress tests did not fail 🤷 |
oof im glad you thought of testing that! we can extend the code to say empty of 'chef' manager..but :( that the test didn't fail |
i also need to update the ui call for scan job nodes, bc right now it is excluding nodes with empty string manager, which means all the chef nodes would show up there without further changes |
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
Signed-off-by: Victoria Jeffrey <[email protected]>
@@ -316,7 +316,7 @@ func (srv *Server) validateNodeUpdate(ctx context.Context, in *nodes.Node) error | |||
switch node.Manager { | |||
case "aws-api", "azure-api", "gcp-api": | |||
return &errorutils.InvalidError{Msg: fmt.Sprintf("invalid option. unable to update %s node", in.Manager)} | |||
case "": | |||
case "", "chef": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ensures we cannot update the name or tags of an ingested node
@@ -690,7 +690,7 @@ func validateNodeFilters(filters []*common.Filter) error { | |||
func isValidNodeManagerType(item string) bool { | |||
switch item { | |||
// empty string covers legacy nodes (nodes created before we started associating all manual nodes with "automate" as a manager and nodes brought over from a1) | |||
case "aws-ec2", "aws-api", "azure-api", "azure-vm", "automate", "": | |||
case "aws-ec2", "aws-api", "azure-api", "azure-vm", "automate", "gcp-api", "chef": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should've added gcp-api a long time ago!
@@ -127,20 +127,12 @@ func (db *DB) ProcessIncomingNode(node *manager.NodeMetadata) error { | |||
return errors.Wrap(err, "ProcessIncomingNode unable to marshal projects data") | |||
} | |||
|
|||
var mgrType string | |||
if node.ManagerId != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that the type is included in the report, we dont have to look up the type in the db
@@ -521,6 +521,7 @@ func (t *InspecJobTask) reportIt(ctx context.Context, job *types.InspecJob, cont | |||
report.SourceRegion = job.TargetConfig.TargetBaseConfig.Region | |||
report.SourceAccountId = job.SourceAccountID | |||
report.AutomateManagerId = job.ManagerID | |||
report.AutomateManagerType = job.ManagerType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where we stick the manager type on the report
@@ -90,6 +91,10 @@ func gatherInfoForNode(in message.Compliance) (*manager.NodeMetadata, error) { | |||
tags = append(tags, &common.Kv{Key: "environment", Value: in.Report.GetEnvironment()}) | |||
} | |||
|
|||
mgrType := in.Report.GetAutomateManagerType() | |||
if in.Report.GetSourceFqdn() != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get the type on the report, but if the sourcefqdn is not empty string then we know it's managed by chef
closing this til i can get back to it |
🔩 Description: What code changed, and why?
this change adds the manager type to the nodemanager process node flow, meaning
i also added a format tags bit. we have a troublesome tag example in the chef-load codebase used for testing, and it seems we fail to list nodes when this troublesome tag exists in the db, because we choke on the json (the tag value in question is
Dot.Comma,Big;\"Trouble
)⛓️ Related Resources
#3515
👍 Definition of Done
manager type is on process node message
nodes managed by chef are labelled as such
👟 How to Build and Test the Change
rebuild compliance, ingest, nodemanager
load some nodes (chef_load_nodes, load_compliance_reports, chef_load_compliance_nodes)
see the manager type for the nodes is correct!
✅ Checklist
Aha! Link: https://chef.aha.io/features/SH-1835