in spark-operator/src/main/java/org/apache/spark/k8s/operator/SparkOperator.java [141:165]
protected boolean updateWatchingNamespaces(Set<String> namespaces) {
if (watchedNamespaces.equals(namespaces)) {
log.info("No watched namespace change detected");
return false;
}
if (watchedNamespaces.isEmpty()) {
log.info("Cannot update watch namespaces for operator started at cluster level.");
return false;
}
if (namespaces == null || namespaces.isEmpty()) {
log.error("Cannot updating namespaces to empty");
return false;
}
registeredSparkControllers.forEach(
c -> {
if (c.allowsNamespaceChanges()) {
log.info("Updating operator namespaces to {}", namespaces);
c.changeNamespaces(namespaces);
} else {
log.error("Controller does not allow namespace change, skipping namespace change.");
}
});
this.watchedNamespaces = new HashSet<>(namespaces);
return true;
}