use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.
the class RestBackendImpl method getDomainsList.
private List<Domain> getDomainsList() {
CallBuilderFactory factory = ContainerResolver.getInstance().getContainer().getSPI(CallBuilderFactory.class);
Collection<List<Domain>> c = new ArrayList<List<Domain>>();
try {
for (String ns : targetNamespaces) {
DomainList dl = factory.create().listDomain(ns);
if (dl != null) {
c.add(dl.getItems());
}
}
return c.stream().flatMap(Collection::stream).collect(Collectors.toList());
} catch (ApiException e) {
throw handleApiException(e);
}
}
use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.
the class RestBackendImpl method getClusters.
/**
* {@inheritDoc}
*/
@Override
public Set<String> getClusters(String domainUID) {
LOGGER.entering(domainUID);
if (!isDomainUID(domainUID)) {
throw new AssertionError(formatMessage(MessageKeys.INVALID_DOMAIN_UID, domainUID));
}
authorize(domainUID, Operation.get);
// Get list of WLS Configured Clusters defined for the corresponding WLS Domain identified by Domain UID
Domain domain = findDomain(domainUID);
String namespace = getNamespace(domainUID);
String adminServerServiceName = getAdminServerServiceName(domain);
String adminSecretName = getAdminServiceSecretName(domain);
Map<String, WlsClusterConfig> wlsClusterConfigs = getWLSConfiguredClusters(namespace, adminServerServiceName, adminSecretName);
Set<String> result = wlsClusterConfigs.keySet();
LOGGER.exiting(result);
return result;
}
use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.
the class RestBackendImpl method scaleCluster.
/**
* {@inheritDoc}
*/
@Override
public void scaleCluster(String domainUID, String cluster, int managedServerCount) {
LOGGER.entering(domainUID, cluster, managedServerCount);
if (managedServerCount < 0) {
throw createWebApplicationException(Status.BAD_REQUEST, MessageKeys.INVALID_MANAGE_SERVER_COUNT, managedServerCount);
}
authorize(domainUID, cluster, Operation.update);
List<Domain> domains = getDomainsList();
Domain domain = findDomain(domainUID, domains);
String namespace = getNamespace(domainUID, domains);
verifyWLSConfiguredClusterCapacity(namespace, domain, cluster, managedServerCount);
updateReplicasForDomain(namespace, domain, cluster, managedServerCount);
LOGGER.exiting();
}
use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.
the class CallBuilder method listDomain.
/* Domains */
/**
* List domains
* @param namespace Namespace
* @return Domain list
* @throws ApiException API exception
*/
public DomainList listDomain(String namespace) throws ApiException {
String _continue = "";
ApiClient client = helper.take();
try {
return new WeblogicApi(client).listWebLogicOracleV1NamespacedDomain(namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
} finally {
helper.recycle(client);
}
}
use of oracle.kubernetes.weblogic.domain.v1.Domain in project weblogic-kubernetes-operator by oracle.
the class HealthCheckHelper method verifyDomainUidUniqueness.
/**
* Verify that domain UIDs are unique.
*
* @throws ApiException exception for k8s API
*/
private HashMap<String, Domain> verifyDomainUidUniqueness() throws ApiException {
CallBuilderFactory factory = ContainerResolver.getInstance().getContainer().getSPI(CallBuilderFactory.class);
HashMap<String, Domain> domainUIDMap = new HashMap<>();
for (String namespace : targetNamespaces) {
DomainList domainList = factory.create().listDomain(namespace);
LOGGER.info(MessageKeys.NUMBER_OF_DOMAINS_IN_NAMESPACE, domainList.getItems().size(), namespace);
// Verify that the domain UID is unique within the k8s cluster.
for (Domain domain : domainList.getItems()) {
Domain domain2 = domainUIDMap.put(domain.getSpec().getDomainUID(), domain);
// Domain UID already exist if not null
if (domain2 != null) {
logHealthCheckEvent(MessageKeys.DOMAIN_UID_UNIQUENESS_FAILED, domain.getSpec().getDomainUID(), domain.getMetadata().getName(), domain2.getMetadata().getName());
}
}
}
return domainUIDMap;
}
Aggregations