use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.
the class DomainPresenceInfo method getAdmin.
/**
* Server objects (Pods and Services) for admin server
* @return Server objects for admin server
*/
public ServerKubernetesObjects getAdmin() {
Domain dom = domain.get();
DomainSpec spec = dom.getSpec();
return servers.get(spec.getAsName());
}
use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.
the class PodHelperConfigTest method getDomainCustomResourceForDefaults.
private Domain getDomainCustomResourceForDefaults(String image, String imagePullPolicy) {
DomainSpec spec = newDomainSpec();
spec.setDomainUID(DOMAIN_UID);
spec.setDomainName(DOMAIN_NAME);
spec.setAsName(ADMIN_SERVER_NAME);
spec.setAdminSecret(newSecretReference().name(WEBLOGIC_CREDENTIALS_SECRET_NAME));
spec.setAsPort(ADMIN_SERVER_PORT);
if (image != null) {
spec.setImage(image);
}
if (imagePullPolicy != null) {
spec.setImagePullPolicy(imagePullPolicy);
}
Domain domain = new Domain();
domain.setMetadata(newObjectMeta().namespace(NAMESPACE));
domain.setSpec(spec);
return domain;
}
use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.
the class Main method deleteDomainPresence.
private static void deleteDomainPresence(Domain dom) {
V1ObjectMeta meta = dom.getMetadata();
DomainSpec spec = dom.getSpec();
String namespace = meta.getNamespace();
String domainUID = spec.getDomainUID();
deleteDomainPresence(namespace, domainUID);
}
use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.
the class Main method scaleDownIfNecessary.
private static Step scaleDownIfNecessary(DomainPresenceInfo info, Collection<String> servers, Step next) {
Domain dom = info.getDomain();
DomainSpec spec = dom.getSpec();
boolean shouldStopAdmin = false;
String sc = spec.getStartupControl();
if (sc != null && StartupControlConstants.NONE_STARTUPCONTROL.equals(sc.toUpperCase())) {
shouldStopAdmin = true;
next = DomainStatusUpdater.createAvailableStep(DomainStatusUpdater.ALL_STOPPED_AVAILABLE_REASON, next);
}
String adminName = spec.getAsName();
Map<String, ServerKubernetesObjects> currentServers = info.getServers();
Collection<Map.Entry<String, ServerKubernetesObjects>> serversToStop = new ArrayList<>();
for (Map.Entry<String, ServerKubernetesObjects> entry : currentServers.entrySet()) {
if ((shouldStopAdmin || !entry.getKey().equals(adminName)) && !servers.contains(entry.getKey())) {
serversToStop.add(entry);
}
}
if (!serversToStop.isEmpty()) {
return new ServerDownIteratorStep(serversToStop, next);
}
return next;
}
use of oracle.kubernetes.weblogic.domain.v1.DomainSpec 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);
}
}
Aggregations