From 6544a6fbdebadb8bc6e264f7fca6f07824a3277c Mon Sep 17 00:00:00 2001 From: Matheus Fidelis Date: Fri, 4 Jul 2025 11:33:42 -0300 Subject: [PATCH] version check --- main.py | 2 +- manifests/templates/hpa.yaml | 18 ++++++++++++++++++ manifests/templates/rollout.yml | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 manifests/templates/hpa.yaml diff --git a/main.py b/main.py index 488937b..de5f341 100644 --- a/main.py +++ b/main.py @@ -69,7 +69,7 @@ def redirect_to_docs(): @app.get("/version", tags=["util"]) def version(): """Retorna a versão do aplicativo.""" - return "2.0.0" + return "3.0.0" def simulate_heavy_load_randomly(): diff --git a/manifests/templates/hpa.yaml b/manifests/templates/hpa.yaml new file mode 100644 index 0000000..903d29d --- /dev/null +++ b/manifests/templates/hpa.yaml @@ -0,0 +1,18 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: semana-devops-hpa +spec: + scaleTargetRef: + apiVersion: argoproj.io/v1alpha1 + kind: Rollout + name: semana-devops + minReplicas: 3 + maxReplicas: 10 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 75 diff --git a/manifests/templates/rollout.yml b/manifests/templates/rollout.yml index 895b814..b1360a7 100644 --- a/manifests/templates/rollout.yml +++ b/manifests/templates/rollout.yml @@ -17,6 +17,28 @@ spec: image: {{ .Values.image }} ports: - containerPort: 8081 + probes: + startupProbe: + enabled: true + failureThreshold: 10 + periodSeconds: 10 + httpGet: + path: /startup + port: 8081 + readinessProbe: + enabled: true + failureThreshold: 10 + periodSeconds: 10 + httpGet: + path: /readyz + port: 8081 + livenessProbe: + enabled: true + failureThreshold: 10 + periodSeconds: 10 + httpGet: + path: /liveness + port: 8081 strategy: canary: steps: