Search in sources :

Example 1 with NodeAddressType

use of io.strimzi.api.kafka.model.listener.NodeAddressType in project strimzi-kafka-operator by strimzi.

the class InitWriter method writeExternalAddress.

/**
 * Write the external address of this node
 *
 * @return if the operation was executed successfully
 */
public boolean writeExternalAddress() {
    List<NodeAddress> addresses = client.nodes().withName(config.getNodeName()).get().getStatus().getAddresses();
    StringBuilder externalAddresses = new StringBuilder();
    String address = NodeUtils.findAddress(addresses, null);
    if (address == null) {
        LOGGER.error("External address not found");
        return false;
    } else {
        LOGGER.info("Default External address found {}", address);
        externalAddresses.append(externalAddressExport(null, address));
    }
    for (NodeAddressType type : NodeAddressType.values()) {
        address = NodeUtils.findAddress(addresses, type);
        LOGGER.info("External {} address found {}", type.toValue(), address);
        externalAddresses.append(externalAddressExport(type, address));
    }
    return write(FILE_EXTERNAL_ADDRESS, externalAddresses.toString());
}
Also used : NodeAddressType(io.strimzi.api.kafka.model.listener.NodeAddressType) NodeAddress(io.fabric8.kubernetes.api.model.NodeAddress)

Example 2 with NodeAddressType

use of io.strimzi.api.kafka.model.listener.NodeAddressType in project strimzi by strimzi.

the class InitWriter method writeExternalAddress.

/**
 * Write the external address of this node
 *
 * @return if the operation was executed successfully
 */
public boolean writeExternalAddress() {
    List<NodeAddress> addresses = client.nodes().withName(config.getNodeName()).get().getStatus().getAddresses();
    StringBuilder externalAddresses = new StringBuilder();
    String address = NodeUtils.findAddress(addresses, null);
    if (address == null) {
        LOGGER.error("External address not found");
        return false;
    } else {
        LOGGER.info("Default External address found {}", address);
        externalAddresses.append(externalAddressExport(null, address));
    }
    for (NodeAddressType type : NodeAddressType.values()) {
        address = NodeUtils.findAddress(addresses, type);
        LOGGER.info("External {} address found {}", type.toValue(), address);
        externalAddresses.append(externalAddressExport(type, address));
    }
    return write(FILE_EXTERNAL_ADDRESS, externalAddresses.toString());
}
Also used : NodeAddressType(io.strimzi.api.kafka.model.listener.NodeAddressType) NodeAddress(io.fabric8.kubernetes.api.model.NodeAddress)

Aggregations

NodeAddress (io.fabric8.kubernetes.api.model.NodeAddress)2 NodeAddressType (io.strimzi.api.kafka.model.listener.NodeAddressType)2