Skip to content

Commit

Permalink
fix observations from review
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielggg committed Nov 11, 2024
1 parent 1c6f7b2 commit 21efeb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmd/policy-assistant/pkg/cli/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func SetupAnalyzeCommand() *cobra.Command {
command.Flags().StringVar(&args.TrafficPath, "traffic-path", "", "path to json traffic file, containing of a list of traffic objects")
command.Flags().StringVar(&args.ProbePath, "probe-path", "", "path to json model file for synthetic probe")
command.Flags().DurationVar(&args.Timeout, "kube-client-timeout", DefaultTimeout, "kube client timeout")
command.Flags().StringVar(&args.SourceWorkloadTraffic, "source-workload-traffic", "", "Source workload traffic in this form namespace/workloadType/workloadName")
command.Flags().StringVar(&args.DestinationWorkloadTraffic, "destination-workload-traffic", "", "Destination workload traffic Name in this form namespace/workloadType/workloadName")
command.Flags().StringVar(&args.SourceWorkloadTraffic, "src-workload", "", "Source workload traffic in this form namespace/workloadType/workloadName")
command.Flags().StringVar(&args.DestinationWorkloadTraffic, "dst-workload", "", "Destination workload traffic Name in this form namespace/workloadType/workloadName")
command.Flags().IntVar(&args.Port, "port", 0, "port used for testing network policies")
command.Flags().StringVar(&args.Protocol, "protocol", "", "protocol used for testing network policies")

Expand Down Expand Up @@ -316,7 +316,7 @@ func VerdictWalkthrough(policies *matcher.Policy, sourceWorkloadTraffic string,
if trafficPath != "" && (sourceWorkloadTraffic != "" || destinationWorkloadTraffic != "" || port != 0 || protocol != "") {
logrus.Fatalf("%+v", errors.Errorf("If using traffic path, you can't input traffic via CLI and viceversa"))
} else if trafficPath == "" && (sourceWorkloadTraffic == "" || destinationWorkloadTraffic == "" || port == 0 || protocol == "") {
logrus.Fatalf("%+v", errors.Errorf("For this mode, you must either set --traffic-path or set all of --source-workload-traffic (<namespace>/<workloadType>/workloadName), --destination-workload-traffic (<namespace>/<workloadType>/workloadName), --port (integer from 0 to 65535) and --protocol (TCP, UDP and SCTP) parameters"))
logrus.Fatalf("%+v", errors.Errorf("For this mode, you must either set --traffic-path or set all of --src-workload (<namespace>/<workloadType>/workloadName), --dst-workload (<namespace>/<workloadType>/workloadName), --port (integer from 0 to 65535) and --protocol (TCP, UDP and SCTP) parameters"))
}

if trafficPath != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/policy-assistant/pkg/matcher/traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (p *TrafficPeer) Translate() TrafficPeer {
}

if !workloadOwnerExists {
logrus.Infof("workload not found on the cluster")
logrus.Infof(workloadMetadata[0] + "/" + workloadMetadata[1] + "/" + workloadMetadata[2] + " workload not found on the cluster")
internalPeer = InternalPeer{
Workload: "",
}
Expand Down

0 comments on commit 21efeb4

Please sign in to comment.