Skip to content

Kubernetes operator configuration doc #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Many organizations are using WebLogic Server, with or without other Oracle Fusio
- [Custom Security Providers](site/security_providers.md#custom-security-providers)
- [Modeling WebLogic Users, Groups, and Roles](site/security_users_groups_roles.md)
- [ODL Configuration](site/odl_configuration.md)
- [Configuring Oracle WebLogic Server Kubernetes Operator](site/kubernetes.md)
- [Variable Injection](site/variable_injection.md)
- [Model Filters](site/tool_filters.md)
- [The Archive File](site/archive.md)
Expand Down
97 changes: 97 additions & 0 deletions site/kubernetes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
## Configuring Oracle WebLogic Server Kubernetes Operator

The Extract Domain Resource Tool can be used to create a domain resource file for use with the Oracle WebLogic Server Kubernetes Operator. This allows the domain configuration and the Kubernetes container configuration to be specified in a single model file.

This is especially useful when making configuration changes to the domain that also need to be reflected in the domain resource file. For example, adding a cluster to the domain only requires that it be added to the `topology` section of the WDT model, then a new domain resource file can be generated to apply to Kubernetes.

More information about the Oracle WebLogic Server Kubernetes Operator can be found [here](https://oracle.github.io/weblogic-kubernetes-operator).

NOTE: The Extract Domain Resource Tool is available with WDT releases 1.7.0 and later.

Here is an example command line for the Extract Domain Resource Tool:
```
<wls-deploy-home>/bin/extractDomainResource.sh -oracle_home /tmp/oracle -domain_home /u01/mydomain -model_file /tmp/mymodel.yaml -variable_file /tmp/my.properties -domain_resource_file /tmp/operator/domain-resource.yaml
```

For the simplest case, the Extract Domain Resource Tool will create a sparse domain file. This is what is generated when there is not a `kubernetes` section in the model, or that section is empty.
```yaml
apiVersion: weblogic.oracle/v6
kind: Domain
metadata:
name: DemoDomain
spec:
domainHome: /u01/mydomain
image: '--FIX ME--'
imagePullSecrets:
- name: '--FIX ME--'
webLogicCredentialsSecret: '--FIX ME--'
clusters:
- clusterName: mycluster
replicas: 2
- clusterName: mycluster3
replicas: 4
```

In this example, the value for `domainHome` was set as an input parameter to the extractDomainResource script from the command line. The `kind` and `name` were set to the domain name derived from the topology section of the model, or the default `base_domain`. The cluster entries are pulled from the topology section of the model, and their replica counts were derived from the number of servers for each cluster.

The user is expected to fill in the image and secrets information identified by `--FIX ME--` in the domain resource output.

For more advanced configurations, including pre-populating the `--FIX ME--` values, the user can populate the `kubernetes` section of the WDT model, and those values will appear in the resulting domain resources file. This model section overrides and adds some values to the result.
```yaml
kubernetes:
metadata:
name: myName
namespace: myNamespace
spec:
image: 'my.repo/my-image:2.0'
imagePullSecrets:
WEBLOGIC_IMAGE_PULL_SECRET_NAME:
webLogicCredentialsSecret:
name: '@@PROP:mySecret@@'
serverPod:
env:
USER_MEM_ARGS:
value: '-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom'
JAVA_OPTIONS:
value: '-Dmydir=/home/me'
```
This example uses `@@PROP:mySecret@@` to pull the value for `webLogicCredentialsSecret` from the variables file specified on the command line. This can be done with any of the values in the `kubernetes` section of the model. More details about using model variables can be found [here](../README.md/#simple-example).

For this example, the resulting domain resource file would contain:
```yaml
metadata:
name: myName
namespace: myNamespace
spec:
image: 'my.repo/my-image:2.0'
imagePullSecrets:
- name: WEBLOGIC_IMAGE_PULL_SECRET_NAME
webLogicCredentialsSecret:
name: WEBLOGIC_CREDENTIALS_SECRET_NAME
serverPod:
env:
- name: USER_MEM_ARGS
value: '-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom'
- name: JAVA_OPTIONS
value: '-Dmydir=/home/me'
domainHome: /u01/mine/domain
clusters:
- clusterName: mycluster
replicas: 2
- clusterName: mycluster3
replicas: 4
apiVersion: weblogic.oracle/v6
kind: Domain
```

The syntax of the `spec/serverPod/env` and other list sections in the WDT model are different from the syntax in the target file. The WDT tools do not recognize the hyphenated list syntax, so these elements are specified in a similar manner to other model lists.

If clusters are specified in the `kubernetes/spec` section of the model, those clusters will be configured in the domain resource file, and clusters from the `topology` section will be disregarded.

If the WDT model has a value of `Never` for `spec/imagePullPolicy`, the `imagePullSecrets` default value will not be added.

A full list of sections and variables supported by the Oracle WebLogic Server Kubernetes Operator is available [here](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/docs/domains/Domain.md).

The Extract Domain Resource Tool supports a subset of these sections, including `metadata`, `serverPod`, and `spec`.

The content in the `kubernetes` section is not generated when a model is discovered by the Discover Domain Tool.