@@ -713,10 +713,6 @@ func (i *Istio) ListServiceMeshHosts(ctx context.Context, namespace string) (str
713713 }
714714
715715 for _ , svc := range servicesList .Items {
716- // // Skip system services that are not mesh-relevant
717- // if svc.Namespace == "kube-system" || svc.Namespace == "kube-public" || svc.Namespace == "kube-node-lease" {
718- // continue
719- // }
720716 hostName := svc .Name
721717 k8sServiceHosts = append (k8sServiceHosts , hostName )
722718 k8sServiceDetails [hostName ] = svc .Namespace
@@ -745,11 +741,29 @@ func (i *Istio) ListServiceMeshHosts(ctx context.Context, namespace string) (str
745741 }
746742 }
747743
744+ // Collect DestinationRule hosts
745+ var destinationRuleHosts []string
746+ var destinationRuleDetails = make (map [string ]string )
747+
748+ // Get DestinationRules from the specified namespace
749+ drList , err := i .istioClient .NetworkingV1alpha3 ().DestinationRules (namespace ).List (ctx , metav1.ListOptions {})
750+ if err != nil {
751+ return "" , fmt .Errorf ("failed to list destination rules: %w" , err )
752+ }
753+
754+ for _ , dr := range drList .Items {
755+ if dr .Spec .Host != "" {
756+ destinationRuleHosts = append (destinationRuleHosts , dr .Spec .Host )
757+ destinationRuleDetails [dr .Spec .Host ] = dr .Name
758+ }
759+ }
760+
748761 // Sort all slices for consistent output
749762 sort .Strings (serviceEntryHosts )
750763 sort .Strings (k8sServiceHosts )
751764 sort .Strings (virtualServiceHosts )
752765 sort .Strings (wildcardHosts )
766+ sort .Strings (destinationRuleHosts )
753767
754768 // Build ServiceEntry section
755769 result += "ServiceEntries (External to Mesh Services):\n "
@@ -790,10 +804,22 @@ func (i *Istio) ListServiceMeshHosts(ctx context.Context, namespace string) (str
790804 }
791805 result += "\n "
792806
807+ // Build DestinationRule section
808+ result += "DestinationRule Hosts:\n "
809+ if len (destinationRuleHosts ) == 0 {
810+ result += " (none found)\n "
811+ } else {
812+ for _ , host := range destinationRuleHosts {
813+ result += fmt .Sprintf (" %-30s (DestinationRule: %s)\n " , host , destinationRuleDetails [host ])
814+ }
815+ }
816+ result += "\n "
817+
793818 // Build summary
794819 result += "Summary:\n "
795820 result += fmt .Sprintf ("- %d ServiceEntries\n " , len (serviceEntryHosts ))
796821 result += fmt .Sprintf ("- %d Kubernetes Services\n " , len (k8sServiceHosts ))
797822 result += fmt .Sprintf ("- %d VirtualService Configurations\n " , len (virtualServiceHosts ))
823+ result += fmt .Sprintf ("- %d DestinationRule Configurations\n " , len (destinationRuleHosts ))
798824 return result , nil
799825}
0 commit comments