You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Re-organize and add secret credentials information
* Revisions from doc review
* Updated to clarify examples specific to model-in-image
* Updated with link to Model in Image doc
The [Discover Domain]({{< relref "/userguide/tools/discover.md" >}}) and [Prepare Model]({{< relref "/userguide/tools/prepare.md" >}}) Tools allow you to customize the model and other files produced to be compatible with a specific target environment. Options for a target environment may include:
10
-
- Using model tokens for some attributes in the model. See[Model tokens]({{< relref "/concepts/model#model-tokens" >}}).
11
-
- Using Kubernetes secrets for credentials in the model.
12
-
- Applying filters to the model. See[Model filters]({{< relref "/userguide/tools-config/model_filters.md" >}}).
19
+
- Using model tokens for some attributes in the model. For more details, see[Model tokens]({{< relref "/concepts/model#model-tokens" >}}).
20
+
- Using Kubernetes secrets for credentials in the model. For more details, see [Using secret credentials in the model](#using-secret-credentials-in-the-model).
21
+
- Applying filters to the model. For more details, see[Model filters]({{< relref "/userguide/tools-config/model_filters.md" >}}).
13
22
- Creating additional configuration files for the target system.
14
23
15
24
### Specifying a target environment
16
25
17
26
Each tool specifies a target environment using the command-line argument `-target <target-name>`, where `<target-name>` refers to a pre-configured target environment, or a user-defined environment. In addition, the `-output_dir <output-directory>` argument specifies where the files for the target environment will be stored.
18
27
19
-
This command line shows how these arguments can be used with the Discover Domain Tool:
28
+
This command line shows how you can use these arguments with the Discover Domain Tool:
This example would apply the `k8s` target type to the discovery result, and place those files in `/etc/files`.
24
33
25
34
If a variable file is specified on the tool's command line using the `-variable_file` argument, any injected variables will be added to that file. If no variable file is specified, injected variables will be written to the file `<output-directory>/<target_name>_variable.properties`.
26
35
27
-
### The target configuration file
36
+
### Pre-configured target environments
37
+
38
+
These target environment configurations are included in the WebLogic Deploy Tooling installation.
39
+
40
+
#### The WebLogic Kubernetes Operator target
41
+
42
+
You can apply this target environment by providing the command-line argument `-target wko`. It will provide this additional processing:
43
+
44
+
- The `wko_operator_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
45
+
- Variables will be injected into the model for port, host, and URL attributes
46
+
-`lax` validation will be applied for the resulting model
47
+
- Credentials in the model will be replaced with references to Kubernetes secrets, and a script to create those secrets will be produced
48
+
- An additional Kubernetes resource file, `wko-domain.yaml`, will be produced, with cluster and naming information derived from the model
49
+
50
+
#### The Verrazzano target
51
+
52
+
You can apply this target environment by providing the command-line argument `-target vz`. It will provide this additional processing:
53
+
54
+
- The `vz_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
55
+
- Variables will be injected into the model for port, host, and URL attributes
56
+
-`lax` validation will be applied for the resulting model
57
+
- Credentials in the model will be replaced with references to Kubernetes secrets, and a script to create those secrets will be produced
58
+
- One additional Kubernetes resource file, `vz-application.yaml`, will be produced, with cluster and data source information derived from the model
59
+
60
+
#### Generic Kubernetes target
61
+
62
+
You can apply this target environment by providing the command-line argument `-target k8s`. It will provide this additional processing:
63
+
64
+
- The `k8s_operator_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
65
+
- Variables will be injected into the model for port, host, and URL attributes
66
+
-`lax` validation will be applied for the resulting model
67
+
- Credentials in the model will be replaced with references to Kubernetes secrets, and a script to create those secrets will be produced
68
+
69
+
### Using secret credentials in the model
70
+
71
+
If a target environment is configured to use Kubernetes secrets for credential attribute values, each of those values is replaced with a token using the format `@@SECRET:@@ENV:DOMAIN_UID@@<secret-suffix>:<key>`. For example:
When a domain is created or updated using a model with these tokens, the environment variable `DOMAIN_UID` should be set to the domain's UID, and secrets with corresponding names should have been created. For more details about using secret tokens, see [Model Tokens]({{< relref "/concepts/model#model-tokens" >}}).
76
+
77
+
For some target environments, the WebLogic admin credentials use a variation of this token format. For example:
In this case, the token `__weblogic-credentials__` allows these attributes to reference secrets in a specific location. The `WDT_MODEL_SECRETS_NAME_DIR_PAIRS` environment variable should be set to associate `__weblogic-credentials__` to this location. For example:
For more details about using the `WDT_MODEL_SECRETS_NAME_DIR_PAIRS` environment variable, see [Model Tokens]({{< relref "/concepts/model#model-tokens" >}}) .
88
+
89
+
In WebLogic Kubernetes Operator [Model in Image](https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/model-in-image/) environments, the environment variable `DOMAIN_UID` is automatically set from the value in the domain resource file. The variable `WDT_MODEL_SECRETS_NAME_DIR_PAIRS` is automatically set to the directory containing WebLogic admin credentials.
90
+
91
+
#### The create secrets script
92
+
93
+
For target environments that use Kubernetes secret tokens, a shell script is created to generate the required secrets. The script is named `create_k8s_secrets.sh`, and is created in the target output directory. The script has commands to create each secret, for example:
94
+
```shell
95
+
# Update <user> and <password> for weblogic-credentials
The script should be updated with correct `<user>` and `<password>` values as required. It may be necessary to change the `NAMESPACE` and `DOMAIN_UID` variables at the top of the script if they are different in the target environment.
99
+
100
+
The script performs a check to determine if any generated secret names are more than 63 characters in length, because that will prevent them from being mounted correctly in the Kubernetes environment. If any secret names exceed this limit, they will need to be shortened in this script, in the model files, and in the domain resource file. Each shortened name should be distinct from other secret names.
101
+
102
+
### Target environment configuration files
28
103
29
104
A target environment is configured in a JSON file at this location:
30
105
```
@@ -37,6 +112,8 @@ The `<target-name>` value corresponds to the value of the `-target` argument on
37
112
38
113
You can define a new or extended target environment with a new `target-name` in the above location, or using a [Custom configuration]({{< relref "/userguide/tools-config/custom_config.md" >}}) directory, such as `$WDT_CUSTOM_CONFIG/target/<my-target-name>/target.json`.
39
114
115
+
You can customize existing template files for specific environments. The recommended method is to copy the original template to a custom configuration directory as described above, such as `$WDT_CUSTOM_CONFIG/target/<target-name>/model.yaml`. The copied file can then be edited as needed, while maintaining the original for reference.
116
+
40
117
Here is an example of a target environment file:
41
118
```
42
119
{
@@ -56,21 +133,21 @@ Here is an example of a target environment file:
56
133
"additional_output" : "vz-application.yaml"
57
134
}
58
135
```
59
-
Each of the fields in this example is optional, and can be customized.
136
+
Each of the fields in this example is optional, and you can customize them.
60
137
61
138
#### `model_filters`
62
139
63
140
This field specifies the filters to be applied to the resulting model. This follows the same format and rules as the [Model filters]({{< relref "/userguide/tools-config/model_filters.md" >}}) configuration. The `discover` type should always be used here.
64
141
65
-
The `@@TARGET_CONFIG_DIR@@` token can be used to indicate that the specified filter is in the same directory as the target configuration file.
142
+
You can use the `@@TARGET_CONFIG_DIR@@` token to indicate that the specified filter is in the same directory as the target configuration file.
66
143
67
144
#### `variable_injectors`
68
145
69
146
This field specifies the variable injectors to be applied to the resulting model. This follows the same format and rules as the [Variable injectors]({{< relref "/userguide/tools/variable_injection.md" >}}) configuration.
70
147
71
148
#### `validation_method`
72
149
73
-
This field can be used to set the validation level for the resulting model. Only the value `lax`is currently supported. With `lax` validation, variables and Kubernetes secrets referenced in the resulting model do not need to be available when the model is created.
150
+
You can use this field to set the validation level for the resulting model. Only the value `lax`is currently supported. With `lax` validation, variables and Kubernetes secrets referenced in the resulting model do not need to be available when the model is created.
74
151
75
152
#### `credentials_method`
76
153
@@ -90,38 +167,4 @@ This field specifies a name for use with the WDT_MODEL_SECRETS_NAME_DIR_PAIRS en
90
167
91
168
#### `additional_output`
92
169
93
-
This field can be used to create additional output for use in the target environment. The value is a comma-separated list of template files in the `$WLSDEPLOY_HOME/lib/target/<target-name>` directory. These templates are populated with information derived from the model, and written to a file with the same name in the specified output directory.
94
-
95
-
Template files can be customized for specific environments. The recommended method is to copy the original template to a custom configuration directory as described above, such as `$WDT_CUSTOM_CONFIG/target/<target-name>/model.yaml`. The copied file can then be edited as needed, while maintaining the original for reference.
96
-
97
-
### Pre-configured target environments
98
-
99
-
These target environment configurations are included in the WebLogic Deploy Tooling installation.
100
-
101
-
#### The WebLogic Kubernetes Operator target
102
-
103
-
This target environment can be applied by providing the command-line argument `-target wko`. It will provide this additional processing:
104
-
105
-
- The `wko_operator_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
106
-
- Variables will be injected into the model for port, host, and URL attributes
107
-
-`lax` validation will be applied for the resulting model
108
-
- Credentials in the model will be replaced with references to Kubernetes secrets, and a script to create those secrets will be produced
109
-
- An additional Kubernetes resource file, `wko-domain.yaml`, will be produced, with cluster and naming information derived from the model
110
-
111
-
#### The Verrazzano target
112
-
This target environment can be applied by providing the command-line argument `-target vz`. It will provide this additional processing:
113
-
114
-
- The `vz_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
115
-
- Variables will be injected into the model for port, host, and URL attributes
116
-
-`lax` validation will be applied for the resulting model
117
-
- Credentials in the model will be replaced with placeholder values, and a script to create corresponding secrets will be produced
118
-
- One additional Kubernetes resource file, `vz-application.yaml`, will be produced, with cluster and data source information derived from the model
119
-
120
-
#### Generic Kubernetes target
121
-
122
-
This target environment can be applied by providing the command-line argument `-target k8s`. It will provide this additional processing:
123
-
124
-
- The `k8s_operator_filter.py` filter will be applied to remove model elements that are not compatible with the Kubernetes environment
125
-
- Variables will be injected into the model for port, host, and URL attributes
126
-
-`lax` validation will be applied for the resulting model
127
-
- Credentials in the model will be replaced with references to Kubernetes secrets, and a script to create those secrets will be produced
170
+
You can use this field to create additional output for use in the target environment. The value is a comma-separated list of template files in the `$WLSDEPLOY_HOME/lib/target/<target-name>` directory. These templates are populated with information derived from the model, and written to a file with the same name in the specified output directory.
0 commit comments