Skip to content

Commit 3d12b53

Browse files
committed
Merge remote-tracking branch 'origin/develop' into quickstart-sample-updates
2 parents 1c98317 + 558f25e commit 3d12b53

File tree

17 files changed

+227
-154
lines changed

17 files changed

+227
-154
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ maintained for one release after a replacement is available.
5252

5353
# About this documentation
5454

55-
This documentation includes sections aimed at different audiences. To help you find what you are looking for more easily,
55+
This documentation includes sections targeted to different audiences. To help you find what you are looking for more easily,
5656
please consult this table of contents:
5757

58-
* The [Quick start guide](site/quickstart.md) explains how to just get the operator running quickly, using all the defaults, nothing special.
59-
* The [User guide](site/user-guide.md) contains detailed information for users of the operator, including how to install and configure it,
58+
* The [Quick start guide](site/quickstart.md) explains how to quickly get the operator running, using the defaults, nothing special.
59+
* The [User guide](site/user-guide.md) contains detailed usage information, including how to install and configure the operator,
6060
and how to use it to create and manage WebLogic domains.
61-
* Our [Samples](kubernetes/samples/README.md) provide detailed example code and instructions that show you how to perform
61+
* The [Samples](kubernetes/samples/README.md) provide detailed example code and instructions that show you how to perform
6262
various tasks related to the operator.
6363
* The [Developer guide](site/developer.md) provides details for people who want to understand how the operator is built, tested, and so on. Those who wish to contribute to the operator code will find useful information here. This section also includes
6464
API documentation (Javadoc) and Swagger/OpenAPI documentation for the REST APIs.
@@ -81,7 +81,7 @@ The [User guide](site/user-guide.md) provides detailed information about all asp
8181

8282
# Samples
8383

84-
Please refer to our [samples](kubernetes/samples/README.md) for information about the available sample code we provide.
84+
Please refer to our [samples](kubernetes/samples/README.md) for information about the available sample code.
8585

8686
# Need more help? Have a suggestion? Come and say "Hello!"
8787

@@ -98,17 +98,17 @@ See [Recent changes](site/recent-changes.md) for changes to the operator, includ
9898

9999
Developers interested in this project are encouraged to read the [Developer guide](site/developer.md) to learn how to build the project, run tests, and so on. The Developer guide also provides details about the structure of the code, coding standards, and the Asynchronous Call facility used in the code to manage calls to the Kubernetes API.
100100

101-
Please take a look at our [wish list](https://github.com/oracle/weblogic-kubernetes-operator/wiki/Wish-list) to get an idea of the kind of features we would like to add to the operator. Maybe you will see something you would like to contribute to!
101+
Please take a look at our [wish list](https://github.com/oracle/weblogic-kubernetes-operator/wiki/Wish-list) to get an idea of the kind of features we would like to add to the operator. Maybe you will see something to which you would like to contribute!
102102

103103
## API documentation
104104

105105
Documentation for APIs is provided here:
106106

107-
* The operator provides a REST API that you can use to obtain information about the configuration and to initiate scaling actions. For details about how to use the REST APIs, see [Using the operator's REST services](site/rest.md).
107+
* The operator provides a REST API that you can use to obtain configuration information and to initiate scaling actions. For details about how to use the REST APIs, see [Using the operator's REST services](site/rest.md).
108108

109109
* See the [Swagger](https://oracle.github.io/weblogic-kubernetes-operator/swagger/index.html) documentation for the operator's REST interface.
110110

111-
* [Javadoc](https://oracle.github.io/weblogic-kubernetes-operator/apidocs/index.html) for the operator.
111+
* See the [Javadoc](https://oracle.github.io/weblogic-kubernetes-operator/apidocs/index.html) for the operator.
112112

113113
# Contributing to the operator
114114

kubernetes/samples/scripts/elasticsearch-and-kibana/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
# Sample to deploy Elasticsearch and Kibana
22

33

4-
When a user installs the WebLogic operator Helm chart, the user can set
5-
`elkIntegrationEnabled` to `true` in their `values.yaml` to tell the operator to send the
6-
contents of the operator's logs to Elasticsearch.
4+
When you install the WebLogic operator Helm chart, you can set
5+
`elkIntegrationEnabled` to `true` in your `values.yaml` file to tell the operator to send the contents of the operator's logs to Elasticsearch.
76

8-
Typically, a user would have already configured Elasticsearch and Kibana in the
9-
Kubernetes cluster, and also would specify `elasticSearchHost` and `elasticSearchPort`
10-
in their `values.yaml` file to point to where Elasticsearch is already running.
7+
Typically, you would have already configured Elasticsearch and Kibana in the
8+
Kubernetes cluster, and also would have specified `elasticSearchHost` and `elasticSearchPort` in your `values.yaml` file to point to where Elasticsearch is already running.
119

1210
This sample configures the Elasticsearch and Kibana deployments and services.
1311
It's useful for trying out the operator in a Kubernetes cluster that doesn't already
1412
have them configured.
1513

16-
It runs Elasticstack on the same host and port that the operator's Helm chart defaults
17-
to, therefore, the customer only needs to set `elkIntegrationEnabled` to `true` in their
14+
It runs the Elastic Stack on the same host and port that the operator's Helm chart defaults
15+
to, therefore, you only need to set `elkIntegrationEnabled` to `true` in your
1816
`values.yaml` file.
1917

20-
To install ElasticSearch and Kibana, use:
18+
To install Elasticsearch and Kibana, use:
2119
```
2220
$ kubectl apply -f kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml
2321
```

operator/src/main/java/oracle/kubernetes/operator/Watcher.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018 Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019 Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -126,13 +126,7 @@ private void watchForEvents() {
126126
.withResourceVersion(resourceVersion.toString())
127127
.withTimeoutSeconds(tuning.watchLifetime))) {
128128
while (watch.hasNext()) {
129-
Watch.Response<T> item;
130-
try {
131-
item = watch.next();
132-
} catch (Throwable e) {
133-
watch.discardClient();
134-
throw e;
135-
}
129+
Watch.Response<T> item = watch.next();
136130

137131
if (isStopping()) setIsDraining(true);
138132
if (isDraining()) continue;

operator/src/main/java/oracle/kubernetes/operator/builders/WatchI.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019 Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -14,6 +14,4 @@
1414
* @param <T> the generic object type
1515
*/
1616
public interface WatchI<T>
17-
extends Iterable<Watch.Response<T>>, Iterator<Watch.Response<T>>, java.io.Closeable {
18-
default void discardClient() {}
19-
}
17+
extends Iterable<Watch.Response<T>>, Iterator<Watch.Response<T>>, java.io.Closeable {}

operator/src/main/java/oracle/kubernetes/operator/builders/WatchImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019 Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -28,12 +28,7 @@ public class WatchImpl<T> implements WatchI<T> {
2828
@Override
2929
public void close() throws IOException {
3030
impl.close();
31-
pool.recycle(client);
32-
}
33-
34-
@Override
35-
public void discardClient() {
36-
client = pool.take();
31+
if (client != null) pool.recycle(client);
3732
}
3833

3934
@Override
@@ -49,6 +44,11 @@ public boolean hasNext() {
4944

5045
@Override
5146
public Watch.Response<T> next() {
52-
return impl.next();
47+
try {
48+
return impl.next();
49+
} catch (Exception e) {
50+
client = null;
51+
throw e;
52+
}
5353
}
5454
}

operator/src/main/java/oracle/kubernetes/operator/helpers/ClientPool.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019 Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -17,7 +17,7 @@
1717

1818
public class ClientPool extends Pool<ApiClient> {
1919
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
20-
private static final ClientPool SINGLETON = new ClientPool();
20+
private static ClientPool SINGLETON = new ClientPool();
2121

2222
private static final ClientFactory FACTORY = new DefaultClientFactory();
2323

@@ -27,8 +27,6 @@ public static ClientPool getInstance() {
2727

2828
private final AtomicBoolean isFirst = new AtomicBoolean(true);
2929

30-
private ClientPool() {}
31-
3230
@Override
3331
protected ApiClient create() {
3432
return getApiClient();

operator/src/main/java/oracle/kubernetes/operator/helpers/Pool.java

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019 Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

55
package oracle.kubernetes.operator.helpers;
66

7-
import java.lang.ref.WeakReference;
7+
import java.util.Queue;
88
import java.util.concurrent.ConcurrentLinkedQueue;
99
import oracle.kubernetes.operator.logging.LoggingFacade;
1010
import oracle.kubernetes.operator.logging.LoggingFactory;
@@ -14,7 +14,7 @@ public abstract class Pool<T> {
1414
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
1515

1616
// volatile since multiple threads may access queue reference
17-
private volatile WeakReference<ConcurrentLinkedQueue<T>> queue;
17+
private volatile Queue<T> queue = new ConcurrentLinkedQueue<>();
1818

1919
/**
2020
* Gets a new object from the pool. If no object is available in the pool, this method creates a
@@ -36,20 +36,8 @@ public final T take() {
3636
return instance;
3737
}
3838

39-
private ConcurrentLinkedQueue<T> getQueue() {
40-
WeakReference<ConcurrentLinkedQueue<T>> referenceQueue = queue;
41-
if (referenceQueue != null) {
42-
ConcurrentLinkedQueue<T> returnQueue = referenceQueue.get();
43-
if (returnQueue != null) {
44-
return returnQueue;
45-
}
46-
}
47-
48-
// overwrite the queue
49-
ConcurrentLinkedQueue<T> d = new ConcurrentLinkedQueue<>();
50-
queue = new WeakReference<>(d);
51-
52-
return d;
39+
protected Queue<T> getQueue() {
40+
return queue;
5341
}
5442

5543
/**
@@ -72,9 +60,4 @@ public final void recycle(T instance) {
7260
* @return Created instance
7361
*/
7462
protected abstract T create();
75-
76-
/** Drains pool of all entries; useful for unit-testing */
77-
public void drain() {
78-
getQueue().clear();
79-
}
8063
}

operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,5 @@ private MessageKeys() {}
146146
public static final String CANNOT_PARSE_INTROSPECTOR_FILE = "WLSKO-0143";
147147
public static final String CANNOT_START_DOMAIN_AFTER_MAX_RETRIES = "WLSKO-0144";
148148
public static final String CYCLING_POD = "WLSKO-0145";
149+
public static final String REPLICAS_EXCEEDS_TOTAL_CLUSTER_SERVER_COUNT = "WLSKO-0146";
149150
}

operator/src/main/java/oracle/kubernetes/operator/steps/ManagedServersUpStep.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import oracle.kubernetes.operator.helpers.ServerKubernetesObjects;
1414
import oracle.kubernetes.operator.logging.LoggingFacade;
1515
import oracle.kubernetes.operator.logging.LoggingFactory;
16+
import oracle.kubernetes.operator.logging.MessageKeys;
1617
import oracle.kubernetes.operator.wlsconfig.WlsClusterConfig;
1718
import oracle.kubernetes.operator.wlsconfig.WlsDomainConfig;
1819
import oracle.kubernetes.operator.wlsconfig.WlsServerConfig;
@@ -63,6 +64,17 @@ void addServerIfNeeded(@Nonnull WlsServerConfig serverConfig, WlsClusterConfig c
6364
}
6465
}
6566

67+
boolean exceedsMaxConfiguredClusterSize(WlsClusterConfig clusterConfig) {
68+
if (clusterConfig != null) {
69+
String clusterName = clusterConfig.getClusterName();
70+
int configMaxClusterSize = clusterConfig.getMaxDynamicClusterSize();
71+
return clusterConfig.hasDynamicServers()
72+
&& clusterConfig.getServerConfigs().size() == configMaxClusterSize
73+
&& domain.getReplicaCount(clusterName) > configMaxClusterSize;
74+
}
75+
return false;
76+
}
77+
6678
private Step createNextStep(Step next) {
6779
if (servers.isEmpty()) return next;
6880
else return new ManagedServerUpIteratorStep(getStartupInfos(), next);
@@ -84,6 +96,17 @@ private void addToCluster(String clusterName) {
8496
private Integer getReplicaCount(String clusterName) {
8597
return Optional.ofNullable(replicas.get(clusterName)).orElse(0);
8698
}
99+
100+
private void logIfReplicasExceedsClusterServersMax(WlsClusterConfig clusterConfig) {
101+
if (exceedsMaxConfiguredClusterSize(clusterConfig)) {
102+
String clusterName = clusterConfig.getClusterName();
103+
LOGGER.warning(
104+
MessageKeys.REPLICAS_EXCEEDS_TOTAL_CLUSTER_SERVER_COUNT,
105+
domain.getReplicaCount(clusterName),
106+
clusterConfig.getMaxDynamicClusterSize(),
107+
clusterName);
108+
}
109+
}
87110
}
88111

89112
public ManagedServersUpStep(Step next) {
@@ -105,6 +128,7 @@ public NextAction apply(Packet packet) {
105128
Set<String> clusteredServers = new HashSet<>();
106129

107130
for (WlsClusterConfig clusterConfig : config.getClusterConfigs().values()) {
131+
factory.logIfReplicasExceedsClusterServersMax(clusterConfig);
108132
for (WlsServerConfig serverConfig : clusterConfig.getServerConfigs()) {
109133
factory.addServerIfNeeded(serverConfig, clusterConfig);
110134
clusteredServers.add(serverConfig.getName());

operator/src/main/resources/Operator.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,5 @@ WLSKO-0141=Failed to parse WebLogic Domain topology due to exception: {0}
143143
WLSKO-0142=Failed to parse results from domain introspector for domain {0} due to exception: {1}
144144
WLSKO-0143=Failed to parse file {0} from domain introspector for domain {1} due to exception: {2}
145145
WLSKO-0144=Unable to start domain with domainUID {0} in namespace {1} after {2} attempts due to exception: {3}
146-
WLSKO-0145=Replacing pod {0} with {1}
146+
WLSKO-0145=Replacing pod {0} with {1}
147+
WLSKO-0146=Replica request of {0} exceeds the maximum dynamic server count + server count of {1} configured for cluster {2}

0 commit comments

Comments
 (0)