class Fabric8Utils {

	private Fabric8Utils() {

	}

	public static ServiceMetadata serviceMetadata(Service service) {
		ObjectMeta metadata = service.getMetadata();
		ServiceSpec serviceSpec = service.getSpec();
		return new ServiceMetadata(metadata.getName(), metadata.getNamespace(), serviceSpec.getType(),
				metadata.getLabels(), metadata.getAnnotations());
	}

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

	/**
	 * this method does the namespace resolution. Namespace is being searched according to
	 * the order below.
	 *
	 * <pre>
	 *     1. from incoming namespace, which can be null.
	 *     2. from a property 'spring.cloud.kubernetes.client.namespace', if such is present.
	 *     3. from a String residing in a file denoted by `spring.cloud.kubernetes.client.serviceAccountNamespacePath`
	 * 	      property, if such is present.
	 * 	   4. from a String residing in `/var/run/secrets/kubernetes.io/serviceaccount/namespace` file,
	 * 	  	  if such is present (kubernetes default path)
	 * 	   5. from KubernetesClient::getNamespace, which is implementation specific.
	 * </pre>
	 *
	 * If any of the above fail, we throw a {@link NamespaceResolutionFailedException}.
	 * @param namespace normalized namespace
	 * @param configurationTarget Config Map/Secret
	 * @param provider the provider which computes the namespace
	 * @param client fabric8 Kubernetes client
	 * @return application namespace
	 * @throws NamespaceResolutionFailedException when namespace could not be resolved
	 */
	public static String getApplicationNamespace(KubernetesClient client, @Nullable String namespace,
			String configurationTarget, KubernetesNamespaceProvider provider) {<FILL_FUNCTION_BODY>}

}


		if (StringUtils.hasText(namespace)) {
			LOG.debug(configurationTarget + " namespace : " + namespace);
			return namespace;
		}

		if (provider != null) {
			String providerNamespace = provider.getNamespace();
			if (StringUtils.hasText(providerNamespace)) {
				LOG.debug(() -> configurationTarget + " namespace from provider : " + providerNamespace);
				return providerNamespace;
			}
		}

		String clientNamespace = client.getNamespace();
		LOG.debug(() -> configurationTarget + " namespace from client : " + clientNamespace);
		if (clientNamespace == null) {
			throw new NamespaceResolutionFailedException("unresolved namespace");
		}
		return clientNamespace;

	
<no_super_class>