Search in sources :

Example 56 with Build

use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.

the class BootstrapConfiguration method configureInternal.

void configureInternal(Map<String, ?> conf) throws Exception {
    configuration = configurer.configure(conf, this);
    if (Strings.isNullOrBlank(runtimeId)) {
        throw new IllegalArgumentException("Runtime id must not be null or empty.");
    }
    if (Strings.isNullOrBlank(localResolver)) {
        localResolver = globalResolver;
    }
    String decodedZookeeperPassword = null;
    Properties userProps = new Properties();
    try {
        userProps.load(new File(confDir, "users.properties"));
    } catch (IOException e) {
        LOGGER.warn("Failed to load users from etc/users.properties. No users will be imported.", e);
    }
    if (Strings.isNotBlank(zookeeperPassword)) {
        decodedZookeeperPassword = PasswordEncoder.decode(zookeeperPassword);
    } else if (userProps.containsKey(DEFAULT_ADMIN_USER)) {
        String passwordAndRole = userProps.getProperty(DEFAULT_ADMIN_USER).trim();
        decodedZookeeperPassword = passwordAndRole.substring(0, passwordAndRole.indexOf(ROLE_DELIMITER));
    } else {
        decodedZookeeperPassword = PasswordEncoder.encode(CreateEnsembleOptions.generatePassword());
    }
    // do not trigger io.fabric8.zookeeper update if restart is pending (fabric:join)
    if (!Boolean.getBoolean("karaf.restart") && zookeeperUrl != null && zookeeperPassword != null) {
        Configuration zkConfugiration = configAdmin.get().getConfiguration(Constants.ZOOKEEPER_CLIENT_PID);
        if (zkConfugiration.getProperties() == null) {
            Hashtable<String, Object> zkProperties = new Hashtable<>();
            zkProperties.put("zookeeper.url", zookeeperUrl);
            zkProperties.put("zookeeper.password", PasswordEncoder.encode(decodedZookeeperPassword));
            zkConfugiration.update(zkProperties);
        }
    }
    if (userProps.isEmpty()) {
        userProps.put(DEFAULT_ADMIN_USER, decodedZookeeperPassword + ROLE_DELIMITER + DEFAULT_ADMIN_ROLE);
    }
    String minimumPort = (String) configuration.get("minimum.port");
    if (!Strings.isNullOrBlank(minimumPort)) {
        this.minport = Integer.valueOf(minimumPort);
    }
    String maximumPort = (String) configuration.get("maximum.port");
    if (!Strings.isNullOrBlank(maximumPort)) {
        this.maxport = Integer.valueOf(maximumPort);
    }
    options = CreateEnsembleOptions.builder().bindAddress(bindAddress).agentEnabled(agentAutoStart).ensembleStart(ensembleAutoStart).zookeeperPassword(decodedZookeeperPassword).zooKeeperServerPort(zookeeperServerPort).zooKeeperServerConnectionPort(zookeeperServerConnectionPort).autoImportEnabled(profilesAutoImport).importPath(profilesAutoImportPath).resolver(localResolver).globalResolver(globalResolver).users(userProps).minimumPort(minport).maximumPort(maxport).profiles(profiles).version(version).build();
}
Also used : Configuration(org.osgi.service.cm.Configuration) Hashtable(java.util.Hashtable) IOException(java.io.IOException) RuntimeProperties(io.fabric8.api.RuntimeProperties) Properties(org.apache.felix.utils.properties.Properties) File(java.io.File)

Example 57 with Build

use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.

the class ConsumerControlMarshaller method looseUnmarshal.

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);
    ConsumerControl info = (ConsumerControl) o;
    info.setClose(dataIn.readBoolean());
    info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setPrefetch(dataIn.readInt());
}
Also used : ConsumerControl(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConsumerControl)

Example 58 with Build

use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.

the class ConsumerIdMarshaller method looseUnmarshal.

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);
    ConsumerId info = (ConsumerId) o;
    info.setConnectionId(looseUnmarshalString(dataIn));
    info.setSessionId(looseUnmarshalLong(wireFormat, dataIn));
    info.setValue(looseUnmarshalLong(wireFormat, dataIn));
}
Also used : ConsumerId(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConsumerId)

Example 59 with Build

use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.

the class ConsumerInfoMarshaller method tightUnmarshal.

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
    super.tightUnmarshal(wireFormat, o, dataIn, bs);
    ConsumerInfo info = (ConsumerInfo) o;
    info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setBrowser(bs.readBoolean());
    info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setPrefetchSize(dataIn.readInt());
    info.setMaximumPendingMessageLimit(dataIn.readInt());
    info.setDispatchAsync(bs.readBoolean());
    info.setSelector(tightUnmarshalString(dataIn, bs));
    info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
    info.setNoLocal(bs.readBoolean());
    info.setExclusive(bs.readBoolean());
    info.setRetroactive(bs.readBoolean());
    info.setPriority(dataIn.readByte());
    if (bs.readBoolean()) {
        short size = dataIn.readShort();
        BrokerId[] value = new BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info.setAdditionalPredicate((BooleanExpression) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setNetworkSubscription(bs.readBoolean());
    info.setOptimizedAcknowledge(bs.readBoolean());
    info.setNoRangeAcks(bs.readBoolean());
}
Also used : ConsumerInfo(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConsumerInfo) BrokerId(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.BrokerId)

Example 60 with Build

use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.

the class DataArrayResponseMarshaller method looseUnmarshal.

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);
    DataArrayResponse info = (DataArrayResponse) o;
    if (dataIn.readBoolean()) {
        short size = dataIn.readShort();
        DataStructure[] value = new DataStructure[size];
        for (int i = 0; i < size; i++) {
            value[i] = (DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn);
        }
        info.setData(value);
    } else {
        info.setData(null);
    }
}
Also used : DataStructure(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure) DataArrayResponse(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataArrayResponse)

Aggregations

Test (org.junit.Test)255 ArrayList (java.util.ArrayList)74 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)69 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)68 HashMap (java.util.HashMap)66 File (java.io.File)53 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)51 IOException (java.io.IOException)50 ConfigMapBuilder (io.fabric8.kubernetes.api.model.ConfigMapBuilder)45 Pod (io.fabric8.kubernetes.api.model.Pod)37 Map (java.util.Map)35 Service (io.fabric8.kubernetes.api.model.Service)34 FabricService (io.fabric8.api.FabricService)33 ResourceConfig (io.fabric8.maven.core.config.ResourceConfig)30 Container (io.fabric8.api.Container)29 RunImageConfiguration (io.fabric8.maven.docker.config.RunImageConfiguration)28 PodBuilder (io.fabric8.kubernetes.api.model.PodBuilder)27 List (java.util.List)26 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)25 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)25