Skip to content

Commit dc2af8d

Browse files
committed
removed noselector services array
1 parent c74511e commit dc2af8d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func getUnsafeExternalTrafficPolicyClusterServices(
177177
servicesByNamespace map[string][]*corev1.Service,
178178
policiesByNamespace map[string][]*networkingv1.NetworkPolicy,
179179
) (unsafeServices []string) {
180-
var riskServices, noSelectorServices, safeServices []string
180+
var riskServices, safeServices []string
181181

182182
for i := range namespaces.Items {
183183
namespace := &namespaces.Items[i]
@@ -196,11 +196,7 @@ func getUnsafeExternalTrafficPolicyClusterServices(
196196
if externalTrafficPolicy != corev1.ServiceExternalTrafficPolicyTypeLocal {
197197
// Any service with externalTrafficPolicy=Cluster is at risk so need to elimate any services that are incorrectly flagged
198198
riskServices = append(riskServices, fmt.Sprintf("%s/%s", namespace.Name, service.Name))
199-
// If the service has no selector add it to the noSelectorServices list
200-
if service.Spec.Selector == nil {
201-
noSelectorServices = append(noSelectorServices, fmt.Sprintf("%s/%s", namespace.Name, service.Name))
202-
}
203-
// Check if are there services with selector that match the network policy
199+
// Check if are there services with selector that are allowed by a network policy that can be safely migrated
204200
if checkNoServiceRisk(service, policyListAtNamespace) {
205201
safeServices = append(safeServices, fmt.Sprintf("%s/%s", namespace.Name, service.Name))
206202
}
@@ -479,7 +475,7 @@ func addUnsafeServicesToTable(table *tablewriter.Table, unsafeServices []string)
479475
for _, service := range unsafeServices {
480476
serviceName := strings.Split(service, "/")[1]
481477
serviceNamespace := strings.Split(service, "/")[0]
482-
table.Append([]string{"", "❌", fmt.Sprintf("Found Service: \033[31m%s\033[0m with selectors in namespace: \033[31m%s\033[0m\n", serviceName, serviceNamespace)})
478+
table.Append([]string{"", "❌", fmt.Sprintf("Found Service: \033[31m%s\033[0m in namespace: \033[31m%s\033[0m\n", serviceName, serviceNamespace)})
483479
}
484480
table.Append([]string{"", "", "Manual investigation is required to evaluate if ingress is allowed to the service's backend Pods."})
485481
table.Append([]string{"", "", "Please evaluate if these services would be impacted by migration."})

0 commit comments

Comments
 (0)