Skip to content

Commit 0bf8c15

Browse files
authored
JIRA WDT-452 - Add configuration/model section to model.yaml; create runtime encryption secret (#704)
1 parent c55035b commit 0bf8c15

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

core/src/main/python/wlsdeploy/tool/util/targets/vz_config_helper.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@
3434
DATASOURCE_NAME = 'datasourceName'
3535
DOMAIN_NAME = 'domainName'
3636
DOMAIN_PREFIX = 'domainPrefix'
37+
DOMAIN_TYPE = 'domainType'
3738
DOMAIN_UID = 'domainUid'
3839
DS_URL = 'url'
3940
HAS_CLUSTERS = 'hasClusters'
4041
HAS_DATABASES = 'hasDatabases'
4142
REPLICAS = 'replicas'
43+
RUNTIME_ENCRYPTION_SECRET = 'runtimeEncryptionSecret'
4244
WEBLOGIC_CREDENTIALS_SECRET = 'webLogicCredentialsSecret'
4345

4446

@@ -54,7 +56,7 @@ def create_vz_configuration(model, model_context, aliases, exception_type):
5456
# -output_dir argument was previously verified
5557
output_dir = model_context.get_kubernetes_output_dir()
5658

57-
template_hash = _build_template_hash(model, aliases)
59+
template_hash = _build_template_hash(model, model_context, aliases)
5860

5961
_create_file('model.yaml', template_hash, output_dir, exception_type)
6062

@@ -80,10 +82,11 @@ def _create_file(template_name, template_hash, output_dir, exception_type):
8082
file_template_helper.create_file(template_path, template_hash, output_file, exception_type)
8183

8284

83-
def _build_template_hash(model, aliases):
85+
def _build_template_hash(model, model_context, aliases):
8486
"""
8587
Create a dictionary of substitution values to apply to the templates.
8688
:param model: Model object used to derive values
89+
:param model_context: used to determine domain type
8790
:param aliases: used to derive folder names
8891
:return: the hash dictionary
8992
"""
@@ -110,6 +113,11 @@ def _build_template_hash(model, aliases):
110113
admin_secret = domain_uid + target_configuration_helper.WEBLOGIC_CREDENTIALS_SECRET_SUFFIX
111114
template_hash[WEBLOGIC_CREDENTIALS_SECRET] = admin_secret
112115

116+
# configuration / model
117+
template_hash[DOMAIN_TYPE] = model_context.get_domain_type()
118+
template_hash[RUNTIME_ENCRYPTION_SECRET] = domain_uid +\
119+
target_configuration_helper.RUNTIME_ENCRYPTION_SECRET_SUFFIX
120+
113121
# clusters
114122

115123
clusters = []

core/src/main/python/wlsdeploy/util/target_configuration_helper.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
__class_name = 'target_configuration_helper'
2727
__logger = PlatformLogger('wlsdeploy.tool.util')
2828

29+
# secret name for runtime encryption
30+
RUNTIME_ENCRYPTION_SECRET_NAME = 'runtime-encryption'
31+
RUNTIME_ENCRYPTION_SECRET_SUFFIX = '-' + RUNTIME_ENCRYPTION_SECRET_NAME
32+
2933
# Kubernetes secret for admin name and password is <domainUid>-weblogic-credentials
3034
WEBLOGIC_CREDENTIALS_SECRET_NAME = 'weblogic-credentials'
3135
WEBLOGIC_CREDENTIALS_SECRET_SUFFIX = '-' + WEBLOGIC_CREDENTIALS_SECRET_NAME
@@ -151,6 +155,15 @@ def generate_k8s_script(model_context, token_dictionary, model_dictionary):
151155
k8s_script.write("# " + message + nl)
152156
k8s_script.write(command_string + nl)
153157

158+
# for vz additional output type, add the runtime encryption secret
159+
output_types = model_context.get_target_configuration().get_additional_output_types()
160+
if VZ_EXTRA_CONFIG in output_types:
161+
message = exception_helper.get_message("WLSDPLY-01663", PASSWORD_TAG, RUNTIME_ENCRYPTION_SECRET_NAME)
162+
command_string = "create_k8s_secret %s %s " % (RUNTIME_ENCRYPTION_SECRET_NAME, PASSWORD_TAG)
163+
k8s_script.write(nl)
164+
k8s_script.write("# " + message + nl)
165+
k8s_script.write(command_string + nl)
166+
154167
k8s_script.close()
155168

156169

core/src/main/resources/oracle/weblogic/deploy/targets/vz/model.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ spec:
3030
value: "-Dweblogic.StdoutDebugEnabled=false"
3131
- name: USER_MEM_ARGS
3232
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
33+
configuration:
34+
model:
35+
domainType: {{{domainType}}}
36+
runtimeEncryptionSecret: {{{runtimeEncryptionSecret}}}
3337
connections:
3438
- ingress:
3539
- name: {{{domainPrefix}}}-ingress

0 commit comments

Comments
 (0)