@Test public void testHasFenzoSchedulerTaint() { assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone())).isFalse(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_NOT_TOLERATED_TAINT))).isTrue(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_SCHEDULER_FENZO))).isTrue(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_NOT_TOLERATED_TAINT, TAINT_SCHEDULER_FENZO))).isTrue(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_SCHEDULER_OTHER))).isFalse(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_SCHEDULER_OTHER, TAINT_SCHEDULER_FENZO))).isFalse(); assertThat(KubeUtil.hasFenzoSchedulerTaint(newNodeWithoutZone(TAINT_NODE_UNINITIALIZED))).isFalse(); }
public static boolean hasFenzoSchedulerTaint(V1Node node) { List<V1Taint> taints = node.getSpec().getTaints(); if (CollectionsExt.isNullOrEmpty(taints) || hasUninitializedTaint(node)) { return false; } Set<String> schedulerTaintValues = taints.stream() .filter(t -> KubeConstants.TAINT_SCHEDULER.equals(t.getKey())) .map(t -> StringExt.safeTrim(t.getValue())) .collect(Collectors.toSet()); if (schedulerTaintValues.isEmpty()) { return true; } return schedulerTaintValues.size() == 1 && KubeConstants.TAINT_SCHEDULER_VALUE_FENZO.equalsIgnoreCase(CollectionsExt.first(schedulerTaintValues)); }
KubeUtil { public static boolean hasFenzoSchedulerTaint(V1Node node) { List<V1Taint> taints = node.getSpec().getTaints(); if (CollectionsExt.isNullOrEmpty(taints) || hasUninitializedTaint(node)) { return false; } Set<String> schedulerTaintValues = taints.stream() .filter(t -> KubeConstants.TAINT_SCHEDULER.equals(t.getKey())) .map(t -> StringExt.safeTrim(t.getValue())) .collect(Collectors.toSet()); if (schedulerTaintValues.isEmpty()) { return true; } return schedulerTaintValues.size() == 1 && KubeConstants.TAINT_SCHEDULER_VALUE_FENZO.equalsIgnoreCase(CollectionsExt.first(schedulerTaintValues)); } }
KubeUtil { public static boolean hasFenzoSchedulerTaint(V1Node node) { List<V1Taint> taints = node.getSpec().getTaints(); if (CollectionsExt.isNullOrEmpty(taints) || hasUninitializedTaint(node)) { return false; } Set<String> schedulerTaintValues = taints.stream() .filter(t -> KubeConstants.TAINT_SCHEDULER.equals(t.getKey())) .map(t -> StringExt.safeTrim(t.getValue())) .collect(Collectors.toSet()); if (schedulerTaintValues.isEmpty()) { return true; } return schedulerTaintValues.size() == 1 && KubeConstants.TAINT_SCHEDULER_VALUE_FENZO.equalsIgnoreCase(CollectionsExt.first(schedulerTaintValues)); }  }
KubeUtil { public static boolean hasFenzoSchedulerTaint(V1Node node) { List<V1Taint> taints = node.getSpec().getTaints(); if (CollectionsExt.isNullOrEmpty(taints) || hasUninitializedTaint(node)) { return false; } Set<String> schedulerTaintValues = taints.stream() .filter(t -> KubeConstants.TAINT_SCHEDULER.equals(t.getKey())) .map(t -> StringExt.safeTrim(t.getValue())) .collect(Collectors.toSet()); if (schedulerTaintValues.isEmpty()) { return true; } return schedulerTaintValues.size() == 1 && KubeConstants.TAINT_SCHEDULER_VALUE_FENZO.equalsIgnoreCase(CollectionsExt.first(schedulerTaintValues)); }  static int estimatePodSize(V1Pod v1Pod); static boolean isPodPhaseTerminal(String phase); static Optional<Long> findFinishedTimestamp(V1Pod pod); static Optional<TitusExecutorDetails> getTitusExecutorDetails(V1Pod pod); static Optional<V1ContainerState> findContainerState(V1Pod pod); static Optional<V1ContainerStateTerminated> findTerminatedContainerStatus(V1Pod pod); static String formatV1ContainerState(V1ContainerState containerState); static Optional<String> findFarzoneId(DirectKubeConfiguration configuration, Job job); static boolean isOwnedByKubeScheduler(V1Pod v1Pod); static Optional<String> getNodeIpV4Address(V1Node node); static Map<String, String> createPodAnnotations(
            Job<?> job,
            Task task,
            byte[] containerInfoData,
            Map<String, String> passthroughAttributes,
            boolean includeJobDescriptor
    ); static Map<String, String> createPodAnnotationsFromJobParameters(Job<?> job); static boolean isNodeOwnedByFenzo(List<String> farzones, V1Node node); static boolean hasFenzoSchedulerTaint(V1Node node); static boolean isFarzoneNode(List<String> farzones, V1Node node); static String toErrorDetails(Throwable e); static Mono<T> toReact(KubeFunction<ApiCallback<T>, Call> handler); static String getMetadataName(V1ObjectMeta metadata); static Optional<V1NodeCondition> findNodeCondition(V1Node node, String type); static boolean hasUninitializedTaint(V1Node node); }
KubeUtil { public static boolean hasFenzoSchedulerTaint(V1Node node) { List<V1Taint> taints = node.getSpec().getTaints(); if (CollectionsExt.isNullOrEmpty(taints) || hasUninitializedTaint(node)) { return false; } Set<String> schedulerTaintValues = taints.stream() .filter(t -> KubeConstants.TAINT_SCHEDULER.equals(t.getKey())) .map(t -> StringExt.safeTrim(t.getValue())) .collect(Collectors.toSet()); if (schedulerTaintValues.isEmpty()) { return true; } return schedulerTaintValues.size() == 1 && KubeConstants.TAINT_SCHEDULER_VALUE_FENZO.equalsIgnoreCase(CollectionsExt.first(schedulerTaintValues)); }  static int estimatePodSize(V1Pod v1Pod); static boolean isPodPhaseTerminal(String phase); static Optional<Long> findFinishedTimestamp(V1Pod pod); static Optional<TitusExecutorDetails> getTitusExecutorDetails(V1Pod pod); static Optional<V1ContainerState> findContainerState(V1Pod pod); static Optional<V1ContainerStateTerminated> findTerminatedContainerStatus(V1Pod pod); static String formatV1ContainerState(V1ContainerState containerState); static Optional<String> findFarzoneId(DirectKubeConfiguration configuration, Job job); static boolean isOwnedByKubeScheduler(V1Pod v1Pod); static Optional<String> getNodeIpV4Address(V1Node node); static Map<String, String> createPodAnnotations(
            Job<?> job,
            Task task,
            byte[] containerInfoData,
            Map<String, String> passthroughAttributes,
            boolean includeJobDescriptor
    ); static Map<String, String> createPodAnnotationsFromJobParameters(Job<?> job); static boolean isNodeOwnedByFenzo(List<String> farzones, V1Node node); static boolean hasFenzoSchedulerTaint(V1Node node); static boolean isFarzoneNode(List<String> farzones, V1Node node); static String toErrorDetails(Throwable e); static Mono<T> toReact(KubeFunction<ApiCallback<T>, Call> handler); static String getMetadataName(V1ObjectMeta metadata); static Optional<V1NodeCondition> findNodeCondition(V1Node node, String type); static boolean hasUninitializedTaint(V1Node node); static final String TYPE_INTERNAL_IP; }