Skip to content

Commit

Permalink
feat(federation-set): add support for
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Aug 11, 2021
1 parent 67a7f18 commit b77789b
Show file tree
Hide file tree
Showing 19 changed files with 597 additions and 159 deletions.
70 changes: 48 additions & 22 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,40 @@ rabbitmq:
- '.*'
- '.*'
- '.*'
parameters:
my-federation-upstream-set:
component: federation-upstream-set
definition:
# todo: multiple dict items (not just one)
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
definition:
uri: 'amqp://saltstack_mq:password@localhost'
ack-mode: on-confirm
trust-user-id: true
max-hops: 1
vhost: default_vhost
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: default_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: default_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
vhost: default_vhost
parameters:
my-upstream1:
component: federation-upstream
params:
uri: 'amqp://saltstack_mq:password@localhost'
ack-mode: on-confirm
trust-user-id: true
max-hops: 1
priority: 1
vhost: default_vhost

rabbit2:
Expand Down Expand Up @@ -197,27 +210,40 @@ rabbitmq:
- '.*'
- '.*'
- '.*'
parameters:
my-federation-upstream-set:
component: federation-upstream-set
definition:
# todo: multiple dict items (not just one)
upstream: my-federation-upstream1
vhost: rabbit2_vhost
my-federation-upstream1:
component: federation-upstream
definition:
uri: 'amqp://saltstack_mq:password@localhost'
ack-mode: on-confirm
trust-user-id: true
max-hops: 1
vhost: rabbit2_vhost
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: rabbit2_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: rabbit2_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
vhost: rabbit2_vhost
parameters:
my-upstream1:
component: federation-upstream
params:
uri: 'amqp://saltstack_mq:password@localhost'
ack-mode: on-confirm
trust-user-id: true
max-hops: 1
priority: 1
vhost: rabbit2_vhost

pkg:
Expand Down
6 changes: 5 additions & 1 deletion rabbitmq/config/parameters/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ include:
rabbitmq-config-parameters-present-{{ name }}-{{ param }}:
cmd.run:
- name: >-
/usr/sbin/rabbitmqctl --node {{ name }} set_parameter --vhost={{ '/' if 'vhost' not in p else p.vhost }} {{ p.component }} '{{ param }}' '{{ p.params|json }}' # noqa 204
{%- if p.component == 'federation-upstream' %}
/usr/sbin/rabbitmqctl --node {{ name }} set_parameter --vhost={{ '/' if 'vhost' not in p else p.vhost }} {{ p.component }} '{{ param }}' '{{ p.definition|json }}' # noqa 204
{%- else %}{# federation-upstream-set for now #}
/usr/sbin/rabbitmqctl --node {{ name }} set_parameter --vhost={{ '/' if 'vhost' not in p else p.vhost }} {{ p.component }} '{{ param }}' '[{{ p.definition|json }},]' # noqa 204
{%- endif %}
- runas: rabbitmq
- onlyif: test -x /usr/sbin/rabbitmqctl
- require:
Expand Down
40 changes: 32 additions & 8 deletions test/integration/default/files/_mapdata/almalinux-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ values:
vhost: default_vhost
nodeport: 5672
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
Expand All @@ -74,17 +79,24 @@ values:
- rabbitmq_shovel
- rabbitmq_shovel_management
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated1\.'
priority: 1
vhost: default_vhost
my-federation-policy2:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated2\.'
priority: 1
vhost: default_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: default_vhost
queues:
my-queue:
Expand Down Expand Up @@ -161,27 +173,39 @@ values:
join_node: rabbit # create multinode cluster on localhost
nodeport: 5673
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
uri: 'amqp://saltstack_mq:password@localhost'
vhost: rabbit2_vhost
plugins: []
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated1\.'
priority: 1
vhost: rabbit2_vhost
my-federation-policy2:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated2\.'
priority: 1
vhost: rabbit2_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: rabbit2_vhost
queues:
my-queue:
Expand Down
40 changes: 32 additions & 8 deletions test/integration/default/files/_mapdata/centos-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ values:
vhost: default_vhost
nodeport: 5672
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
Expand All @@ -77,17 +82,24 @@ values:
- rabbitmq_shovel
- rabbitmq_shovel_management
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: default_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: default_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: default_vhost
queues:
my-queue:
Expand Down Expand Up @@ -164,27 +176,39 @@ values:
join_node: rabbit # create multinode cluster on localhost
nodeport: 5673
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
uri: 'amqp://saltstack_mq:password@localhost'
vhost: rabbit2_vhost
plugins: []
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: rabbit2_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: rabbit2_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: rabbit2_vhost
queues:
my-queue:
Expand Down
40 changes: 32 additions & 8 deletions test/integration/default/files/_mapdata/centos-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ values:
vhost: default_vhost
nodeport: 5672
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
Expand All @@ -77,17 +82,24 @@ values:
- rabbitmq_shovel
- rabbitmq_shovel_management
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: default_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: default_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: default_vhost
queues:
my-queue:
Expand Down Expand Up @@ -164,27 +176,39 @@ values:
join_node: rabbit # create multinode cluster on localhost
nodeport: 5673
parameters:
my-upstream1:
my-federation-upstream-set:
component: federation-upstream-set
definition:
upstream: my-federation-upstream1
vhost: default_vhost
my-federation-upstream1:
component: federation-upstream
params:
definition:
ack-mode: on-confirm
max-hops: 1
trust-user-id: true
uri: 'amqp://saltstack_mq:password@localhost'
vhost: rabbit2_vhost
plugins: []
policies:
my-federate-policy:
my-federation-policy1:
definition:
federation-upstream-set: all
pattern: '^federated\.'
pattern: '^federated1\.'
priority: 1
vhost: rabbit2_vhost
my-federation-policy2:
definition:
federation-upstream-set: my-federation-upstream-set
pattern: '^federated2\.'
priority: 1
vhost: rabbit2_vhost
my-ha-policy:
definition:
ha-mode: nodes
ha-params: ["rabbit", "rabbit2"]
pattern: '.*'
priority: 1
vhost: rabbit2_vhost
queues:
my-queue:
Expand Down
Loading

0 comments on commit b77789b

Please sign in to comment.