diff --git a/UPGRADE.md b/UPGRADE.md index 8148e5e..f1c32f8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -12,6 +12,7 @@ ## Upgrade from v5.0.0 to v5.1.0 +- improved probes and graceful shutdown for storefront ([#76](https://github.com/shopsys/deployment/pull/76)) - 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)) diff --git a/kubernetes/deployments/storefront.yaml b/kubernetes/deployments/storefront.yaml index 000a70f..b096c87 100644 --- a/kubernetes/deployments/storefront.yaml +++ b/kubernetes/deployments/storefront.yaml @@ -39,29 +39,34 @@ spec: lifecycle: preStop: exec: - command: - - sleep - - '10' + command: ["/bin/sh","-lc","sleep 10"] resources: limits: memory: "1.5Gi" requests: cpu: "500m" memory: "800Mi" + startupProbe: + httpGet: + path: /api/health + port: 3000 + periodSeconds: 2 + timeoutSeconds: 2 + failureThreshold: 60 livenessProbe: httpGet: path: /api/health port: 3000 - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 3 readinessProbe: httpGet: path: /api/health port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 3 + timeoutSeconds: 2 + failureThreshold: 1 terminationGracePeriodSeconds: 60 imagePullSecrets: - name: dockerregistry diff --git a/tests/scenarios/basic-production/expected/webserver.yaml b/tests/scenarios/basic-production/expected/webserver.yaml index 9ea6305..854c3d6 100644 --- a/tests/scenarios/basic-production/expected/webserver.yaml +++ b/tests/scenarios/basic-production/expected/webserver.yaml @@ -620,33 +620,41 @@ spec: preStop: exec: command: - - sleep - - "10" + - /bin/sh + - -lc + - sleep 10 livenessProbe: + failureThreshold: 3 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 name: storefront ports: - containerPort: 3000 name: storefront protocol: TCP readinessProbe: + failureThreshold: 1 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 3 + timeoutSeconds: 2 resources: limits: memory: 1.5Gi requests: cpu: 500m memory: 800Mi + startupProbe: + failureThreshold: 60 + httpGet: + path: /api/health + port: 3000 + periodSeconds: 2 + timeoutSeconds: 2 imagePullSecrets: - name: dockerregistry terminationGracePeriodSeconds: 60 diff --git a/tests/scenarios/development-single-domain/expected/webserver.yaml b/tests/scenarios/development-single-domain/expected/webserver.yaml index 86d00b3..d5df13a 100644 --- a/tests/scenarios/development-single-domain/expected/webserver.yaml +++ b/tests/scenarios/development-single-domain/expected/webserver.yaml @@ -614,33 +614,41 @@ spec: preStop: exec: command: - - sleep - - "10" + - /bin/sh + - -lc + - sleep 10 livenessProbe: + failureThreshold: 3 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 name: storefront ports: - containerPort: 3000 name: storefront protocol: TCP readinessProbe: + failureThreshold: 1 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 3 + timeoutSeconds: 2 resources: limits: memory: 1.5Gi requests: cpu: 500m memory: 800Mi + startupProbe: + failureThreshold: 60 + httpGet: + path: /api/health + port: 3000 + periodSeconds: 2 + timeoutSeconds: 2 imagePullSecrets: - name: dockerregistry terminationGracePeriodSeconds: 60 diff --git a/tests/scenarios/escaping-env/expected/webserver.yaml b/tests/scenarios/escaping-env/expected/webserver.yaml index 97d9950..0520bbb 100644 --- a/tests/scenarios/escaping-env/expected/webserver.yaml +++ b/tests/scenarios/escaping-env/expected/webserver.yaml @@ -625,33 +625,41 @@ spec: preStop: exec: command: - - sleep - - "10" + - /bin/sh + - -lc + - sleep 10 livenessProbe: + failureThreshold: 3 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 name: storefront ports: - containerPort: 3000 name: storefront protocol: TCP readinessProbe: + failureThreshold: 1 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 3 + timeoutSeconds: 2 resources: limits: memory: 1.5Gi requests: cpu: 500m memory: 800Mi + startupProbe: + failureThreshold: 60 + httpGet: + path: /api/health + port: 3000 + periodSeconds: 2 + timeoutSeconds: 2 imagePullSecrets: - name: dockerregistry terminationGracePeriodSeconds: 60 diff --git a/tests/scenarios/production-with-cloudflare/expected/webserver.yaml b/tests/scenarios/production-with-cloudflare/expected/webserver.yaml index af0b676..c318b1f 100644 --- a/tests/scenarios/production-with-cloudflare/expected/webserver.yaml +++ b/tests/scenarios/production-with-cloudflare/expected/webserver.yaml @@ -621,33 +621,41 @@ spec: preStop: exec: command: - - sleep - - "10" + - /bin/sh + - -lc + - sleep 10 livenessProbe: + failureThreshold: 3 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 name: storefront ports: - containerPort: 3000 name: storefront protocol: TCP readinessProbe: + failureThreshold: 1 httpGet: path: /api/health port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 + periodSeconds: 3 + timeoutSeconds: 2 resources: limits: memory: 1.5Gi requests: cpu: 500m memory: 800Mi + startupProbe: + failureThreshold: 60 + httpGet: + path: /api/health + port: 3000 + periodSeconds: 2 + timeoutSeconds: 2 imagePullSecrets: - name: dockerregistry terminationGracePeriodSeconds: 60