diff --git a/cli/cmd/network_report.go b/cli/cmd/network_report.go index 83d958ebc..00cf4ecba 100644 --- a/cli/cmd/network_report.go +++ b/cli/cmd/network_report.go @@ -27,20 +27,13 @@ pods, processes, and DNS queries. Reports must be enabled with 'replicated netwo Output formats: - Default: Full event details in JSON format - --summary: Aggregated statistics with top domains and destinations - - --watch: Continuous stream of new events in JSON Lines format - -Filtering: - - --show-external-only: Show only external network traffic (default: true) - Set to false to include internal cluster traffic`, + - --watch: Continuous stream of new events in JSON Lines format`, Example: `# Get full network traffic report (external traffic only) replicated network report # Get aggregated summary with statistics. Only available for networks that have been terminated. replicated network report --summary -# Include internal cluster traffic in the report -replicated network report --show-external-only=false - # Watch for new network events in real-time replicated network report --watch`, RunE: r.getNetworkReport, @@ -54,7 +47,6 @@ replicated network report --watch`, cmd.Flags().BoolVarP(&r.args.networkReportWatch, "watch", "w", false, "Watch for new network events in real-time (polls every 2 seconds)") cmd.Flags().BoolVar(&r.args.networkReportSummary, "summary", false, "Get aggregated report summary with statistics instead of individual events") - cmd.Flags().BoolVar(&r.args.networkReportShowExternalOnly, "show-external-only", true, "Show only external network traffic") return cmd } @@ -85,7 +77,7 @@ func (r *runners) getNetworkReport(cmd *cobra.Command, args []string) error { } func (r *runners) getNetworkReportEvents() error { - report, err := r.kotsAPI.GetNetworkReport(r.args.networkReportID, r.args.networkReportShowExternalOnly) + report, err := r.kotsAPI.GetNetworkReport(r.args.networkReportID) if errors.Cause(err) == platformclient.ErrForbidden { return ErrCompatibilityMatrixTermsNotAccepted } else if err != nil { @@ -119,9 +111,9 @@ func (r *runners) getNetworkReportEvents() error { for range time.Tick(2 * time.Second) { var newReport *types.NetworkReport if lastEventTime != nil { - newReport, err = r.kotsAPI.GetNetworkReportAfter(r.args.networkReportID, lastEventTime, r.args.networkReportShowExternalOnly) + newReport, err = r.kotsAPI.GetNetworkReportAfter(r.args.networkReportID, lastEventTime) } else { - newReport, err = r.kotsAPI.GetNetworkReport(r.args.networkReportID, r.args.networkReportShowExternalOnly) + newReport, err = r.kotsAPI.GetNetworkReport(r.args.networkReportID) } if err != nil { @@ -152,7 +144,7 @@ func (r *runners) getNetworkReportSummary(ctx context.Context) error { return fmt.Errorf("cannot use watch and summary flags together") } - summary, err := r.kotsAPI.GetNetworkReportSummary(ctx, r.args.networkReportID, r.args.networkReportShowExternalOnly) + summary, err := r.kotsAPI.GetNetworkReportSummary(ctx, r.args.networkReportID) if errors.Cause(err) == platformclient.ErrForbidden { return ErrCompatibilityMatrixTermsNotAccepted } else if errors.Cause(err) == platformclient.ErrNotFound { diff --git a/cli/cmd/runner.go b/cli/cmd/runner.go index a62e6eb04..a3847929a 100644 --- a/cli/cmd/runner.go +++ b/cli/cmd/runner.go @@ -254,10 +254,9 @@ type runnerArgs struct { lsNetworkEndTime string lsNetworkWatch bool - networkReportID string - networkReportWatch bool - networkReportSummary bool - networkReportShowExternalOnly bool + networkReportID string + networkReportWatch bool + networkReportSummary bool updateNetworkPolicy string updateNetworkCollectReport bool diff --git a/pkg/kotsclient/network_report.go b/pkg/kotsclient/network_report.go index 437967595..16be0cd3c 100644 --- a/pkg/kotsclient/network_report.go +++ b/pkg/kotsclient/network_report.go @@ -11,17 +11,16 @@ import ( "github.com/replicatedhq/replicated/pkg/types" ) -func (c *VendorV3Client) GetNetworkReport(id string, showExternalOnly bool) (*types.NetworkReport, error) { - return c.GetNetworkReportAfter(id, nil, showExternalOnly) +func (c *VendorV3Client) GetNetworkReport(id string) (*types.NetworkReport, error) { + return c.GetNetworkReportAfter(id, nil) } -func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time, showExternalOnly bool) (*types.NetworkReport, error) { +func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time) (*types.NetworkReport, error) { urlPath := fmt.Sprintf("/v3/network/%s/report", id) v := url.Values{} if after != nil { v.Set("after", after.Format(time.RFC3339Nano)) } - v.Set("show-external-only", fmt.Sprintf("%t", showExternalOnly)) if len(v) > 0 { urlPath = fmt.Sprintf("%s?%s", urlPath, v.Encode()) } @@ -60,13 +59,9 @@ func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time, show return &types.NetworkReport{Events: events}, nil } -func (c *VendorV3Client) GetNetworkReportSummary(ctx context.Context, id string, showExternalOnly bool) (*types.NetworkReportSummary, error) { +func (c *VendorV3Client) GetNetworkReportSummary(ctx context.Context, id string) (*types.NetworkReportSummary, error) { urlPath := fmt.Sprintf("/v3/network/%s/report/summary", id) - v := url.Values{} - v.Set("show-external-only", fmt.Sprintf("%t", showExternalOnly)) - if len(v) > 0 { - urlPath = fmt.Sprintf("%s?%s", urlPath, v.Encode()) - } + type summaryResp struct { *types.NetworkReportSummary Error string `json:"error,omitempty"`