Skip to content
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

include tags on nodemanager process node #253

Closed
wants to merge 1 commit into from
Closed
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package chef.automate.domain.compliance.ingest.events.compliance;
option go_package = "github.com/chef/automate/components/compliance-service/ingest/events/compliance";

import "components/compliance-service/ingest/events/inspec/inspec.proto";
import "components/compliance-service/api/common/common.proto";

message Report {
// inspec full json report fields
Expand Down Expand Up @@ -33,4 +34,5 @@ message Report {
repeated string chef_tags = 36;
string ipaddress = 37;
string fqdn = 38;
repeated chef.automate.domain.compliance.api.common.Kv tags = 39;
}
1 change: 1 addition & 0 deletions components/compliance-service/ingest/server/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (s *ComplianceIngestServer) ProcessComplianceReport(ctx context.Context, in
SourceId: in.SourceId,
SourceRegion: in.SourceRegion,
SourceAccountId: in.SourceAccountId,
Tags: in.Tags,
})
if err != nil {
logrus.Errorf("ProcessComplianceReport unable to send node info to manager: %s", err.Error())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ func (r *Resolver) handleManagerNodes(ctx context.Context, m *manager.NodeManage
SourceID: node.Id,
SourceAccountID: m.AccountId,
MachineIdentifier: node.MachineIdentifier,
Tags: node.Tags,
}
jobArray = append(jobArray, &fullJob)
}
Expand Down Expand Up @@ -650,6 +651,7 @@ func (r *Resolver) resolveStaticJobInfo(job *jobs.Job, node *nodes.Node, tc insp
Retries: job.Retries,
TargetConfig: tc,
Profiles: job.Profiles,
Tags: node.Tags,
}
return agentJob
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (r *Runner) reportIt(ctx context.Context, job *types.InspecJob, content []b
} else {
report.Fqdn = job.TargetConfig.TargetBaseConfig.Hostname
}
report.Tags = job.Tags
logrus.Debugf("hand-over report to ingest service")

_, err := r.ingestClient.ProcessComplianceReport(ctx, &report)
Expand Down
2 changes: 2 additions & 0 deletions components/compliance-service/inspec-agent/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"time"

"github.com/chef/automate/components/compliance-service/api/common"
"github.com/chef/automate/components/compliance-service/inspec"
)

Expand Down Expand Up @@ -67,6 +68,7 @@ type InspecJob struct {
ProfilesOwner string `json:"profiles_owner,omitempty"`
InternalProfiles []string `json:"internal_profiles,omitempty"`
MachineIdentifier string `json:"machine_identifier,omitempty"`
Tags []*common.Kv `json:"kv,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be called tags instead?

`json:"tags,omitempty"`

Copy link
Author

Choose a reason for hiding this comment

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

oh ya it totally should!

}

// WorkerStats describe the state of all inspec job workers to be used for analysis purposes
Expand Down
Loading