From 788b95945a906ec443f5a26d6d094f1057eb392c Mon Sep 17 00:00:00 2001 From: vitortolao Date: Thu, 28 Nov 2024 23:04:38 -0300 Subject: [PATCH] add-files --- .gitignore | 12 ++++++++++ Dockerfile | 7 ++++++ kubernetes/deployment.yaml | 48 +++++++++++++++++++++++++++++++++++++ kubernetes/scaleobject.yaml | 18 ++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 Dockerfile create mode 100644 kubernetes/deployment.yaml create mode 100644 kubernetes/scaleobject.yaml diff --git a/.gitignore b/.gitignore index b6e4761..d794acb 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,15 @@ dmypy.json # Pyre type checker .pyre/ + +# OS generated files # +###################### +.DS_Store +.DS_Store? +.history/* +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..98315da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.13.0 +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . /app/ +EXPOSE 5000 +CMD [ "gunicorn", "0.0.0.0:5000", "app:app" ] \ No newline at end of file diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml new file mode 100644 index 0000000..515ff60 --- /dev/null +++ b/kubernetes/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: conversao-distancia + namespace: default + labels: + app: conversao-distancia +spec: + selector: + matchLabels: + app: conversao-distancia + replicas: 3 + template: + metadata: + labels: + app: conversao-distancia + spec: + containers: + - name: conversao-distancia + image: fabricioveronez/conversao-distancia:latest + resources: + requests: + cpu: 100m + memory: 100Mi + limits: + cpu: 100m + memory: 100Mi + ports: + - containerPort: 5000 + name: http +--- +apiVersion: v1 +kind: Service +metadata: + name: conversao-distancia + namespace: default +spec: + selector: + app: conversao-distancia + type: NodePort + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 5000 + nodePort: 30000 + + diff --git a/kubernetes/scaleobject.yaml b/kubernetes/scaleobject.yaml new file mode 100644 index 0000000..dd53af6 --- /dev/null +++ b/kubernetes/scaleobject.yaml @@ -0,0 +1,18 @@ +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: combined-scaledobject +spec: + scaleTargetRef: + name: conversao-distancia + minReplicaCount: 1 + maxReplicaCount: 10 + triggers: + - type: cpu + metadata: + type: Utilization + value: "50" + - type: memory + metadata: + type: Utilization + value: "20" \ No newline at end of file