Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 8b81b36

Browse files
committed
Add role_merged_configs into workflow executions environmentxi
Merges per-role config settings into merged_config_settings which is wired into the workflow executions environment. Useful to consume role config settings from within a workflow. Change-Id: Id37de5864138edd5476c097a8a1f0763faeaf768
1 parent baf6eee commit 8b81b36

File tree

3 files changed

+77
-23
lines changed

3 files changed

+77
-23
lines changed

docker/docker-steps.j2

+8
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,19 @@ resources:
129129
params:
130130
env:
131131
service_ips: { get_param: ctlplane_service_ips }
132+
role_merged_configs:
133+
{% for r in roles %}
134+
{{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]}
135+
{% endfor %}
132136
UPDATE:
133137
workflow: { get_resource: WorkflowTasks_Step{{step}} }
134138
params:
135139
env:
136140
service_ips: { get_param: ctlplane_service_ips }
141+
role_merged_configs:
142+
{% for r in roles %}
143+
{{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]}
144+
{% endfor %}
137145
always_update: true
138146
# END service_workflow_tasks handling
139147
{% endfor %}

overcloud.j2.yaml

+61-23
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ parameters:
5555
Control the IP allocation for the ControlVirtualIP port. E.g.
5656
[{'ip_address':'1.2.3.4'}]
5757
type: json
58+
ExtraConfig:
59+
default: {}
60+
description: |
61+
Additional hiera configuration to inject into the cluster.
62+
type: json
63+
{% for role in roles %}
64+
{{role.name}}ExtraConfig:
65+
default: {}
66+
description: |
67+
Role specific additional hiera configuration to inject into the cluster.
68+
type: json
69+
{% endfor %}
5870
InternalApiVirtualFixedIPs:
5971
default: []
6072
description: >
@@ -323,6 +335,46 @@ resources:
323335
type: json
324336
value: {get_attr: [{{role.name}}ServiceChain, role_data]}
325337

338+
{{role.name}}ServiceConfigSettings:
339+
type: OS::Heat::Value
340+
properties:
341+
type: json
342+
value:
343+
map_merge:
344+
- get_attr: [{{role.name}}ServiceChainRoleData, value, config_settings]
345+
{% for r in roles %}
346+
- get_attr: [{{r.name}}ServiceChainRoleData, value, global_config_settings]
347+
{% endfor %}
348+
# This next step combines two yaql passes:
349+
# - The inner one does a deep merge on the service_config_settings for all roles
350+
# - The outer one filters the map based on the services enabled for the role
351+
# then merges the result into one map.
352+
- yaql:
353+
expression: let(root => $) -> $.data.map.items().where($[0] in coalesce($root.data.services, [])).select($[1]).reduce($1.mergeWith($2), {})
354+
data:
355+
map:
356+
yaql:
357+
expression: $.data.where($ != null).reduce($1.mergeWith($2), {})
358+
data:
359+
{% for r in roles %}
360+
- get_attr: [{{r.name}}ServiceChainRoleData, value, service_config_settings]
361+
{% endfor %}
362+
services: {get_attr: [{{role.name}}ServiceNames, value]}
363+
364+
{{role.name}}MergedConfigSettings:
365+
type: OS::Heat::Value
366+
properties:
367+
type: json
368+
value:
369+
config_settings: {}
370+
global_config_settings: {}
371+
service_config_settings: {}
372+
merged_config_settings:
373+
map_merge:
374+
- get_attr: [{{role.name}}ServiceConfigSettings, value]
375+
- get_param: ExtraConfig
376+
- get_param: {{role.name}}ExtraConfig
377+
326378
# Filter any null/None service_names which may be present due to mapping
327379
# of services to OS::Heat::None
328380
{{role.name}}ServiceNames:
@@ -437,27 +489,7 @@ resources:
437489
{% else %}
438490
NovaComputeSchedulerHints: {get_param: NovaComputeSchedulerHints}
439491
{% endif %}
440-
ServiceConfigSettings:
441-
map_merge:
442-
- get_attr: [{{role.name}}ServiceChainRoleData, value, config_settings]
443-
{% for r in roles %}
444-
- get_attr: [{{r.name}}ServiceChain, role_data, global_config_settings]
445-
{% endfor %}
446-
# This next step combines two yaql passes:
447-
# - The inner one does a deep merge on the service_config_settings for all roles
448-
# - The outer one filters the map based on the services enabled for the role
449-
# then merges the result into one map.
450-
- yaql:
451-
expression: let(root => $) -> $.data.map.items().where($[0] in coalesce($root.data.services, [])).select($[1]).reduce($1.mergeWith($2), {})
452-
data:
453-
map:
454-
yaql:
455-
expression: $.data.where($ != null).reduce($1.mergeWith($2), {})
456-
data:
457-
{% for r in roles %}
458-
- get_attr: [{{r.name}}ServiceChain, role_data, service_config_settings]
459-
{% endfor %}
460-
services: {get_attr: [{{role.name}}ServiceNames, value]}
492+
ServiceConfigSettings: {get_attr: [{{role.name}}ServiceConfigSettings, value]}
461493
ServiceNames: {get_attr: [{{role.name}}ServiceNames, value]}
462494
MonitoringSubscriptions: {get_attr: [{{role.name}}ServiceChainRoleData, value, monitoring_subscriptions]}
463495
ServiceMetadataSettings: {get_attr: [{{role.name}}ServiceChainRoleData, value, service_metadata_settings]}
@@ -784,7 +816,10 @@ resources:
784816
{% endfor %}
785817
role_data:
786818
{% for role in roles %}
787-
{{role.name}}: {get_attr: [{{role.name}}ServiceChainRoleData, value]}
819+
{{role.name}}:
820+
map_merge:
821+
- {get_attr: [{{role.name}}ServiceChainRoleData, value]}
822+
- {get_attr: [{{role.name}}MergedConfigSettings, value]}
788823
{% endfor %}
789824

790825
ServerOsCollectConfigData:
@@ -869,7 +904,10 @@ outputs:
869904
description: The configuration data associated with each role
870905
value:
871906
{% for role in roles %}
872-
{{role.name}}: {get_attr: [{{role.name}}ServiceChainRoleData, value]}
907+
{{role.name}}:
908+
map_merge:
909+
- {get_attr: [{{role.name}}ServiceChainRoleData, value]}
910+
- {get_attr: [{{role.name}}MergedConfigSettings, value]}
873911
{% endfor %}
874912
RoleNetIpMap:
875913
description: Mapping of each network to a list of IPs for each role

puppet/puppet-steps.j2

+8
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,19 @@ resources:
136136
params:
137137
env:
138138
service_ips: { get_param: ctlplane_service_ips }
139+
role_merged_configs:
140+
{% for r in roles %}
141+
{{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]}
142+
{% endfor %}
139143
UPDATE:
140144
workflow: { get_resource: WorkflowTasks_Step{{step}} }
141145
params:
142146
env:
143147
service_ips: { get_param: ctlplane_service_ips }
148+
role_merged_configs:
149+
{% for r in roles %}
150+
{{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]}
151+
{% endfor %}
144152
always_update: true
145153
{% endfor %}
146154
# END service_workflow_tasks handling

0 commit comments

Comments
 (0)