Search in sources :

Example 1 with Domain

use of oracle.kubernetes.weblogic.domain.v1.Domain in project camel by apache.

the class DomainProducer method doCreate.

private void doCreate(Exchange exchange) {
    final Domain in = messageToDomain(exchange.getIn());
    final Domain out = osV3Client.identity().domains().create(in);
    exchange.getIn().setBody(out);
}
Also used : Domain(org.openstack4j.model.identity.v3.Domain)

Example 2 with Domain

use of oracle.kubernetes.weblogic.domain.v1.Domain in project camel by apache.

the class DomainProducer method messageToDomain.

private Domain messageToDomain(Message message) {
    Domain domain = message.getBody(Domain.class);
    if (domain == null) {
        Map headers = message.getHeaders();
        DomainBuilder builder = Builders.domain();
        ObjectHelper.notEmpty(message.getHeader(OpenstackConstants.NAME, String.class), "Name");
        builder.name(message.getHeader(OpenstackConstants.NAME, String.class));
        if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
            builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
        }
        domain = builder.build();
    }
    return domain;
}
Also used : DomainBuilder(org.openstack4j.model.identity.v3.builder.DomainBuilder) Domain(org.openstack4j.model.identity.v3.Domain) Map(java.util.Map)

Example 3 with Domain

use of oracle.kubernetes.weblogic.domain.v1.Domain in project camel by apache.

the class DomainProducerTest method setUp.

@Before
public void setUp() {
    producer = new DomainProducer(endpoint, client);
    when(domainService.create(any(Domain.class))).thenReturn(testOSdomain);
    when(domainService.get(anyString())).thenReturn(testOSdomain);
    List<Domain> getAllList = new ArrayList<>();
    getAllList.add(testOSdomain);
    getAllList.add(testOSdomain);
    doReturn(getAllList).when(domainService).list();
    dummyDomain = createDomain();
    when(testOSdomain.getName()).thenReturn(dummyDomain.getName());
    when(testOSdomain.getDescription()).thenReturn(dummyDomain.getDescription());
}
Also used : DomainProducer(org.apache.camel.component.openstack.keystone.producer.DomainProducer) ArrayList(java.util.ArrayList) Domain(org.openstack4j.model.identity.v3.Domain) Before(org.junit.Before)

Example 4 with Domain

use of oracle.kubernetes.weblogic.domain.v1.Domain in project openstack4j by ContainX.

the class KeystoneDomainServiceTests method crud_domain_test.

// ------------ Domain Tests ------------
// Tests here just address the missing update() spec feature.
// Find more tests in the respective KeystoneXService.spec in
// core-integration-test module
public void crud_domain_test() throws Exception {
    // create a new domain
    Domain domain = Builders.domain().name(DOMAIN_NAME).description(DOMAIN_DESCRIPTION).enabled(true).build();
    respondWith(JSON_DOMAINS_CREATE);
    Domain newDomain = osv3().identity().domains().create(domain);
    assertEquals(newDomain.getName(), DOMAIN_NAME);
    assertEquals(newDomain.getDescription(), DOMAIN_DESCRIPTION);
    String DOMAIN_ID = newDomain.getId();
    // update an existing domain
    respondWith(JSON_DOMAINS_UPDATE);
    Domain updatedDomain = osv3().identity().domains().update(Builders.domain().id(DOMAIN_ID).description(DOMAIN_DESCRIPTION_UPDATED).enabled(true).build());
    assertEquals(updatedDomain.getId(), DOMAIN_ID);
    assertEquals(updatedDomain.getName(), DOMAIN_NAME);
    assertEquals(updatedDomain.getDescription(), DOMAIN_DESCRIPTION_UPDATED);
}
Also used : Domain(org.openstack4j.model.identity.v3.Domain)

Example 5 with Domain

use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.

the class Main method adminChannelsToCreate.

/**
 * This method checks the domain spec against any configured network
 * access points defined for the domain. This implementation only handles T3
 * protocol for externalization.
 *
 * @param scan      WlsDomainConfig from discovery containing configuration
 * @param dom       Domain containing Domain resource information
 * @return Validated collection of network access points
 */
public static Collection<NetworkAccessPoint> adminChannelsToCreate(WlsDomainConfig scan, Domain dom) {
    LOGGER.entering();
    // The following hard-coded values for the nodePort min/max ranges are
    // provided here until the appropriate API is discovered to obtain
    // this information from Kubernetes.
    Integer nodePortMin = 30000;
    Integer nodePortMax = 32767;
    DomainSpec spec = dom.getSpec();
    if (spec.getExportT3Channels() == null) {
        return null;
    }
    WlsServerConfig adminServerConfig = scan.getServerConfig(spec.getAsName());
    List<NetworkAccessPoint> naps = adminServerConfig.getNetworkAccessPoints();
    // This will become a list of valid channels to create services for.
    Collection<NetworkAccessPoint> channels = new ArrayList<>();
    // Pick out externalized channels from the server channels list
    for (String incomingChannel : spec.getExportT3Channels()) {
        boolean missingChannel = true;
        for (NetworkAccessPoint nap : naps) {
            if (nap.getName().equalsIgnoreCase(incomingChannel)) {
                missingChannel = false;
                channels.add(nap);
                break;
            }
        }
        if (missingChannel) {
            LOGGER.warning(MessageKeys.EXCH_CHANNEL_NOT_DEFINED, incomingChannel, spec.getAsName());
        }
    }
    // Iterate through the selected channels and validate
    Collection<NetworkAccessPoint> validatedChannels = new ArrayList<>();
    for (NetworkAccessPoint nap : channels) {
        // Only supporting T3 for now.
        if (!nap.getProtocol().equalsIgnoreCase("t3")) {
            LOGGER.severe(MessageKeys.EXCH_WRONG_PROTOCOL, nap.getName(), nap.getProtocol());
            continue;
        }
        // Until otherwise determined, ports must be the same.
        if (!nap.getListenPort().equals(nap.getPublicPort())) {
            // log a warning and ignore this item.
            LOGGER.warning(MessageKeys.EXCH_UNEQUAL_LISTEN_PORTS, nap.getName());
            continue;
        }
        // Make sure configured port is within NodePort range.
        if (nap.getListenPort().compareTo(nodePortMin) < 0 || nap.getListenPort().compareTo(nodePortMax) > 0) {
            // port setting is outside the NodePort range limits
            LOGGER.warning(MessageKeys.EXCH_OUTSIDE_RANGE, nap.getName(), nap.getPublicPort(), nodePortMin, nodePortMax);
            continue;
        }
        validatedChannels.add(nap);
    }
    LOGGER.exiting();
    return validatedChannels;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) WlsServerConfig(oracle.kubernetes.operator.wlsconfig.WlsServerConfig) DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) NetworkAccessPoint(oracle.kubernetes.operator.wlsconfig.NetworkAccessPoint) ArrayList(java.util.ArrayList)

Aggregations

Domain (oracle.kubernetes.weblogic.domain.v1.Domain)33 Type (java.lang.reflect.Type)18 DomainSpec (oracle.kubernetes.weblogic.domain.v1.DomainSpec)11 ProgressRequestBody (io.kubernetes.client.ProgressRequestBody)9 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)9 DomainList (oracle.kubernetes.weblogic.domain.v1.DomainList)7 Domain (org.openstack4j.model.identity.v3.Domain)7 V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)5 ArrayList (java.util.ArrayList)5 CallBuilderFactory (oracle.kubernetes.operator.helpers.CallBuilderFactory)5 ClusterStartup (oracle.kubernetes.weblogic.domain.v1.ClusterStartup)5 Test (org.junit.Test)5 ApiException (io.kubernetes.client.ApiException)4 Map (java.util.Map)4 V1Service (io.kubernetes.client.models.V1Service)3 HashMap (java.util.HashMap)3 WlsServerConfig (oracle.kubernetes.operator.wlsconfig.WlsServerConfig)3 Packet (oracle.kubernetes.operator.work.Packet)3 HttpUserAgentTest (com.meterware.pseudoserver.HttpUserAgentTest)2 V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)2