Skip to content

Commit 027edae

Browse files
authored
Remove show external only flag (#655)
1 parent 8bfe253 commit 027edae

File tree

3 files changed

+13
-27
lines changed

3 files changed

+13
-27
lines changed

cli/cmd/network_report.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,13 @@ pods, processes, and DNS queries. Reports must be enabled with 'replicated netwo
2727
Output formats:
2828
- Default: Full event details in JSON format
2929
- --summary: Aggregated statistics with top domains and destinations
30-
- --watch: Continuous stream of new events in JSON Lines format
31-
32-
Filtering:
33-
- --show-external-only: Show only external network traffic (default: true)
34-
Set to false to include internal cluster traffic`,
30+
- --watch: Continuous stream of new events in JSON Lines format`,
3531
Example: `# Get full network traffic report (external traffic only)
3632
replicated network report <network-id>
3733
3834
# Get aggregated summary with statistics. Only available for networks that have been terminated.
3935
replicated network report <network-id> --summary
4036
41-
# Include internal cluster traffic in the report
42-
replicated network report <network-id> --show-external-only=false
43-
4437
# Watch for new network events in real-time
4538
replicated network report <network-id> --watch`,
4639
RunE: r.getNetworkReport,
@@ -54,7 +47,6 @@ replicated network report <network-id> --watch`,
5447

5548
cmd.Flags().BoolVarP(&r.args.networkReportWatch, "watch", "w", false, "Watch for new network events in real-time (polls every 2 seconds)")
5649
cmd.Flags().BoolVar(&r.args.networkReportSummary, "summary", false, "Get aggregated report summary with statistics instead of individual events")
57-
cmd.Flags().BoolVar(&r.args.networkReportShowExternalOnly, "show-external-only", true, "Show only external network traffic")
5850

5951
return cmd
6052
}
@@ -85,7 +77,7 @@ func (r *runners) getNetworkReport(cmd *cobra.Command, args []string) error {
8577
}
8678

8779
func (r *runners) getNetworkReportEvents() error {
88-
report, err := r.kotsAPI.GetNetworkReport(r.args.networkReportID, r.args.networkReportShowExternalOnly)
80+
report, err := r.kotsAPI.GetNetworkReport(r.args.networkReportID)
8981
if errors.Cause(err) == platformclient.ErrForbidden {
9082
return ErrCompatibilityMatrixTermsNotAccepted
9183
} else if err != nil {
@@ -119,9 +111,9 @@ func (r *runners) getNetworkReportEvents() error {
119111
for range time.Tick(2 * time.Second) {
120112
var newReport *types.NetworkReport
121113
if lastEventTime != nil {
122-
newReport, err = r.kotsAPI.GetNetworkReportAfter(r.args.networkReportID, lastEventTime, r.args.networkReportShowExternalOnly)
114+
newReport, err = r.kotsAPI.GetNetworkReportAfter(r.args.networkReportID, lastEventTime)
123115
} else {
124-
newReport, err = r.kotsAPI.GetNetworkReport(r.args.networkReportID, r.args.networkReportShowExternalOnly)
116+
newReport, err = r.kotsAPI.GetNetworkReport(r.args.networkReportID)
125117
}
126118

127119
if err != nil {
@@ -152,7 +144,7 @@ func (r *runners) getNetworkReportSummary(ctx context.Context) error {
152144
return fmt.Errorf("cannot use watch and summary flags together")
153145
}
154146

155-
summary, err := r.kotsAPI.GetNetworkReportSummary(ctx, r.args.networkReportID, r.args.networkReportShowExternalOnly)
147+
summary, err := r.kotsAPI.GetNetworkReportSummary(ctx, r.args.networkReportID)
156148
if errors.Cause(err) == platformclient.ErrForbidden {
157149
return ErrCompatibilityMatrixTermsNotAccepted
158150
} else if errors.Cause(err) == platformclient.ErrNotFound {

cli/cmd/runner.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,9 @@ type runnerArgs struct {
254254
lsNetworkEndTime string
255255
lsNetworkWatch bool
256256

257-
networkReportID string
258-
networkReportWatch bool
259-
networkReportSummary bool
260-
networkReportShowExternalOnly bool
257+
networkReportID string
258+
networkReportWatch bool
259+
networkReportSummary bool
261260

262261
updateNetworkPolicy string
263262
updateNetworkCollectReport bool

pkg/kotsclient/network_report.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ import (
1111
"github.com/replicatedhq/replicated/pkg/types"
1212
)
1313

14-
func (c *VendorV3Client) GetNetworkReport(id string, showExternalOnly bool) (*types.NetworkReport, error) {
15-
return c.GetNetworkReportAfter(id, nil, showExternalOnly)
14+
func (c *VendorV3Client) GetNetworkReport(id string) (*types.NetworkReport, error) {
15+
return c.GetNetworkReportAfter(id, nil)
1616
}
1717

18-
func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time, showExternalOnly bool) (*types.NetworkReport, error) {
18+
func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time) (*types.NetworkReport, error) {
1919
urlPath := fmt.Sprintf("/v3/network/%s/report", id)
2020
v := url.Values{}
2121
if after != nil {
2222
v.Set("after", after.Format(time.RFC3339Nano))
2323
}
24-
v.Set("show-external-only", fmt.Sprintf("%t", showExternalOnly))
2524
if len(v) > 0 {
2625
urlPath = fmt.Sprintf("%s?%s", urlPath, v.Encode())
2726
}
@@ -60,13 +59,9 @@ func (c *VendorV3Client) GetNetworkReportAfter(id string, after *time.Time, show
6059
return &types.NetworkReport{Events: events}, nil
6160
}
6261

63-
func (c *VendorV3Client) GetNetworkReportSummary(ctx context.Context, id string, showExternalOnly bool) (*types.NetworkReportSummary, error) {
62+
func (c *VendorV3Client) GetNetworkReportSummary(ctx context.Context, id string) (*types.NetworkReportSummary, error) {
6463
urlPath := fmt.Sprintf("/v3/network/%s/report/summary", id)
65-
v := url.Values{}
66-
v.Set("show-external-only", fmt.Sprintf("%t", showExternalOnly))
67-
if len(v) > 0 {
68-
urlPath = fmt.Sprintf("%s?%s", urlPath, v.Encode())
69-
}
64+
7065
type summaryResp struct {
7166
*types.NetworkReportSummary
7267
Error string `json:"error,omitempty"`

0 commit comments

Comments
 (0)