Model
Contents
Model
The Model section helps you work with WebLogic Deploy Tooling models for a WebLogic domain. A WebLogic
Deploy Tooling model for a domain can include the following file types:
- Model file - A declarative definition of the domain configuration.
- Variable file - A property file that maps names to values. These names can be referenced from the model file to allow a model to be used across environments by applying the variable file for a particular environment to the model.
- Archive file - A ZIP file containing application binaries and other files and directories needed to run the domain.
For more information about WebLogic Deploy Tooling models, see Metadata Model and Archive File in the WebLogic Deploy Tooling documentation.
Design View
Use the Model Design View pages to create or edit your WDT model files. Most attributes have a help message attached
to the field, which typically requires clicking on the control to display it.
The WDT model files that you configure will be reflected in the Code View. Using the Model Design View pages, if you
select the “three dots” icon beside a field, a dialog appears with the option of setting the field to a variable,
removing the field from the model, and various other context-sensitive actions, where appropriate. The variable will
show up in both the model and the variables editor on the Code View page. Likewise, when adding an application, you
supply the path to the EAR, WAR, or JAR file (or directory); that path will be put in the archive editor on the
Code View page.
Code View
Using an IDE-like layout, the Code View provides editor panes for editing the model, variables, and archive files,
each of which support creating and editing the domain’s WDT files. When working with an editor, there are several things
to keep in mind:
- When working with a WKT Project that has no associated WDT file for storing the data, entering data into an editor will create a new WDT file with the editor’s current content and associate it with the project.
- Changes made in the editor are buffered in memory until the WKT Project is saved.
- Adding, deleting, or modifying data in the variable or archive editors will not change the model references. You will need to make sure that the model references are accurate and up to date.
While it is possible to use the WKT UI application to create the files from scratch, the File > Add Model
menu supports adding existing files or using the WebLogic Deploy Tooling’s
Discover Domain Tool
to create a model of an existing domain.
Note
While WebLogic Deploy Tooling supports using multiple model, variables, or archive files to describe a single domain, the current release of WKT supports only one WDT model file, one WDT variables file, and one WDT archive file for describing the domain.
Model Editor
In Code View, the model editor is just to the right of the navigation pane. This editor displays the current
model file associated with the WKT Project file. Typing model content into the editor will result in a new model file
being added to the project the next time the project is saved.
The current release has the following limitations:
- Model files must be in YAML format.
- Model files must exist directly on the file system and not inside an archive, such as in a ZIP file; any model file inside an archive is ignored by the application.
Variables Editor
The WDT variables editor is in the upper right pane of the Code View page. It supports editing any existing
name-value pairs, as well as adding or removing name-value pairs.
To reference a variable from the model, you must set the value of the desired model file to a variable reference.
For example, the model snippet shown here references a variable named httpPort.
When working with this model file, WebLogic Deploy Tooling expects the httpPort variable to be defined in the model’s
variables file, as shown here:
Archive Editor
The WDT archive editor is in the lower right pane of the Code View page. It supports adding content to and removing
content from the archive file. While updating content in the archive is not supported directly by the archive
editor, the archive editor safely supports multiple operations on the same entry. As such, combining a remove
operation followed by the corresponding add operation will effectively replace an entry.
To add content to the archive file, use the plus (+) button in the archive editor title bar and follow the prompts to
choose the type of content to add and select the corresponding file or directory. For example, to add a WAR file
called todo.war to the archive, do the following:
- On the archive editor title bar, click
+. - In the resulting dialog, choose
Application Filefrom the list and clickOK. - In the resulting file chooser dialog, select the
todo.warfile and clickSelect.
This will result in the file structure wlsdeploy/applications/todo.war being added to the archive editor pane.
At this point, the application has not created or modified the archive file; it is simply storing
the data it needs about the archive path to the added entry and the file path where the content is found. Saving the
WKT Project will update the archive to reflect the buffered operations performed in the editor.
Note
Don’t forget to add the application to the model and set its SourcePath attribute to the path in the archive where it
can be found, as shown in the following model file snippet.
To remove content from the archive file, select the content to remove in the archive editor pane and click the minus (-)
button in the archive editor title bar. Don’t forget to remove any reference to this content from the model file.
Validate Model
Validate Model invokes the WDT
Validate Model Tool
, which validates that the model and its related artifacts
are well-formed and provides help on the valid attributes and subfolders for a particular model location. This action is
available by using the Validate Model button on the Model page or by selecting Go > Validate Model Files.
Prepare Model
Prepare Model invokes the WDT
Prepare Model Tool
to modify the model to work in a Kubernetes cluster with
WebLogic Kubernetes Operator installed. This action is available by using the Prepare Model button on the Model and
Kubernetes WebLogic Domain pages or by selecting Go > Prepare Model for Kubernetes. It is also possible to run
Prepare Model during the CreateImage action, though typically it is best to run Prepare Model explicitly, prior to
moving to the Image section.
Prepare Model does the following:
- Removes model sections and fields that are not compatible with the target environment.
- Replaces endpoint values with model tokens that reference variables.
- Replaces credential values with model tokens that reference either a field in a Kubernetes secret or a variable.
- Provides default values for fields displayed in the application’s variable, variable overrides, and secret editors.
- Extracts topology information to the application that it uses to generate the resource file used to deploy the domain.
For more information, see the WDT model tokens documentation.
In replacing credential values, Prepare Model will convert credentials to secret tokens for all credential fields.
You must be sure to provide values for all secret reference fields using the WebLogic Domain section’s Secrets pane
so that the required secrets get populated correctly during domain deployment. For more information, see
WebLogic Domain
.
Note
The application tries to preserve any values from the model and variable files that Prepare Model replaces
with secret tokens. The current release is limited by the behavior of the underlying WDT Prepare Model Tool in that
all passwords are not retained and must be re-entered in the appropriate location.