Search in sources :

Example 26 with Domain

use of org.openstack4j.model.identity.v3.Domain in project weblogic-kubernetes-operator by oracle.

the class Main method doCheckAndCreateDomainPresence.

private static void doCheckAndCreateDomainPresence(Domain dom, boolean explicitRecheck, boolean explicitRestartAdmin, List<String> explicitRestartServers, List<String> explicitRestartClusters) {
    LOGGER.entering();
    boolean hasExplicitRestarts = explicitRestartAdmin || explicitRestartServers != null || explicitRestartClusters != null;
    DomainSpec spec = dom.getSpec();
    normalizeDomainSpec(spec);
    String domainUID = spec.getDomainUID();
    DomainPresenceInfo created = new DomainPresenceInfo(dom);
    DomainPresenceInfo info = domains.putIfAbsent(domainUID, created);
    if (info == null) {
        info = created;
    } else {
        // Has the spec actually changed?  We will get watch events for status updates
        Domain current = info.getDomain();
        if (current != null) {
            if (!explicitRecheck && !hasExplicitRestarts && spec.equals(current.getSpec())) {
                // nothing in the spec has changed
                LOGGER.fine(MessageKeys.NOT_STARTING_DOMAINUID_THREAD, domainUID);
                return;
            }
        }
        info.setDomain(dom);
    }
    String ns = dom.getMetadata().getNamespace();
    if (initialized.getOrDefault(ns, Boolean.FALSE) && !stopping.get()) {
        LOGGER.info(MessageKeys.PROCESSING_DOMAIN, domainUID);
        Step managedServerStrategy = bringManagedServersUp(DomainStatusUpdater.createEndProgressingStep(null));
        Step adminServerStrategy = bringAdminServerUp(connectToAdminAndInspectDomain(managedServerStrategy));
        Step strategy = DomainStatusUpdater.createProgressingStep(DomainStatusUpdater.INSPECTING_DOMAIN_PROGRESS_REASON, true, new DomainPrescenceStep(adminServerStrategy, managedServerStrategy));
        Packet p = new Packet();
        PodWatcher pw = podWatchers.get(ns);
        p.getComponents().put(ProcessingConstants.DOMAIN_COMPONENT_NAME, Component.createFor(info, version, pw));
        p.put(ProcessingConstants.PRINCIPAL, principal);
        if (explicitRestartAdmin) {
            p.put(ProcessingConstants.EXPLICIT_RESTART_ADMIN, Boolean.TRUE);
        }
        p.put(ProcessingConstants.EXPLICIT_RESTART_SERVERS, explicitRestartServers);
        p.put(ProcessingConstants.EXPLICIT_RESTART_CLUSTERS, explicitRestartClusters);
        if (explicitRestartAdmin) {
            LOGGER.info(MessageKeys.RESTART_ADMIN_STARTING, domainUID);
        }
        if (explicitRestartServers != null) {
            LOGGER.info(MessageKeys.RESTART_SERVERS_STARTING, domainUID, explicitRestartServers);
        }
        if (explicitRestartClusters != null) {
            LOGGER.info(MessageKeys.ROLLING_CLUSTERS_STARTING, domainUID, explicitRestartClusters);
        }
        domainUpdaters.startFiber(domainUID, strategy, p, new CompletionCallback() {

            @Override
            public void onCompletion(Packet packet) {
                if (explicitRestartAdmin) {
                    LOGGER.info(MessageKeys.RESTART_ADMIN_COMPLETE, domainUID);
                }
                if (explicitRestartServers != null) {
                    LOGGER.info(MessageKeys.RESTART_SERVERS_COMPLETE, domainUID, explicitRestartServers);
                }
                if (explicitRestartClusters != null) {
                    LOGGER.info(MessageKeys.ROLLING_CLUSTERS_COMPLETE, domainUID, explicitRestartClusters);
                }
            }

            @Override
            public void onThrowable(Packet packet, Throwable throwable) {
                LOGGER.severe(MessageKeys.EXCEPTION, throwable);
                domainUpdaters.startFiberIfLastFiberMatches(domainUID, Fiber.getCurrentIfSet(), DomainStatusUpdater.createFailedStep(throwable, null), p, new CompletionCallback() {

                    @Override
                    public void onCompletion(Packet packet) {
                    // no-op
                    }

                    @Override
                    public void onThrowable(Packet packet, Throwable throwable) {
                        LOGGER.severe(MessageKeys.EXCEPTION, throwable);
                    }
                });
            // TODO: consider retrying domain update after a delay
            }
        });
        scheduleDomainStatusUpdating(info);
    }
    LOGGER.exiting();
}
Also used : Packet(oracle.kubernetes.operator.work.Packet) DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) CompletionCallback(oracle.kubernetes.operator.work.Fiber.CompletionCallback) Step(oracle.kubernetes.operator.work.Step) ResponseStep(oracle.kubernetes.operator.helpers.ResponseStep) Domain(oracle.kubernetes.weblogic.domain.v1.Domain) DomainPresenceInfo(oracle.kubernetes.operator.helpers.DomainPresenceInfo)

Example 27 with Domain

use of org.openstack4j.model.identity.v3.Domain in project weblogic-kubernetes-operator by oracle.

the class WeblogicApi method readWebLogicOracleV1NamespacedDomainWithHttpInfo.

/**
 * read the specified Domain
 *
 * @param name
 *          name of the Domain (required)
 * @param namespace
 *          object name and auth scope, such as for teams and projects
 *          (required)
 * @param pretty
 *          If &#39;true&#39;, then the output is pretty printed. (optional)
 * @param exact
 *          Should the export be exact. Exact export maintains cluster-specific
 *          fields like &#39;Namespace&#39;. (optional)
 * @param export
 *          Should this value be exported. Export strips fields that a user can
 *          not specify. (optional)
 * @return ApiResponse&lt;Domain&gt;
 * @throws ApiException
 *           If fail to call the API, e.g. server error or cannot deserialize
 *           the response body
 */
public ApiResponse<Domain> readWebLogicOracleV1NamespacedDomainWithHttpInfo(String name, String namespace, String pretty, Boolean exact, Boolean export) throws ApiException {
    com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainValidateBeforeCall(name, namespace, pretty, exact, export, null, null);
    Type localVarReturnType = new TypeToken<Domain>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}
Also used : Type(java.lang.reflect.Type) Domain(oracle.kubernetes.weblogic.domain.v1.Domain)

Example 28 with Domain

use of org.openstack4j.model.identity.v3.Domain in project weblogic-kubernetes-operator by oracle.

the class WeblogicApi method replaceWebLogicOracleV1NamespacedDomainAsync.

/**
 * (asynchronously) replace the specified Domain
 *
 * @param name
 *          name of the Domain (required)
 * @param namespace
 *          object name and auth scope, such as for teams and projects
 *          (required)
 * @param body
 *          (required)
 * @param pretty
 *          If &#39;true&#39;, then the output is pretty printed. (optional)
 * @param callback
 *          The callback to be executed when the API call finishes
 * @return The request call
 * @throws ApiException
 *           If fail to process the API call, e.g. serializing the request body
 *           object
 */
public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainAsync(String name, String namespace, Domain body, String pretty, final ApiCallback<Domain> callback) throws ApiException {
    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
    if (callback != null) {
        progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done);
        progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done);
    }
    com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainValidateBeforeCall(name, namespace, body, pretty, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<Domain>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}
Also used : Type(java.lang.reflect.Type) ProgressResponseBody(io.kubernetes.client.ProgressResponseBody) Domain(oracle.kubernetes.weblogic.domain.v1.Domain) ProgressRequestBody(io.kubernetes.client.ProgressRequestBody)

Example 29 with Domain

use of org.openstack4j.model.identity.v3.Domain in project weblogic-kubernetes-operator by oracle.

the class WeblogicApi method createWebLogicOracleV1NamespacedDomainAsync.

/**
 * (asynchronously) create a Domain
 *
 * @param namespace
 *          object name and auth scope, such as for teams and projects
 *          (required)
 * @param body
 *          (required)
 * @param pretty
 *          If &#39;true&#39;, then the output is pretty printed. (optional)
 * @param callback
 *          The callback to be executed when the API call finishes
 * @return The request call
 * @throws ApiException
 *           If fail to process the API call, e.g. serializing the request body
 *           object
 */
public com.squareup.okhttp.Call createWebLogicOracleV1NamespacedDomainAsync(String namespace, Domain body, String pretty, final ApiCallback<Domain> callback) throws ApiException {
    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
    if (callback != null) {
        progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done);
        progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done);
    }
    com.squareup.okhttp.Call call = createWebLogicOracleV1NamespacedDomainValidateBeforeCall(namespace, body, pretty, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<Domain>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}
Also used : Type(java.lang.reflect.Type) ProgressResponseBody(io.kubernetes.client.ProgressResponseBody) Domain(oracle.kubernetes.weblogic.domain.v1.Domain) ProgressRequestBody(io.kubernetes.client.ProgressRequestBody)

Example 30 with Domain

use of org.openstack4j.model.identity.v3.Domain in project weblogic-kubernetes-operator by oracle.

the class WeblogicApi method readWebLogicOracleV1NamespacedDomainStatusWithHttpInfo.

/**
 * read status of the specified Domain
 *
 * @param name
 *          name of the Domain (required)
 * @param namespace
 *          object name and auth scope, such as for teams and projects
 *          (required)
 * @param pretty
 *          If &#39;true&#39;, then the output is pretty printed. (optional)
 * @return ApiResponse&lt;Domain&gt;
 * @throws ApiException
 *           If fail to call the API, e.g. server error or cannot deserialize
 *           the response body
 */
public ApiResponse<Domain> readWebLogicOracleV1NamespacedDomainStatusWithHttpInfo(String name, String namespace, String pretty) throws ApiException {
    com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall(name, namespace, pretty, null, null);
    Type localVarReturnType = new TypeToken<Domain>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}
Also used : Type(java.lang.reflect.Type) Domain(oracle.kubernetes.weblogic.domain.v1.Domain)

Aggregations

Domain (oracle.kubernetes.weblogic.domain.v1.Domain)33 Type (java.lang.reflect.Type)14 ProgressRequestBody (io.kubernetes.client.ProgressRequestBody)7 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)7 DomainSpec (oracle.kubernetes.weblogic.domain.v1.DomainSpec)7 Domain (org.openstack4j.model.identity.v3.Domain)7 V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)4 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 ApiException (io.kubernetes.client.ApiException)3 V1Service (io.kubernetes.client.models.V1Service)3 HashMap (java.util.HashMap)3 ConcurrentMap (java.util.concurrent.ConcurrentMap)3 CallBuilderFactory (oracle.kubernetes.operator.helpers.CallBuilderFactory)3 Packet (oracle.kubernetes.operator.work.Packet)3 Test (org.junit.Test)3 HttpUserAgentTest (com.meterware.pseudoserver.HttpUserAgentTest)2 V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)2 V1ServiceList (io.kubernetes.client.models.V1ServiceList)2 List (java.util.List)2