Skip to content

Commit cffb17d

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into conficluster-tests
2 parents f3fa84f + 12ef9b4 commit cffb17d

File tree

674 files changed

+22192
-1747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+22192
-1747
lines changed

docs-source/.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"git.ignoreLimitWarning": true
3+
}

docs-source/archetypes/default.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: {{ .Date }}
4+
draft: false
5+
---
6+

docs-source/config.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
baseURL = "/weblogic-kubernetes-operator/"
2+
languageCode = "en-us"
3+
title = "WebLogic Kubernetes Operator"
4+
5+
# Change the default theme to be use when building the site with Hugo
6+
theme = "hugo-theme-learn"
7+
8+
publishDir = "docs"
9+
10+
# For search functionality
11+
[outputs]
12+
home = [ "HTML", "RSS", "JSON"]
13+

docs-source/content/_index.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
### Oracle WebLogic Server Kubernetes Operator
2+
3+
Oracle is finding ways for organizations using WebLogic Server to run important workloads, to move those workloads into the cloud. By certifying on industry standards, such as Docker and Kubernetes, WebLogic now runs in a cloud neutral infrastructure. In addition, we've provided an open-source Oracle WebLogic Server Kubernetes Operator (the “operator”) which has several key features to assist you with deploying and managing WebLogic domains in a Kubernetes environment. You can:
4+
5+
* Create WebLogic domains in a Kubernetes persistent volume. This persistent volume can reside in an NFS file system or other Kubernetes volume types.
6+
* Create a WebLogic domain in a Docker image.
7+
* Override certain aspects of the WebLogic domain configuration.
8+
* Define WebLogic domains as a Kubernetes resource (using a Kubernetes custom resource definition).
9+
* Start servers based on declarative startup parameters and desired states.
10+
* Manage WebLogic configured or dynamic clusters.
11+
* Expose the WebLogic Server Administration Console outside the Kubernetes cluster, if desired.
12+
* Expose T3 channels outside the Kubernetes domain, if desired.
13+
* Expose HTTP paths on a WebLogic domain outside the Kubernetes domain with load balancing and update the load balancer when Managed Servers in the WebLogic domain are started or stopped.
14+
* Scale WebLogic domains by starting and stopping Managed Servers on demand, or by integrating with a REST API to initiate scaling based on WLDF, Prometheus, Grafana, or other rules.
15+
* Publish operator and WebLogic Server logs into Elasticsearch and interact with them in Kibana.
16+
17+
The fastest way to experience the operator is to follow the [Quick Start guide]({{< relref "/quickstart/_index.md" >}}), or you can peruse our [documentation]({{< relref "/userguide/_index.md" >}}), read our [blogs](https://blogs.oracle.com/weblogicserver/updated-weblogic-kubernetes-support-with-operator-20), or try out the [samples]({{< relref "/samples/_index.md" >}}).
18+
19+
***
20+
The [current release of the operator](https://github.com/oracle/weblogic-kubernetes-operator/releases) is 2.0.1.
21+
This release was published on March 4, 2019.
22+
***
23+
24+
#### Operator earlier versions
25+
26+
Documentation for prior releases of the operator is available [here](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/site/README.md).
27+
28+
#### Backward compatibility guidelines
29+
30+
Starting from the 2.0 release, operator releases are backward compatible with respect to the domain
31+
resource schema, operator Helm chart input values, configuration overrides template, Kubernetes resources created
32+
by the operator Helm chart, Kubernetes resources created by the operator, and the operator REST interface. We intend to
33+
maintain compatibility for three releases, except in the case of a clearly communicated deprecated feature, which will be
34+
maintained for one release after a replacement is available.
35+
36+
### About this documentation
37+
38+
This documentation includes sections targeted to different audiences. To help you find what you are looking for more easily,
39+
please consult this table of contents:
40+
41+
* The [Quick Start guide]({{< relref "/quickstart/_index.md" >}}) explains how to quickly get the operator running, using the defaults, nothing special.
42+
* The [User guide]({{< relref "/userguide/_index.md" >}}) contains detailed usage information, including how to install and configure the operator,
43+
and how to use it to create and manage WebLogic domains.
44+
* The [Samples]({{< relref "/samples/_index.md" >}}) provide detailed example code and instructions that show you how to perform
45+
various tasks related to the operator.
46+
* The [Developer guide]({{< relref "/developerguide/_index.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
47+
API documentation (Javadoc) and Swagger/OpenAPI documentation for the REST APIs.
48+
* The [Contributing](#contributing-to-the-operator) section provides information about contribution requirements.
49+
50+
51+
### User guide
52+
53+
The [User guide]({{< relref "/userguide/_index.md" >}}) provides detailed information about all aspects of using the operator including:
54+
55+
* Installing and configuring the operator.
56+
* Using the operator to create and manage WebLogic domains.
57+
* Manually creating WebLogic domains to be managed by the operator.
58+
* Scaling WebLogic clusters.
59+
* Configuring Kubernetes load balancers.
60+
* Configuring Elasticsearch and Kibana to access the operator's log files.
61+
* Shutting down domains.
62+
* Removing/deleting domains.
63+
* And much more!
64+
65+
### Samples
66+
67+
Please refer to our [samples]({{< relref "/samples/_index.md" >}}) for information about the available sample code.
68+
69+
### Need more help? Have a suggestion? Come and say, "Hello!"
70+
71+
We have a **public Slack channel** where you can get in touch with us to ask questions about using the operator or give us feedback
72+
or suggestions about what features and improvements you would like to see. We would love to hear from you. To join our channel,
73+
please [visit this site to get an invitation](https://weblogic-slack-inviter.herokuapp.com/). The invitation email will include
74+
details of how to access our Slack workspace. After you are logged in, please come to `#operator` and say, "hello!"
75+
76+
### Recent changes and known issues
77+
78+
See the [Release Notes]({{< relref "release-notes.md" >}}) for recent changes to the operator and known issues.
79+
80+
### Developer guide
81+
82+
Developers interested in this project are encouraged to read the [Developer guide]({{< relref "/developerguide/_index.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.
83+
84+
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!
85+
86+
### API documentation
87+
88+
Documentation for APIs:
89+
90+
* 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 [Use the operator's REST services]({{< relref "/userguide/managing-operators/using-the-operator/the-rest-api.md#use-the-operator-s-rest-services" >}}).
91+
92+
* See the [Swagger](https://oracle.github.io/weblogic-kubernetes-operator/swagger/index.html) documentation for the operator's REST interface.
93+
94+
* See the [Javadoc](https://oracle.github.io/weblogic-kubernetes-operator/apidocs/index.html) for the operator.
95+
96+
### Contributing to the operator
97+
98+
Oracle welcomes contributions to this project from anyone. Contributions may be reporting an issue with the operator or submitting a pull request. Before embarking on significant development that may result in a large pull request, it is recommended that you create an issue and discuss the proposed changes with the existing developers first.
99+
100+
If you want to submit a pull request to fix a bug or enhance an existing feature, please first open an issue and link to that issue when you submit your pull request.
101+
102+
If you have any questions about a possible submission, feel free to open an issue too.
103+
104+
#### Contributing to the Oracle WebLogic Server Kubernetes Operator repository
105+
106+
Pull requests can be made under The Oracle Contributor Agreement (OCA), which is available at [https://www.oracle.com/technetwork/community/oca-486395.html](https://www.oracle.com/technetwork/community/oca-486395.html).
107+
108+
For pull requests to be accepted, the bottom of the commit message must have the following line, using the contributor’s name and e-mail address as it appears in the OCA Signatories list.
109+
110+
```
111+
Signed-off-by: Your Name <[email protected]>
112+
```
113+
114+
This can be automatically added to pull requests by committing with:
115+
116+
```
117+
git commit --signoff
118+
```
119+
120+
Only pull requests from committers that can be verified as having signed the OCA can be accepted.
121+
122+
#### Pull request process
123+
124+
* Fork the repository.
125+
* Create a branch in your fork to implement the changes. We recommend using the issue number as part of your branch name, for example, `1234-fixes`.
126+
* Ensure that any documentation is updated with the changes that are required by your fix.
127+
* Ensure that any samples are updated if the base image has been changed.
128+
* Submit the pull request. Do not leave the pull request blank. Explain exactly what your changes are meant to do and provide simple steps on how to validate your changes. Ensure that you reference the issue you created as well. We will assign the pull request to 2-3 people for review before it is merged.
129+
130+
#### Introducing a new dependency
131+
132+
Please be aware that pull requests that seek to introduce a new dependency will be subject to additional review. In general, contributors should avoid dependencies with incompatible licenses, and should try to use recent versions of dependencies. Standard security vulnerability checklists will be consulted before accepting a new dependency. Dependencies on closed-source code, including WebLogic Server, will most likely be rejected.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
+++
2+
title = "Developer Guide"
3+
date = 2019-02-22T15:27:54-05:00
4+
weight = 4
5+
chapter = true
6+
pre = "<b>4. </b>"
7+
+++
8+
9+
10+
# Developer Guide
11+
12+
The Developer Guide provides information for developers who want to understand or contribute to the code.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: "Asynchronous call model"
3+
date: 2019-02-23T17:20:00-05:00
4+
draft: false
5+
weight: 7
6+
---
7+
8+
9+
Our expectation is that customers will task the operator with managing hundreds of WebLogic domains across dozens of Kubernetes namespaces. Therefore, we have designed the operator with an efficient user-level threads pattern. We've used that pattern to implement an asynchronous call model for Kubernetes API requests. This call model has built-in support for timeouts, retries with exponential back-off, and lists that exceed the requested maximum size using the continuance functionality.
10+
11+
#### User-level thread pattern
12+
13+
The user-level thread pattern is implemented by the classes in the `oracle.kubernetes.operator.work` package.
14+
15+
* `Engine`: The executor service and factory for `Fibers`.
16+
* `Fiber`: The user-level thread. `Fibers` represent the execution of a single processing flow through a series of `Steps`. `Fibers` may be suspended and later resumed, and do not consume a `Thread` while suspended.
17+
* `Step`: Individual CPU-bound activity in a processing flow.
18+
* `Packet`: Context of the processing flow.
19+
* `NextAction`: Used by a `Step` when it returns control to the `Fiber` to indicate what should happen next. Common 'next actions' are to execute another `Step` or to suspend the `Fiber`.
20+
* `Component`: Provider of SPI's that may be useful to the processing flow.
21+
* `Container`: Represents the containing environment and is a `Component`.
22+
23+
Each `Step` has a reference to the next `Step` in the processing flow; however, `Steps` are not required to indicate that the next `Step` be invoked by the `Fiber` when the `Step` returns a `NextAction` to the `Fiber`. This leads to common use cases where `Fibers` invoke a series of `Steps` that are linked by the 'is-next' relationship, but just as commonly, use cases where the `Fiber` will invoke sets of `Steps` along a detour before returning to the normal flow.
24+
25+
In this sample, the caller creates an `Engine`, `Fiber`, linked set of `Step` instances, and `Packet`. The `Fiber` is then started. The `Engine` would typically be a singleton, since it's backed by a `ScheduledExecutorService`. The `Packet` would also typically be pre-loaded with values that the `Steps` would use in their `apply()` methods.
26+
27+
```java
28+
static class SomeClass {
29+
public static void main(String[] args) {
30+
Engine engine = new Engine("worker-pool");
31+
32+
Fiber fiber = engine.createFiber();
33+
34+
Step step = new StepOne(new StepTwo(new StepThree(null)));
35+
Packet packet = new Packet();
36+
37+
fiber.start(
38+
step,
39+
packet,
40+
new CompletionCallback() {
41+
@Override
42+
public void onCompletion(Packet packet) {
43+
// Fiber has completed successfully
44+
}
45+
46+
@Override
47+
public void onThrowable(Packet packet, Throwable throwable) {
48+
// Fiber processing was terminated with an exception
49+
}
50+
});
51+
}
52+
}
53+
```
54+
55+
`Steps` must not invoke sleep or blocking calls from within `apply()`. This prevents the worker threads from serving other `Fibers`. Instead, use asynchronous calls and the `Fiber` suspend/resume pattern. `Step` provides a method, `doDelay()`, which creates a `NextAction` to drive `Fiber` suspend/resume that is a better option than sleep precisely because the worker thread can serve other `Fibers` during the delay. For asynchronous IO or similar patterns, suspend the `Fiber`. In the callback as the `Fiber` suspends, initiate the asynchronous call. Finally, when the call completes, resume the `Fiber`. The suspend/resume functionality handles the case where resumed before the suspending callback completes.
56+
57+
In this sample, the step uses asynchronous file IO and the suspend/resume `Fiber` pattern.
58+
59+
```java
60+
static class StepTwo extends Step {
61+
public StepTwo(Step next) {
62+
super(next);
63+
}
64+
65+
@Override
66+
public NextAction apply(Packet packet) {
67+
return doSuspend((fiber) -> {
68+
// The Fiber is now suspended
69+
// Start the asynchronous call
70+
try {
71+
Path path = Paths.get(URI.create(this.getClass().getResource("/somefile.dat").toString()));
72+
AsynchronousFileChannel fileChannel =
73+
AsynchronousFileChannel.open(path, StandardOpenOption.READ);
74+
75+
ByteBuffer buffer = ByteBuffer.allocate(1024);
76+
fileChannel.read(buffer, 0, buffer, new CompletionHandler<Integer, ByteBuffer>() {
77+
@Override
78+
void completed(Integer result, ByteBuffer attachment) {
79+
// Store data in Packet and resume Fiber
80+
packet.put("DATA_SIZE_READ", result);
81+
packet.put("DATA_FROM_SOMEFILE", attachment);
82+
fiber.resume(packet);
83+
}
84+
85+
@Override
86+
public void failed(Throwable exc, ByteBuffer attachment) {
87+
// log exc
88+
completed(0, null);
89+
}
90+
});
91+
} catch (IOException e) {
92+
// log exception
93+
// If not resumed here, Fiber will never be resumed
94+
}
95+
});
96+
}
97+
}
98+
```
99+
100+
#### Call builder pattern
101+
102+
The asynchronous call model is implemented by classes in the `oracle.kubernetes.operator.helpers` package, including `CallBuilder` and `ResponseStep`. The model is based on the `Fiber` suspend/resume pattern described above. `CallBuilder` provides many methods having names ending with "Async", such as `listPodAsync()` or `deleteServiceAsync()`. These methods return a `Step` that can be returned as part of a `NextAction`. When creating these `Steps`, the developer must provide a `ResponseStep`. Only `ResponseStep.onSuccess()` must be implemented; however, it is often useful to override `onFailure()` as Kubernetes treats `404 (Not Found)` as a failure.
103+
104+
In this sample, the developer is using the pattern to list pods from the default namespace that are labeled as part of `cluster-1`.
105+
106+
```java
107+
static class StepOne extends Step {
108+
public StepOne(Step next) {
109+
super(next);
110+
}
111+
112+
@Override
113+
public NextAction apply(Packet packet) {
114+
String namespace = "default";
115+
Step step = CallBuilder.create().with($ -> {
116+
$.labelSelector = "weblogic.clusterName=cluster-1";
117+
$.limit = 50;
118+
$.timeoutSeconds = 30;
119+
}).listPodAsync(namespace, new ResponseStep<V1PodList>(next) {
120+
@Override
121+
public NextAction onFailure(Packet packet, ApiException e, int statusCode,
122+
Map<String, List<String>> responseHeaders) {
123+
if (statusCode == CallBuilder.NOT_FOUND) {
124+
return onSuccess(packet, null, statusCode, responseHeaders);
125+
}
126+
return super.onFailure(packet, e, statusCode, responseHeaders);
127+
}
128+
129+
@Override
130+
NextAction onSuccess(Packet packet, V1PodList result, int statusCode,
131+
Map<String, List<String>> responseHeaders) {
132+
// do something with the result Pod, if not null
133+
return doNext(packet);
134+
}
135+
});
136+
137+
return doNext(step, packet);
138+
}
139+
}
140+
```
141+
142+
Notice that the required parameters, such as `namespace`, are method arguments, but optional parameters are designated using a simplified builder pattern using `with()` and a lambda.
143+
144+
The default behavior of `onFailure()` will retry with an exponential backoff the request on status codes `429 (TooManyRequests)`, `500 (InternalServerError)`, `503 (ServiceUnavailable)`, `504 (ServerTimeout)` or a simple timeout with no response from the server.
145+
146+
If the server responds with status code `409 (Conflict)`, then this indicates an optimistic locking failure. Common use cases are that the code read a Kubernetes object in one asynchronous step, modified the object, and attempted to replace the object in another asynchronous step; however, another activity replaced that same object in the interim. In this case, retrying the request would give the same result. Therefore, developers may provide an "on conflict" step when calling `super.onFailure()`. The conflict step will be invoked after an exponential backoff delay. In this example, that conflict step should be the step that reads the existing Kubernetes object.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Backward compatibility"
3+
date: 2019-02-23T17:26:09-05:00
4+
draft: false
5+
weight: 9
6+
---
7+
8+
Starting with the 2.0 release, future operator releases must be backward compatible with respect to the domain resource schema, operator Helm chart input values, configuration overrides template, Kubernetes resources created by the operator Helm chart, Kubernetes resources created by the operator, and the operator REST interface. We will maintain compatibility for three releases, except in the case of a clearly communicated deprecated feature, which will be maintained for one release after a replacement is available.

0 commit comments

Comments
 (0)