Search in sources :

Example 1 with ServerStartup

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

the class Main method normalizeDomainSpec.

// -----------------------------------------------------------------------------
// 
// Below this point are methods that are called primarily from watch handlers,
// after watch events are received.
// 
// -----------------------------------------------------------------------------
private static void normalizeDomainSpec(DomainSpec spec) {
    // Normalize DomainSpec so that equals() will work correctly
    String imageName = spec.getImage();
    if (imageName == null || imageName.length() == 0) {
        spec.setImage(imageName = KubernetesConstants.DEFAULT_IMAGE);
    }
    String imagePullPolicy = spec.getImagePullPolicy();
    if (imagePullPolicy == null || imagePullPolicy.length() == 0) {
        spec.setImagePullPolicy(imagePullPolicy = (imageName.endsWith(KubernetesConstants.LATEST_IMAGE_SUFFIX)) ? KubernetesConstants.ALWAYS_IMAGEPULLPOLICY : KubernetesConstants.IFNOTPRESENT_IMAGEPULLPOLICY);
    }
    if (spec.getExportT3Channels() == null) {
        spec.setExportT3Channels(new ArrayList<String>());
    }
    String startupControl = spec.getStartupControl();
    if (startupControl == null || startupControl.length() == 0) {
        spec.setStartupControl(startupControl = StartupControlConstants.AUTO_STARTUPCONTROL);
    }
    if (spec.getServerStartup() == null) {
        spec.setServerStartup(new ArrayList<ServerStartup>());
    } else {
        for (ServerStartup ss : spec.getServerStartup()) {
            if (ss.getDesiredState() == null) {
                ss.setDesiredState(RUNNING_STATE);
            }
            if (ss.getEnv() == null) {
                ss.setEnv(new ArrayList<V1EnvVar>());
            }
        }
    }
    if (spec.getClusterStartup() == null) {
        spec.setClusterStartup(new ArrayList<ClusterStartup>());
    } else {
        for (ClusterStartup cs : spec.getClusterStartup()) {
            if (cs.getDesiredState() == null) {
                cs.setDesiredState(RUNNING_STATE);
            }
            if (cs.getEnv() == null) {
                cs.setEnv(new ArrayList<V1EnvVar>());
            }
            if (cs.getReplicas() == null) {
                cs.setReplicas(1);
            }
        }
    }
    if (spec.getReplicas() == null) {
        spec.setReplicas(1);
    }
}
Also used : ClusterStartup(oracle.kubernetes.weblogic.domain.v1.ClusterStartup) ServerStartup(oracle.kubernetes.weblogic.domain.v1.ServerStartup) V1EnvVar(io.kubernetes.client.models.V1EnvVar)

Aggregations

V1EnvVar (io.kubernetes.client.models.V1EnvVar)1 ClusterStartup (oracle.kubernetes.weblogic.domain.v1.ClusterStartup)1 ServerStartup (oracle.kubernetes.weblogic.domain.v1.ServerStartup)1