feat: Gunicorn + HTTP POST (base64, retry), drop WebSocket, bump 1.0.19
Deploy loadtest / validate (push) Waiting to run
Deploy loadtest / validate (push) Waiting to run
This commit is contained in:
+72
@@ -0,0 +1,72 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: wstest
|
||||
namespace: 9039a501-df2c-4b85-b049-9cd4f77e6ac0
|
||||
labels:
|
||||
app: wstest
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
image: python:3.12-slim
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
pip install flask flask-sock && python -c '
|
||||
from flask import Flask
|
||||
from flask_sock import Sock
|
||||
import json, time
|
||||
app = Flask(__name__)
|
||||
sock = Sock(app)
|
||||
|
||||
@sock.route("/ws")
|
||||
def ws(ws):
|
||||
t0 = time.time()
|
||||
total = 0
|
||||
while True:
|
||||
chunk = ws.receive()
|
||||
if chunk is None: break
|
||||
if isinstance(chunk, str) and chunk == "DONE": break
|
||||
total += len(chunk)
|
||||
ws.send(json.dumps({"ok":True,"bytes":total,"elapsed_ms":round((time.time()-t0)*1000)}))
|
||||
|
||||
app.run(host="0.0.0.0", port=5000)
|
||||
'
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
resources:
|
||||
requests: {cpu: 100m, memory: 256Mi}
|
||||
limits: {cpu: 500m, memory: 512Mi}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: wstest
|
||||
namespace: 9039a501-df2c-4b85-b049-9cd4f77e6ac0
|
||||
spec:
|
||||
selector:
|
||||
app: wstest
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 5000
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: wstest
|
||||
namespace: 9039a501-df2c-4b85-b049-9cd4f77e6ac0
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
|
||||
nginx.ingress.kubernetes.io/proxy-buffering: "off"
|
||||
spec:
|
||||
rules:
|
||||
- host: wstest.pythonk8s.dev.nubes.ru
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: wstest
|
||||
port:
|
||||
number: 80
|
||||
Reference in New Issue
Block a user