You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(source/service): restructure code to make service type filters testable (#5485)
* chore(source/service): restructure code with filters are testable
* chore(source/service): restructure code with filters are testable
Co-authored-by: Michel Loiseleur <[email protected]>
* chore(source/service): restructure code with filters are testable
Signed-off-by: ivan katliarchuk <[email protected]>
---------
Signed-off-by: ivan katliarchuk <[email protected]>
Co-authored-by: Michel Loiseleur <[email protected]>
Copy file name to clipboardExpand all lines: docs/flags.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@
46
46
|`--pod-source-domain=""`| Domain to use for pods records (optional) |
47
47
|`--[no-]publish-host-ip`| Allow external-dns to publish host-ip for headless services (optional) |
48
48
|`--[no-]publish-internal-services`| Allow external-dns to publish DNS records for ClusterIP services (optional) |
49
-
|`--service-type-filter=SERVICE-TYPE-FILTER`| The service types to take care about (default: all, expected: ClusterIP, NodePort, LoadBalancer or ExternalName) |
49
+
|`--service-type-filter=SERVICE-TYPE-FILTER`| The service types to filter by. Specify multiple times for multiple filters to be applied. (optional, default: all, expected: ClusterIP, NodePort, LoadBalancer or ExternalName) |
50
50
|`--source=source`| The resource types that are queried for endpoints; specify multiple times for multiple sources (required, options: service, ingress, node, pod, fake, connector, gateway-httproute, gateway-grpcroute, gateway-tlsroute, gateway-tcproute, gateway-udproute, istio-gateway, istio-virtualservice, cloudfoundry, contour-httpproxy, gloo-proxy, crd, empty, skipper-routegroup, openshift-route, ambassador-host, kong-tcpingress, f5-virtualserver, f5-transportserver, traefik-proxy) |
51
51
|`--target-net-filter=TARGET-NET-FILTER`| Limit possible targets by a net filter; specify multiple times for multiple possible nets (optional) |
52
52
|`--[no-]traefik-disable-legacy`| Disable listeners on Resources under the traefik.containo.us API Group |
app.Flag("pod-source-domain", "Domain to use for pods records (optional)").Default(defaultConfig.PodSourceDomain).StringVar(&cfg.PodSourceDomain)
481
481
app.Flag("publish-host-ip", "Allow external-dns to publish host-ip for headless services (optional)").BoolVar(&cfg.PublishHostIP)
482
482
app.Flag("publish-internal-services", "Allow external-dns to publish DNS records for ClusterIP services (optional)").BoolVar(&cfg.PublishInternal)
483
-
app.Flag("service-type-filter", "The service types to take care about (default: all, expected: ClusterIP, NodePort, LoadBalancer or ExternalName)").StringsVar(&cfg.ServiceTypeFilter)
483
+
app.Flag("service-type-filter", "The service types to filter by. Specify multiple times for multiple filters to be applied. (optional, default: all, expected: ClusterIP, NodePort, LoadBalancer or ExternalName)").Default(defaultConfig.ServiceTypeFilter...).StringsVar(&cfg.ServiceTypeFilter)
app.Flag("target-net-filter", "Limit possible targets by a net filter; specify multiple times for multiple possible nets (optional)").StringsVar(&cfg.TargetNetFilter)
486
486
app.Flag("traefik-disable-legacy", "Disable listeners on Resources under the traefik.containo.us API Group").Default(strconv.FormatBool(defaultConfig.TraefikDisableLegacy)).BoolVar(&cfg.TraefikDisableLegacy)
// Check if the service is of the given type or not
461
-
if_, ok:=sc.serviceTypeFilter[string(service.Spec.Type)]; ok {
462
-
filteredList=append(filteredList, service)
469
+
if_, ok:=sc.serviceTypeFilter.types[service.Spec.Type]; ok {
470
+
result=append(result, service)
463
471
}
464
472
}
465
-
466
-
returnfilteredList
473
+
log.Debugf("filtered %d services out of %d with service types filter %q", len(result), len(services), slices.Collect(maps.Keys(sc.serviceTypeFilter.types)))
0 commit comments