1- // Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+ // Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22// Licensed under the Universal Permissive License v 1.0 as shown at
33// http://oss.oracle.com/licenses/upl.
44
@@ -80,18 +80,12 @@ static class ScriptConfigMapContext extends ConfigMapContext {
8080 }
8181
8282 private V1ConfigMap createModel (Map <String , String > data ) {
83- return new V1ConfigMap ()
84- .metadata (createMetadata (KubernetesConstants .DOMAIN_CONFIG_MAP_NAME ))
85- .data (data );
83+ return new V1ConfigMap ().metadata (createMetadata ()).data (data );
8684 }
8785
8886 private V1ObjectMeta createMetadata () {
89- return new V1ObjectMeta ()
90- .name (KubernetesConstants .DOMAIN_CONFIG_MAP_NAME )
91- .namespace (this .domainNamespace )
92- .putLabelsItem (LabelConstants .RESOURCE_VERSION_LABEL , DEFAULT_DOMAIN_VERSION )
93- .putLabelsItem (LabelConstants .OPERATORNAME_LABEL , operatorNamespace )
94- .putLabelsItem (LabelConstants .CREATEDBYOPERATOR_LABEL , "true" );
87+ return super .createMetadata (KubernetesConstants .DOMAIN_CONFIG_MAP_NAME )
88+ .putLabelsItem (LabelConstants .OPERATORNAME_LABEL , operatorNamespace );
9589 }
9690
9791 private synchronized Map <String , String > loadScriptsFromClasspath () {
@@ -201,7 +195,6 @@ protected V1ObjectMeta createMetadata(String configMapName) {
201195 .name (configMapName )
202196 .namespace (this .domainNamespace )
203197 .putLabelsItem (LabelConstants .RESOURCE_VERSION_LABEL , DEFAULT_DOMAIN_VERSION )
204- .putLabelsItem (LabelConstants .OPERATORNAME_LABEL , operatorNamespace )
205198 .putLabelsItem (LabelConstants .CREATEDBYOPERATOR_LABEL , "true" );
206199 }
207200
@@ -312,6 +305,7 @@ private static String getOperatorNamespace() {
312305
313306 public static class SitConfigMapContext extends ConfigMapContext {
314307 Map <String , String > data ;
308+ String domainUID ;
315309 String cmName ;
316310
317311 SitConfigMapContext (
@@ -322,6 +316,7 @@ public static class SitConfigMapContext extends ConfigMapContext {
322316 Map <String , String > data ) {
323317 super (conflictStep , operatorNamespace , domainNamespace );
324318
319+ this .domainUID = domainUID ;
325320 this .cmName = getConfigMapName (domainUID );
326321 this .data = data ;
327322 this .model = createModel (data );
@@ -331,7 +326,7 @@ private V1ConfigMap createModel(Map<String, String> data) {
331326 return new V1ConfigMap ()
332327 .apiVersion ("v1" )
333328 .kind ("ConfigMap" )
334- .metadata (createMetadata (cmName ))
329+ .metadata (createMetadata ())
335330 .data (data );
336331 }
337332
@@ -343,6 +338,10 @@ ResponseStep<V1ConfigMap> createReadResponseStep(Step next) {
343338 return new ReadResponseStep (next );
344339 }
345340
341+ private V1ObjectMeta createMetadata () {
342+ return super .createMetadata (cmName ).putLabelsItem (LabelConstants .DOMAINUID_LABEL , domainUID );
343+ }
344+
346345 class ReadResponseStep extends DefaultResponseStep <V1ConfigMap > {
347346 ReadResponseStep (Step next ) {
348347 super (next );
0 commit comments