Skip to content

Commit 0d80410

Browse files
committed
improved formatting
1 parent f0f8aa7 commit 0d80410

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

tools/azure-npm-to-cilium-validator/azure-npm-to-cilium-validator.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,20 @@ func printMigrationSummary(namespaces *corev1.NamespaceList, policiesByNamespace
425425

426426
migrationSummarytable.Render()
427427

428+
if len(ingressEndportNetworkPolicy) > 0 || len(egressEndportNetworkPolicy) > 0 ||
429+
len(ingressPoliciesWithCIDR) > 0 || len(egressPoliciesWithCIDR) > 0 ||
430+
len(egressPolicies) > 0 ||
431+
len(unsafeServices) > 0 {
432+
fmt.Println("\n\033[31m✘ Review above issues before migration.\033[0m")
433+
fmt.Println("Please see \033[32maka.ms/azurenpmtocilium\033[0m for instructions on how to evaluate/assess the above warnings marked by ❌.")
434+
fmt.Println("NOTE: rerun this script if any modifications (create/update/delete) are made to services or policies.")
435+
} else {
436+
fmt.Println("\n\033[32m✔ Safe to migrate this cluster.\033[0m")
437+
fmt.Println("For more details please see \033[32maka.ms/azurenpmtocilium\033[0m.")
438+
}
439+
440+
fmt.Println("\nCluster Resources:")
441+
428442
resourceTable := tablewriter.NewWriter(os.Stdout)
429443
resourceTable.SetHeader([]string{"Cluster Resources", "Namespace", "Count"})
430444
resourceTable.SetRowLine(true)
@@ -439,18 +453,6 @@ func printMigrationSummary(namespaces *corev1.NamespaceList, policiesByNamespace
439453
addTotalPodsToTable(resourceTable, podsByNamespace)
440454

441455
resourceTable.Render()
442-
443-
if len(ingressEndportNetworkPolicy) > 0 || len(egressEndportNetworkPolicy) > 0 ||
444-
len(ingressPoliciesWithCIDR) > 0 || len(egressPoliciesWithCIDR) > 0 ||
445-
len(egressPolicies) > 0 ||
446-
len(unsafeServices) > 0 {
447-
fmt.Println("\033[31m✘ Review above issues before migration.\033[0m")
448-
fmt.Println("Please see \033[32maka.ms/azurenpmtocilium\033[0m for instructions on how to evaluate/assess the above warnings marked by ❌.")
449-
fmt.Println("NOTE: rerun this script if any modifications (create/update/delete) are made to services or policies.")
450-
} else {
451-
fmt.Println("\033[32m✔ Safe to migrate this cluster.\033[0m")
452-
fmt.Println("For more details please see \033[32maka.ms/azurenpmtocilium\033[0m.")
453-
}
454456
}
455457

456458
func addTotalPoliciesToTable(table *tablewriter.Table, policiesByNamespace map[string][]*networkingv1.NetworkPolicy) {

0 commit comments

Comments
 (0)