From 77aaf997639e73cfbbf3188f28ca24455f81afd9 Mon Sep 17 00:00:00 2001 From: Ronen Schaffer Date: Wed, 20 Sep 2023 16:35:35 +0300 Subject: [PATCH] Omit decoder from ingest_stdin config --- docs/api.md | 4 ---- pkg/api/ingest_stdin.go | 1 - pkg/pipeline/ingest/ingest_stdin.go | 11 ++--------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/api.md b/docs/api.md index 710da8df9..f9c7f3401 100644 --- a/docs/api.md +++ b/docs/api.md @@ -116,10 +116,6 @@ Following is the supported API format for the standard input ingest:
  stdin:
-         decoder: decoder to use
-             type: (enum) one of the following:
-                 json: JSON decoder
-                 protobuf: Protobuf decoder
 
## Transform Generic API Following is the supported API format for generic transformations: diff --git a/pkg/api/ingest_stdin.go b/pkg/api/ingest_stdin.go index 678708528..a1df3e817 100644 --- a/pkg/api/ingest_stdin.go +++ b/pkg/api/ingest_stdin.go @@ -18,5 +18,4 @@ package api type IngestStdin struct { - Decoder Decoder `yaml:"decoder,omitempty" json:"decoder,omitempty" doc:"decoder to use"` } diff --git a/pkg/pipeline/ingest/ingest_stdin.go b/pkg/pipeline/ingest/ingest_stdin.go index 3605d47a6..3f22c613f 100644 --- a/pkg/pipeline/ingest/ingest_stdin.go +++ b/pkg/pipeline/ingest/ingest_stdin.go @@ -19,7 +19,6 @@ package ingest import ( "bufio" - "fmt" "os" "github.com/netobserv/flowlogs-pipeline/pkg/api" @@ -95,18 +94,12 @@ func (s *ingestStdin) processRecord(out chan<- config.GenericMap, line string) { // NewIngestStdin create a new ingester func NewIngestStdin(opMetrics *operational.Metrics, params config.StageParam) (Ingester, error) { slog.Debugf("Entering NewIngestStdin") - if params.Ingest == nil || params.Ingest.Stdin == nil || params.Ingest.Stdin.Decoder.Type == "" { - return nil, fmt.Errorf("stdin decoder not specified") - } - decoderType := params.Ingest.Stdin.Decoder.Type - if decoderType != api.DecoderName("JSON") { - return nil, fmt.Errorf("stdin supports only json decoder. Given decoder type: %v", decoderType) - } in := make(chan string, channelSize) eof := make(chan struct{}) metrics := newMetrics(opMetrics, params.Name, params.Ingest.Type, func() int { return len(in) }) - decoder, err := decode.GetDecoder(params.Ingest.Stdin.Decoder) + decoderParams := api.Decoder{Type: api.DecoderName("JSON")} + decoder, err := decode.GetDecoder(decoderParams) if err != nil { return nil, err }