Skip to content

Commit a5b7248

Browse files
authored
Remove default image pull secret from WKO domain resource template (#1146)
* Remove default image pull secret from WKO domain resource template * Remove unused declaration
1 parent fea5577 commit a5b7248

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2022 Oracle Corporation and/or its affiliates.
2+
Copyright (c) 2022, Oracle Corporation and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
55
Methods to update an output file with information from the kubernetes section of the model.
@@ -13,6 +13,7 @@
1313
from wlsdeploy.aliases import alias_utils
1414
from wlsdeploy.aliases.model_constants import KUBERNETES
1515
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
16+
from wlsdeploy.exception import exception_helper
1617
from wlsdeploy.exception.expection_types import ExceptionType
1718
from wlsdeploy.logging.platform_logger import PlatformLogger
1819
from wlsdeploy.tool.extract import wko_schema_helper
@@ -28,6 +29,7 @@
2829

2930
WKO_DOMAIN_KIND = 'Domain'
3031
DOMAIN_HOME = 'domainHome'
32+
IMAGE_PULL_SECRETS = 'imagePullSecrets'
3133

3234
# specific to Verrazzano
3335
COMPONENT_KIND = 'Component'
@@ -90,6 +92,7 @@ def _update_documents(documents, kubernetes_content, output_file_path):
9092
# is this a standard WKO document?
9193
if kind == WKO_DOMAIN_KIND:
9294
_update_dictionary(document, kubernetes_content, schema, None, output_file_path)
95+
_add_comments(document)
9396
found = True
9497

9598
# is this a Verrazzano WebLogic workload document?
@@ -101,6 +104,7 @@ def _update_documents(documents, kubernetes_content, output_file_path):
101104
component_spec = _get_or_create_dictionary(workload, SPEC)
102105
component_template = _get_or_create_dictionary(component_spec, TEMPLATE)
103106
_update_dictionary(component_template, kubernetes_content, schema, None, output_file_path)
107+
_add_comments(component_template)
104108
found = True
105109

106110
if not found:
@@ -255,6 +259,19 @@ def _check_named_object_list(model_value, type_name, schema_folder, schema_path,
255259
return model_value
256260

257261

262+
def _add_comments(wko_dictionary):
263+
"""
264+
Add relevant comments to the output dictionary to provide additional information.
265+
:param wko_dictionary: the top-level WKO dictionary containing metadata, spec, etc.
266+
"""
267+
spec = dictionary_utils.get_element(wko_dictionary, SPEC)
268+
if spec:
269+
image_pull_secrets = dictionary_utils.get_element(spec, IMAGE_PULL_SECRETS)
270+
if image_pull_secrets is not None and not len(image_pull_secrets):
271+
message = exception_helper.get_message('WLSDPLY-01679')
272+
spec.addComment(IMAGE_PULL_SECRETS, message)
273+
274+
258275
def _get_or_create_dictionary(dictionary, key):
259276
if key not in dictionary:
260277
dictionary[key] = PyOrderedDict()

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ WLSDPLY-01675=Updating target output file "{0}" from the {1} section of the mode
320320
WLSDPLY-01676=Unable to find section for update in target output file "{0}"
321321
WLSDPLY-01677=Expected a map value for {0} in the target output file {1}, skipping update
322322
WLSDPLY-01678=Expected a list value for {0} in the target output file {1}, skipping update
323+
WLSDPLY-01679=Add any credential secrets that are required to pull the image
323324

324325
# wlsdeploy/util/enum.py
325326
WLSDPLY-01700=The value {0} is not a valid value of the Enum type {1}

core/src/main/targetconfigs/templates/wko-domain.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ spec:
2020
image: '{{{imageName}}}'
2121

2222
# Identify which Secret contains the credentials for pulling an image
23-
imagePullSecrets:
24-
- name: ocir
23+
imagePullSecrets: []
2524

2625
# Identify which Secret contains the WebLogic Admin credentials
2726
webLogicCredentialsSecret:

0 commit comments

Comments
 (0)