diff --git a/UPGRADE.md b/UPGRADE.md index f02b750..8148e5e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -12,6 +12,7 @@ ## Upgrade from v5.0.0 to v5.1.0 +- added probes for RabbitMQ with graceful shutdown ([#75](https://github.com/shopsys/deployment/pull/75)) - changed container order for Redis ([#74](https://github.com/shopsys/deployment/pull/74)) - cache warmup is now run as an init container instead of a `postStart` lifecycle hook ([#73](https://github.com/shopsys/deployment/pull/73)) - cron pod is now always deleted gracefully ([#72](https://github.com/shopsys/deployment/pull/72)) diff --git a/kubernetes/deployments/rabbitmq.yaml b/kubernetes/deployments/rabbitmq.yaml index c2b9891..42dbe59 100644 --- a/kubernetes/deployments/rabbitmq.yaml +++ b/kubernetes/deployments/rabbitmq.yaml @@ -5,6 +5,10 @@ metadata: spec: serviceName: rabbitmq replicas: 1 + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 0 selector: matchLabels: app: rabbitmq @@ -30,6 +34,9 @@ spec: image: rabbitmq:4.1-management-alpine ports: - name: rabbitmq + containerPort: 5672 + protocol: TCP + - name: rabbitmq-management containerPort: 15672 protocol: TCP - name: exporter @@ -40,12 +47,37 @@ spec: value: "{{RABBITMQ_DEFAULT_USER}}" - name: RABBITMQ_DEFAULT_PASS value: "{{RABBITMQ_DEFAULT_PASS}}" + lifecycle: + preStop: + exec: + command: [ "sh", "-c", "rabbitmqctl stop_app && sleep 5" ] resources: requests: cpu: "20m" + memory: "256Mi" + limits: + memory: "512Mi" + startupProbe: + exec: + command: [ "rabbitmq-diagnostics", "ping" ] + failureThreshold: 30 + periodSeconds: 10 + livenessProbe: + exec: + command: ["rabbitmq-diagnostics", "ping"] + periodSeconds: 30 + timeoutSeconds: 15 + failureThreshold: 5 + readinessProbe: + exec: + command: [ "rabbitmq-diagnostics", "-q", "check_running" ] + periodSeconds: 10 + timeoutSeconds: 10 + failureThreshold: 3 volumeMounts: - name: rabbitmq-data mountPath: /var/lib/rabbitmq + terminationGracePeriodSeconds: 90 imagePullSecrets: - name: dockerregistry volumeClaimTemplates: diff --git a/tests/scenarios/basic-production/expected/migrate-continuous-deploy.yaml b/tests/scenarios/basic-production/expected/migrate-continuous-deploy.yaml index db00365..a621409 100644 --- a/tests/scenarios/basic-production/expected/migrate-continuous-deploy.yaml +++ b/tests/scenarios/basic-production/expected/migrate-continuous-deploy.yaml @@ -330,22 +330,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/basic-production/expected/migrate-first-deploy-with-demo-data.yaml b/tests/scenarios/basic-production/expected/migrate-first-deploy-with-demo-data.yaml index 00b1604..783a8b9 100644 --- a/tests/scenarios/basic-production/expected/migrate-first-deploy-with-demo-data.yaml +++ b/tests/scenarios/basic-production/expected/migrate-first-deploy-with-demo-data.yaml @@ -330,22 +330,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/basic-production/expected/migrate-first-deploy.yaml b/tests/scenarios/basic-production/expected/migrate-first-deploy.yaml index f754b94..f2e4508 100644 --- a/tests/scenarios/basic-production/expected/migrate-first-deploy.yaml +++ b/tests/scenarios/basic-production/expected/migrate-first-deploy.yaml @@ -330,22 +330,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/development-single-domain/expected/migrate-continuous-deploy.yaml b/tests/scenarios/development-single-domain/expected/migrate-continuous-deploy.yaml index f6cdf4f..4aa5e2f 100644 --- a/tests/scenarios/development-single-domain/expected/migrate-continuous-deploy.yaml +++ b/tests/scenarios/development-single-domain/expected/migrate-continuous-deploy.yaml @@ -211,22 +211,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/development-single-domain/expected/migrate-first-deploy-with-demo-data.yaml b/tests/scenarios/development-single-domain/expected/migrate-first-deploy-with-demo-data.yaml index 14a9bc2..3be3276 100644 --- a/tests/scenarios/development-single-domain/expected/migrate-first-deploy-with-demo-data.yaml +++ b/tests/scenarios/development-single-domain/expected/migrate-first-deploy-with-demo-data.yaml @@ -211,22 +211,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/development-single-domain/expected/migrate-first-deploy.yaml b/tests/scenarios/development-single-domain/expected/migrate-first-deploy.yaml index 1596709..799d038 100644 --- a/tests/scenarios/development-single-domain/expected/migrate-first-deploy.yaml +++ b/tests/scenarios/development-single-domain/expected/migrate-first-deploy.yaml @@ -211,22 +211,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/escaping-env/expected/migrate-continuous-deploy.yaml b/tests/scenarios/escaping-env/expected/migrate-continuous-deploy.yaml index 95f63d7..ec2fd15 100644 --- a/tests/scenarios/escaping-env/expected/migrate-continuous-deploy.yaml +++ b/tests/scenarios/escaping-env/expected/migrate-continuous-deploy.yaml @@ -332,22 +332,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/escaping-env/expected/migrate-first-deploy-with-demo-data.yaml b/tests/scenarios/escaping-env/expected/migrate-first-deploy-with-demo-data.yaml index f4a6620..849235c 100644 --- a/tests/scenarios/escaping-env/expected/migrate-first-deploy-with-demo-data.yaml +++ b/tests/scenarios/escaping-env/expected/migrate-first-deploy-with-demo-data.yaml @@ -332,22 +332,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/escaping-env/expected/migrate-first-deploy.yaml b/tests/scenarios/escaping-env/expected/migrate-first-deploy.yaml index 3ae5277..41471b2 100644 --- a/tests/scenarios/escaping-env/expected/migrate-first-deploy.yaml +++ b/tests/scenarios/escaping-env/expected/migrate-first-deploy.yaml @@ -332,22 +332,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/production-with-cloudflare/expected/migrate-continuous-deploy.yaml b/tests/scenarios/production-with-cloudflare/expected/migrate-continuous-deploy.yaml index d053b0b..c27a9da 100644 --- a/tests/scenarios/production-with-cloudflare/expected/migrate-continuous-deploy.yaml +++ b/tests/scenarios/production-with-cloudflare/expected/migrate-continuous-deploy.yaml @@ -447,22 +447,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy-with-demo-data.yaml b/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy-with-demo-data.yaml index 02eb055..83876d5 100644 --- a/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy-with-demo-data.yaml +++ b/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy-with-demo-data.yaml @@ -447,22 +447,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data diff --git a/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy.yaml b/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy.yaml index 42dc97a..c8ef750 100644 --- a/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy.yaml +++ b/tests/scenarios/production-with-cloudflare/expected/migrate-first-deploy.yaml @@ -447,22 +447,64 @@ spec: - name: RABBITMQ_DEFAULT_PASS value: rabbitmq-password image: rabbitmq:4.1-management-alpine + lifecycle: + preStop: + exec: + command: + - sh + - -c + - rabbitmqctl stop_app && sleep 5 + livenessProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 5 + periodSeconds: 30 + timeoutSeconds: 15 name: rabbitmq ports: - - containerPort: 15672 + - containerPort: 5672 name: rabbitmq protocol: TCP + - containerPort: 15672 + name: rabbitmq-management + protocol: TCP - containerPort: 15692 name: exporter protocol: TCP + readinessProbe: + exec: + command: + - rabbitmq-diagnostics + - -q + - check_running + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 10 resources: + limits: + memory: 512Mi requests: cpu: 20m + memory: 256Mi + startupProbe: + exec: + command: + - rabbitmq-diagnostics + - ping + failureThreshold: 30 + periodSeconds: 10 volumeMounts: - mountPath: /var/lib/rabbitmq name: rabbitmq-data imagePullSecrets: - name: dockerregistry + terminationGracePeriodSeconds: 90 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate volumeClaimTemplates: - metadata: name: rabbitmq-data