Browse Source

Setup mirrored queues for celery in rabbit

This change starts setting up mirrored queues by default.
If there is only one rabbitmq pod present this will still
work, though will cause some performance overhead.

Depends-On: https://review.openstack.org/617812
Depends-On: https://review.openstack.org/617817
Change-Id: I8982aed699185f9b7fb4962e108eb76377643f25
changes/10/614610/21
Vladyslav Drok 8 months ago
parent
commit
2134a87875

+ 2
- 0
charts/shipyard/templates/configmap-airflow-bin.yaml View File

@@ -21,6 +21,8 @@ kind: ConfigMap
21 21
 metadata:
22 22
   name: airflow-bin
23 23
 data:
24
+  rabbit-init.sh: |+
25
+{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }}
24 26
   airflow-db-init.sh: |+
25 27
 {{ tuple "bin/_airflow-db-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
26 28
   airflow-db-sync.sh: |+

+ 20
- 0
charts/shipyard/templates/job-rabbit-init.yaml View File

@@ -0,0 +1,20 @@
1
+{{/*
2
+Copyright 2018 The Openstack-Helm Authors.
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.job_rabbit_init }}
18
+{{- $rmqJob := dict "envAll" . "serviceName" "airflow" -}}
19
+{{ $rmqJob | include "helm-toolkit.manifests.job_rabbit_init" }}
20
+{{- end }}

+ 28
- 0
charts/shipyard/templates/secret-rabbitmq.yaml View File

@@ -0,0 +1,28 @@
1
+{{/*
2
+Copyright 2018 The Openstack-Helm Authors.
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.secret_rabbitmq }}
18
+{{- $envAll := . }}
19
+{{- $secretName := index $envAll.Values.secrets.oslo_messaging "admin" }}
20
+---
21
+apiVersion: v1
22
+kind: Secret
23
+metadata:
24
+  name: {{ $secretName }}
25
+type: Opaque
26
+data:
27
+  RABBITMQ_CONNECTION: {{ tuple "oslo_messaging" "internal" "admin" "http" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc }}
28
+{{- end }}

+ 28
- 0
charts/shipyard/templates/secret-user-rabbitmq.yaml View File

@@ -0,0 +1,28 @@
1
+{{/*
2
+Copyright 2018 The Openstack-Helm Authors.
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.secret_rabbitmq }}
18
+{{- $envAll := . }}
19
+{{- $secretName := index $envAll.Values.secrets.oslo_messaging "airflow" }}
20
+---
21
+apiVersion: v1
22
+kind: Secret
23
+metadata:
24
+  name: {{ $secretName }}
25
+type: Opaque
26
+data:
27
+  RABBITMQ_CONNECTION: {{ tuple "oslo_messaging" "internal" "user" "amqp" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc }}
28
+{{- end }}

+ 35
- 1
charts/shipyard/values.yaml View File

@@ -37,6 +37,7 @@ images:
37 37
     shipyard_db_init: docker.io/postgres:9.5
38 38
     shipyard_db_sync: quay.io/airshipit/shipyard:latest
39 39
     airflow_db_init: docker.io/postgres:9.5
40
+    rabbit_init: docker.io/rabbitmq:3.7-management
40 41
     airflow_db_sync: quay.io/airshipit/airflow:latest
41 42
     ks_user: docker.io/openstackhelm/heat:ocata
42 43
     ks_service: docker.io/openstackhelm/heat:ocata
@@ -105,6 +106,10 @@ dependencies:
105 106
       services:
106 107
         - service: postgresql_airflow_db
107 108
           endpoint: internal
109
+    rabbit_init:
110
+      services:
111
+        - service: oslo_messaging
112
+          endpoint: internal
108 113
     airflow_db_sync:
109 114
       jobs:
110 115
         - airflow-db-init
@@ -143,6 +148,7 @@ dependencies:
143 148
           endpoint: internal
144 149
     airflow_server:
145 150
       jobs:
151
+        - airflow-rabbit-init
146 152
         - airflow-db-init
147 153
         - airflow-db-sync
148 154
       services:
@@ -316,17 +322,22 @@ endpoints:
316 322
   oslo_messaging:
317 323
     auth:
318 324
       user:
325
+        username: airflow
326
+        password: password
327
+      admin:
319 328
         username: rabbitmq
320 329
         password: password
321 330
     hosts:
322 331
       default: rabbitmq
323 332
     host_fqdn_override:
324 333
       default: null
325
-    path: /
334
+    path: /airflow
326 335
     scheme: amqp
327 336
     port:
328 337
       amqp:
329 338
         default: 5672
339
+      http:
340
+        default: 15672
330 341
   oslo_cache:
331 342
     hosts:
332 343
       default: memcached
@@ -340,6 +351,9 @@ secrets:
340 351
   identity:
341 352
     admin: shipyard-keystone-admin
342 353
     shipyard: shipyard-keystone-user
354
+  oslo_messaging:
355
+    admin: airflow-rabbitmq-admin
356
+    airflow: airflow-rabbitmq-user
343 357
   postgresql_shipyard_db:
344 358
     admin: shipyard-db-admin
345 359
     user: shipyard-db-user
@@ -379,6 +393,17 @@ conf:
379 393
     workflow_orchestrator:action_update_software: rule:admin_create
380 394
     workflow_orchestrator:action_redeploy_server: rule:admin_create
381 395
     workflow_orchestrator:action_relabel_nodes: rule:admin_create
396
+  rabbitmq:
397
+    # adding rmq policy to mirror messages from celery queues
398
+    policies:
399
+      - vhost: "/"
400
+        name: "ha_celery"
401
+        definition:
402
+          ha-mode: "all"
403
+          ha-sync-mode: "automatic"
404
+        priority: 0
405
+        apply-to: all
406
+        pattern: 'celery.*'
382 407
   paste:
383 408
     app:shipyard-api:
384 409
       paste.app_factory: shipyard_airflow.shipyard_api:paste_start_shipyard
@@ -760,6 +785,13 @@ pod:
760 785
         memory: "128Mi"
761 786
         cpu: "100m"
762 787
     jobs:
788
+      rabbit_init:
789
+        limits:
790
+          memory: "128Mi"
791
+          cpu: "500m"
792
+        requests:
793
+          memory: "128Mi"
794
+          cpu: "500m"
763 795
       airflow_db_init:
764 796
         limits:
765 797
           memory: "128Mi"
@@ -839,6 +871,7 @@ manifests:
839 871
   ingress_shipyard_api: true
840 872
   job_shipyard_db_init: true
841 873
   job_shipyard_db_sync: true
874
+  job_rabbit_init: true
842 875
   job_airflow_db_init: true
843 876
   job_airflow_db_sync: true
844 877
   job_ks_endpoints: true
@@ -848,6 +881,7 @@ manifests:
848 881
   secret_shipyard_db: true
849 882
   secret_ingress_tls: true
850 883
   secret_keystone: true
884
+  secret_rabbitmq: true
851 885
   service_airflow_ingress: true
852 886
   service_airflow_flower: true
853 887
   service_shipyard: true

+ 1
- 1
tools/gate/playbooks/zuul-linter.yaml View File

@@ -15,6 +15,6 @@
15 15
 - hosts: primary
16 16
   tasks:
17 17
     - name: Execute a Whitespace Linter check
18
-      command: find . -not -path "*/\.*" -not -path "*/doc/build/*" -not -name "*.tgz" -type f -exec egrep -l " +$" {} \;
18
+      command: find . -not -path "*/\.*" -not -path "*/doc/build/*" -not -name "*.tgz" -not -name "*.png" -type f -exec egrep -l " +$" {} \;
19 19
       register: result
20 20
       failed_when: result.stdout != ""

Loading…
Cancel
Save