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.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at
3
3
// http://oss.oracle.com/licenses/upl.
4
4
@@ -80,18 +80,12 @@ static class ScriptConfigMapContext extends ConfigMapContext {
80
80
}
81
81
82
82
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 );
86
84
}
87
85
88
86
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 );
95
89
}
96
90
97
91
private synchronized Map <String , String > loadScriptsFromClasspath () {
@@ -201,7 +195,6 @@ protected V1ObjectMeta createMetadata(String configMapName) {
201
195
.name (configMapName )
202
196
.namespace (this .domainNamespace )
203
197
.putLabelsItem (LabelConstants .RESOURCE_VERSION_LABEL , DEFAULT_DOMAIN_VERSION )
204
- .putLabelsItem (LabelConstants .OPERATORNAME_LABEL , operatorNamespace )
205
198
.putLabelsItem (LabelConstants .CREATEDBYOPERATOR_LABEL , "true" );
206
199
}
207
200
@@ -312,6 +305,7 @@ private static String getOperatorNamespace() {
312
305
313
306
public static class SitConfigMapContext extends ConfigMapContext {
314
307
Map <String , String > data ;
308
+ String domainUID ;
315
309
String cmName ;
316
310
317
311
SitConfigMapContext (
@@ -322,6 +316,7 @@ public static class SitConfigMapContext extends ConfigMapContext {
322
316
Map <String , String > data ) {
323
317
super (conflictStep , operatorNamespace , domainNamespace );
324
318
319
+ this .domainUID = domainUID ;
325
320
this .cmName = getConfigMapName (domainUID );
326
321
this .data = data ;
327
322
this .model = createModel (data );
@@ -331,7 +326,7 @@ private V1ConfigMap createModel(Map<String, String> data) {
331
326
return new V1ConfigMap ()
332
327
.apiVersion ("v1" )
333
328
.kind ("ConfigMap" )
334
- .metadata (createMetadata (cmName ))
329
+ .metadata (createMetadata ())
335
330
.data (data );
336
331
}
337
332
@@ -343,6 +338,10 @@ ResponseStep<V1ConfigMap> createReadResponseStep(Step next) {
343
338
return new ReadResponseStep (next );
344
339
}
345
340
341
+ private V1ObjectMeta createMetadata () {
342
+ return super .createMetadata (cmName ).putLabelsItem (LabelConstants .DOMAINUID_LABEL , domainUID );
343
+ }
344
+
346
345
class ReadResponseStep extends DefaultResponseStep <V1ConfigMap > {
347
346
ReadResponseStep (Step next ) {
348
347
super (next );
0 commit comments