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

fix grpc ingestor (backward compat) #262

Merged
merged 2 commits into from
Sep 13, 2024
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 cmd/kubehound/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ var (
}
)

// If no arg is provided, run the reHydration of the latest snapshots (stored in KHaaS / S3 Bucket)
func isIngestRemoteDefault() bool {
runID := viper.GetString(config.IngestorRunID)
clusterName := viper.GetString(config.IngestorClusterName)
clusterName := viper.GetString(config.DynamicClusterName)

return runID == "" && clusterName == ""
}
Expand Down
1 change: 0 additions & 1 deletion pkg/config/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const (
CollectorNonInteractive = "collector.non_interactive"
CollectorFileArchiveNoCompress = "collector.file.archive.no_compress"
CollectorFileDirectory = "collector.file.directory"
CollectorFileClusterName = "collector.file.cluster_name"
CollectorFileBlobRegion = "collector.file.blob.region"
CollectorFileBlobBucket = "collector.file.blob.bucket"
)
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/ingestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const (

IngestorAPIEndpoint = "ingestor.api.endpoint"
IngestorAPIInsecure = "ingestor.api.insecure"
IngestorClusterName = "ingestor.cluster_name"
IngestorRunID = "ingestor.run_id"
IngestorMaxArchiveSize = "ingestor.max_archive_size"
IngestorTempDir = "ingestor.temp_dir"
IngestorArchiveName = "ingestor.archive_name"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingestor/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (g *IngestorAPI) Ingest(_ context.Context, path string) error {
if err != nil {
log.I.Warnf("no metadata has been parsed (old dump format from v1.4.0 or below do not embed metadata information): %v", err)
// Backward Compatibility: Extracting the metadata from the path
dumpMetadata, err := dump.ParsePath(archivePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure to understand why this change it needed, in the unit test iirc you did an example with the .tar.gz file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because the archivePath is an hardcoden string, so we need to parse the key which contains the clustername and runid

dumpMetadata, err := dump.ParsePath(path)
if err != nil {
log.I.Warn("parsing path for metadata", err)

Expand Down
1 change: 0 additions & 1 deletion test/system/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func RunLocal(ctx context.Context, runArgs *runArgs, compress bool, p *providers
// Setting the collectorDir, clusterName and runID needed for the ingestion step
// This information is used by the grpc server to run the ingestion
viper.Set(config.CollectorFileDirectory, collectorDir)
viper.Set(config.CollectorFileClusterName, clusterName)

err := cmd.InitializeKubehoundConfig(ctx, KubeHoundThroughDumpConfigPath, false, false)
if err != nil {
Expand Down
Loading