|
1 | 1 | """ |
2 | | -Copyright (c) 2020, 2024, Oracle and/or its affiliates. |
| 2 | +Copyright (c) 2020, 2025, Oracle and/or its affiliates. |
3 | 3 | Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
4 | 4 |
|
5 | | -Methods for creating Kubernetes resource configuration files for Verrazzano. |
| 5 | +Methods for creating Kubernetes resource configuration files for WKO. |
6 | 6 | """ |
7 | 7 | import os.path |
8 | 8 |
|
9 | 9 | from java.io import File |
10 | 10 |
|
11 | | -from wlsdeploy.aliases import alias_utils |
12 | 11 | from wlsdeploy.aliases.location_context import LocationContext |
13 | | -from wlsdeploy.aliases.model_constants import APPLICATION |
14 | 12 | from wlsdeploy.aliases.model_constants import CLUSTER |
15 | | -from wlsdeploy.aliases.model_constants import DYNAMIC_SERVERS |
16 | 13 | from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS |
17 | 14 | from wlsdeploy.aliases.model_constants import JDBC_RESOURCE |
18 | 15 | from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE |
19 | | -from wlsdeploy.aliases.model_constants import LISTEN_PORT |
20 | 16 | from wlsdeploy.aliases.model_constants import SERVER |
21 | 17 | from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE |
22 | | -from wlsdeploy.aliases.model_constants import TARGET |
23 | 18 | from wlsdeploy.aliases.model_constants import URL |
24 | 19 | from wlsdeploy.logging.platform_logger import PlatformLogger |
25 | 20 | from wlsdeploy.tool.util import k8s_helper |
|
31 | 26 | from wlsdeploy.util import target_configuration_helper |
32 | 27 | import wlsdeploy.util.unicode_helper as str_helper |
33 | 28 |
|
34 | | -__class_name = 'vz_config_helper' |
| 29 | +__class_name = 'additional_output_helper' |
35 | 30 | __logger = PlatformLogger('wlsdeploy.tool.util') |
36 | 31 |
|
37 | 32 | # substitution keys used in the templates |
38 | 33 | ADDITIONAL_SECRET_NAME = 'additionalSecretName' |
39 | 34 | ADDITIONAL_SECRETS = 'additionalSecrets' |
40 | | -APPLICATIONS = 'applications' |
41 | | -APPLICATION_NAME = 'applicationName' |
42 | | -APPLICATION_PREFIX = 'applicationPrefix' |
43 | 35 | CLUSTER_NAME = 'clusterName' |
44 | 36 | CLUSTER_UID = 'clusterUid' |
45 | 37 | CLUSTERS = 'clusters' |
|
55 | 47 | DOMAIN_TYPE = 'domainType' |
56 | 48 | DOMAIN_UID = 'domainUid' |
57 | 49 | HAS_ADDITIONAL_SECRETS = 'hasAdditionalSecrets' |
58 | | -HAS_APPLICATIONS = 'hasApplications' |
59 | 50 | HAS_CLUSTERS = 'hasClusters' |
60 | 51 | HAS_DATASOURCES = 'hasDatasources' |
61 | | -HAS_HOST_APPLICATIONS = 'hasHostApplications' |
62 | 52 | HAS_MODEL = 'hasModel' |
63 | | -HOST_APPLICATION_APPLICATIONS = 'applications' |
64 | | -HOST_APPLICATION_HOST = 'host' |
65 | | -HOST_APPLICATION_PORT = 'port' |
66 | | -HOST_APPLICATIONS = 'hostApplications' |
67 | 53 | NAMESPACE = 'namespace' |
68 | 54 | REPLICAS = 'replicas' |
69 | 55 | RUNTIME_ENCRYPTION_SECRET = "runtimeEncryptionSecret" |
@@ -255,73 +241,6 @@ def _build_template_hash(model, model_context, aliases, credential_injector, dom |
255 | 241 | template_hash[DATASOURCES] = databases |
256 | 242 | template_hash[HAS_DATASOURCES] = len(databases) != 0 |
257 | 243 |
|
258 | | - # applications |
259 | | - |
260 | | - apps = [] |
261 | | - |
262 | | - applications = dictionary_utils.get_dictionary_element(model.get_model_app_deployments(), APPLICATION) |
263 | | - for app_name in applications: |
264 | | - app_hash = dict() |
265 | | - prefix = '/' + app_name |
266 | | - |
267 | | - # get the prefix from the app descriptor? |
268 | | - |
269 | | - app_hash[APPLICATION_NAME] = app_name |
270 | | - app_hash[APPLICATION_PREFIX] = prefix |
271 | | - |
272 | | - apps.append(app_hash) |
273 | | - |
274 | | - template_hash[APPLICATIONS] = apps |
275 | | - template_hash[HAS_APPLICATIONS] = len(apps) != 0 |
276 | | - |
277 | | - # host applications - applications organized by host, for Verrazzano IngressTrait |
278 | | - |
279 | | - app_map = {} |
280 | | - applications = dictionary_utils.get_dictionary_element(model.get_model_app_deployments(), APPLICATION) |
281 | | - for app_name in applications: |
282 | | - app_hash = dict() |
283 | | - app_hash[APPLICATION_NAME] = app_name |
284 | | - # this text is matched in crd_file_updater, be careful if changing |
285 | | - app_hash[APPLICATION_PREFIX] = '(path for ' + app_name + ')' |
286 | | - |
287 | | - app_folder = dictionary_utils.get_dictionary_element(applications, app_name) |
288 | | - targets_value = dictionary_utils.get_dictionary_element(app_folder, TARGET) |
289 | | - targets = alias_utils.create_list(targets_value, 'WLSDPLY-01682') |
290 | | - for target in targets: |
291 | | - if target not in app_map: |
292 | | - app_map[target] = [] |
293 | | - app_map[target].append(app_hash) |
294 | | - |
295 | | - host_apps = [] |
296 | | - target_keys = app_map.keys() |
297 | | - target_keys.sort() |
298 | | - for target_key in target_keys: |
299 | | - listen_port = DEFAULT_LISTEN_PORT |
300 | | - target_cluster = _find_cluster(model, target_key) |
301 | | - if target_cluster is not None: |
302 | | - full_host_name = k8s_helper.get_dns_name(domain_uid + '-cluster-' + target_key) |
303 | | - dynamic_servers = dictionary_utils.get_dictionary_element(target_cluster, DYNAMIC_SERVERS) |
304 | | - template_name = dictionary_utils.get_element(dynamic_servers, SERVER_TEMPLATE) |
305 | | - if template_name: |
306 | | - server_template = _find_server_template(model, template_name) |
307 | | - if server_template: |
308 | | - listen_port = server_template[LISTEN_PORT] or listen_port |
309 | | - else: |
310 | | - full_host_name = k8s_helper.get_dns_name(domain_uid + '-' + target_key) |
311 | | - target_server = _find_server(model, target_key) |
312 | | - if target_server is not None: |
313 | | - listen_port = target_server[LISTEN_PORT] or listen_port |
314 | | - |
315 | | - host_app = { |
316 | | - HOST_APPLICATION_HOST: full_host_name, |
317 | | - HOST_APPLICATION_PORT: str_helper.to_string(listen_port), |
318 | | - HOST_APPLICATION_APPLICATIONS: app_map[target_key] |
319 | | - } |
320 | | - host_apps.append(host_app) |
321 | | - |
322 | | - template_hash[HOST_APPLICATIONS] = host_apps |
323 | | - template_hash[HAS_HOST_APPLICATIONS] = len(host_apps) != 0 |
324 | | - |
325 | 244 | # additional secrets - exclude admin |
326 | 245 |
|
327 | 246 | additional_secrets = [] |
|
0 commit comments