Search in sources :

Example 1 with TolerationBuilder

use of io.fabric8.kubernetes.api.model.TolerationBuilder in project flink by apache.

the class KubernetesToleration method fromMap.

public static KubernetesToleration fromMap(Map<String, String> stringMap) {
    final TolerationBuilder tolerationBuilder = new TolerationBuilder();
    stringMap.forEach((k, v) -> {
        switch(k.toLowerCase()) {
            case "effect":
                tolerationBuilder.withEffect(v);
                break;
            case "key":
                tolerationBuilder.withKey(v);
                break;
            case "operator":
                tolerationBuilder.withOperator(v);
                break;
            case "tolerationseconds":
                tolerationBuilder.withTolerationSeconds(Long.valueOf(v));
                break;
            case "value":
                tolerationBuilder.withValue(v);
                break;
            default:
                LOG.warn("Unrecognized key({}) of toleration, will ignore.", k);
                break;
        }
    });
    return new KubernetesToleration(tolerationBuilder.build());
}
Also used : TolerationBuilder(io.fabric8.kubernetes.api.model.TolerationBuilder)

Aggregations

TolerationBuilder (io.fabric8.kubernetes.api.model.TolerationBuilder)1