class KubernetesNamespaceProvider {

	/**
	 * Property name for namespace.
	 */
	public static final String NAMESPACE_PROPERTY = "spring.cloud.kubernetes.client.namespace";

	/**
	 * Property for namespace file path.
	 */
	public static final String NAMESPACE_PATH_PROPERTY = "spring.cloud.kubernetes.client.serviceAccountNamespacePath";

	private static final DeferredLog LOG = new DeferredLog();

	private String namespacePropertyValue;

	private BindHandler bindHandler;

	private String serviceAccountNamespace;

	private Environment environment;

	private Binder binder;

	public KubernetesNamespaceProvider(Environment env) {
		this.environment = env;
		LOG.replayTo(KubernetesNamespaceProvider.class);
	}

	public KubernetesNamespaceProvider(Binder binder, BindHandler bindHandler) {
		this.binder = binder;
		this.bindHandler = bindHandler;
	}

	public KubernetesNamespaceProvider(String namespacePropertyValue) {
		this.namespacePropertyValue = namespacePropertyValue;
	}

	public static String getNamespaceFromServiceAccountFile(String path) {
		String namespace = null;
		LOG.debug("Looking for service account namespace at: [" + path + "].");
		Path serviceAccountNamespacePath = Paths.get(path);
		boolean serviceAccountNamespaceExists = Files.isRegularFile(serviceAccountNamespacePath);
		if (serviceAccountNamespaceExists) {
			LOG.debug("Found service account namespace at: [" + serviceAccountNamespacePath + "].");

			try {
				namespace = new String(Files.readAllBytes((serviceAccountNamespacePath)));
				LOG.debug("Service account namespace value: " + serviceAccountNamespacePath);
			}
			catch (IOException ioe) {
				LOG.error("Error reading service account namespace from: [" + serviceAccountNamespacePath + "].", ioe);
			}

		}
		return namespace;
	}

	public String getNamespace() {<FILL_FUNCTION_BODY>}

	private String getServiceAccountNamespace() {
		String serviceAccountNamespacePathString = null;
		if (environment != null) {
			serviceAccountNamespacePathString = environment.getProperty(NAMESPACE_PATH_PROPERTY,
					SERVICE_ACCOUNT_NAMESPACE_PATH);
		}
		if (ObjectUtils.isEmpty(serviceAccountNamespacePathString) && binder != null) {
			// When using the binder we cannot use camelcase properties, it considers them
			// invalid
			serviceAccountNamespacePathString = binder
					.bind("spring.cloud.kubernetes.client.service-account-namespace-path", Bindable.of(String.class),
							bindHandler)
					.orElse(SERVICE_ACCOUNT_NAMESPACE_PATH);
		}
		if (serviceAccountNamespace == null) {
			serviceAccountNamespace = getNamespaceFromServiceAccountFile(serviceAccountNamespacePathString);
		}
		return serviceAccountNamespace;
	}

}

		// If they provided the namespace in the constructor just return that
		if (!ObjectUtils.isEmpty(namespacePropertyValue)) {
			return namespacePropertyValue;
		}
		// No namespace provided so try to get it from another source
		String namespace = null;
		if (environment != null) {
			namespace = environment.getProperty(NAMESPACE_PROPERTY);
		}
		if (ObjectUtils.isEmpty(namespace) && binder != null) {
			namespace = binder.bind(NAMESPACE_PROPERTY, String.class).orElse(null);
		}
		return namespace != null ? namespace : getServiceAccountNamespace();
	
<no_super_class>