class Fabric8EndpointSliceV1CatalogWatch
		implements Function<Fabric8CatalogWatchContext, List<EndpointNameAndNamespace>> {

	private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8EndpointSliceV1CatalogWatch.class));

	@Override
	public List<EndpointNameAndNamespace> apply(Fabric8CatalogWatchContext context) {<FILL_FUNCTION_BODY>}

	private List<EndpointSlice> endpointSlices(Fabric8CatalogWatchContext context, String namespace,
			KubernetesClient client) {
		return client.discovery().v1().endpointSlices().inNamespace(namespace)
				.withLabels(context.properties().serviceLabels()).list().getItems();
	}

}

		// take only pods that have endpoints
		List<EndpointSlice> endpointSlices;
		KubernetesClient client = context.kubernetesClient();

		if (context.properties().allNamespaces()) {
			LOG.debug(() -> "discovering endpoint slices in all namespaces");
			endpointSlices = client.discovery().v1().endpointSlices().inAnyNamespace()
					.withLabels(context.properties().serviceLabels()).list().getItems();
		}
		else if (!context.properties().namespaces().isEmpty()) {
			LOG.debug(() -> "discovering endpoint slices in " + context.properties().namespaces());
			List<EndpointSlice> inner = new ArrayList<>(context.properties().namespaces().size());
			context.properties().namespaces()
					.forEach(namespace -> inner.addAll(endpointSlices(context, namespace, client)));
			endpointSlices = inner;
		}
		else {
			String namespace = Fabric8Utils.getApplicationNamespace(context.kubernetesClient(), null, "catalog-watcher",
					context.namespaceProvider());
			LOG.debug(() -> "discovering endpoint slices in namespace : " + namespace);
			endpointSlices = endpointSlices(context, namespace, client);
		}

		Stream<ObjectReference> references = endpointSlices.stream().map(EndpointSlice::getEndpoints)
				.flatMap(List::stream).map(Endpoint::getTargetRef);

		return Fabric8CatalogWatchContext.state(references);

	
<no_super_class>