You can use the Extract Domain Resource Tool to create resource files for use with the WebLogic Kubernetes Operator or Verrazzano. 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 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 resource file can be generated to apply to Kubernetes.
More information about the WebLogic Kubernetes Operator can be found here.
More information about Verrazzano can be found here.
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 -output_dir /tmp/resource -target wko
For the simplest case, the Extract Domain Resource Tool will create resource files based on the templates corresponding to the
target argument, using information from the command line and the domain sections of the model. Information about target types and templates can be found here.
The value of the optional
-domain_home argument will be applied in the template output. Domain name and UID fields in the template will use the domain name in the topology section of the model, or the default
base_domain. The cluster entries will be pulled from the topology section of the model; their replica counts will have been 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 resource output.
For more advanced configurations, including pre-populating the
--FIX ME-- values, the user can populate the related section of the WDT model, and those values will appear in the resulting custom resource definition (CRD) resource files. In this example the
kubernetes section of the model overrides and adds some values to the CRD generated for WebLogic Kubernetes Operator.
kubernetes: metadata: name: myName namespace: myNamespace spec: image: 'my.repo/my-image:2.0' imagePullSecrets: - name: WEBLOGIC_IMAGE_PULL_SECRET_NAME webLogicCredentialsSecret: name: '@@PROP:mySecret@@' configuration: model: domainType: 'WLS' secrets: - secret1 - secret2 serverPod: env: - name: USER_MEM_ARGS value: '-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom' - name: 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 CRD sections of the model. More details about using model variables can be found here.
wko target with this example, the resulting domain resource file would contain:
apiVersion: weblogic.oracle/v8 kind: Domain 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 configuration: model: domainType: WLS secrets: - secret1 - secret2 clusters: - clusterName: mycluster replicas: 2 - clusterName: mycluster3 replicas: 4
If clusters are specified in the
kubernetes/spec section of the model, those clusters will be combined with any clusters from the
topology section of the model.
If the WDT model has a value of
imagePullSecrets default value will not be added.
A full list of sections and variables supported by the WebLogic Kubernetes Operator is available here. The Extract Domain Resource Tool supports a subset of these sections, including
verrazzano section of the WDT model can be used to update the CRDs generated for Verrazzano targets, such as
vz-dii. More information about this model section can be found here.
The Model Help Tool can be used to determine the folders and attributes that can be used in the CRD sections of the model. For example, this command will list the folders and attributes in the
spec folder in the
<wls-deploy-home>/bin/modelHelp.sh -oracle_home /tmp/oracle kubernetes:/spec
This command will list the folders and attributes in the
application/spec folder in the
<wls-deploy-home>/bin/modelHelp.sh -oracle_home /tmp/oracle -target vz verrazzano:/application/spec
The content for the CRD sections is not generated when a model is discovered by the Discover Domain Tool.
||The path to the archive file. This can also be specified as a comma-separated list of archive files. The overlapping contents in each archive take precedence over previous archives in the list.|
||The domain home directory to be used in output files. This will override any value in the model.|
||The location of the model file. This can also be specified as a comma-separated list of model locations, where each successive model layers on top of the previous ones.|
||Home directory of the Oracle WebLogic installation. Required if the
||The location for the target output files.|
||The target output type. The default is
||The location of the property file containing the values for variables used in the model. This can also be specified as a comma-separated list of property files, where each successive set of properties layers on top of the previous ones.|