aanpassing deployment voor traffic mirror test

This commit is contained in:
2020-03-05 09:55:12 +01:00
parent 6739c5c16e
commit 29fdb950f1
5 changed files with 104 additions and 12 deletions

View File

@@ -88,6 +88,44 @@ spec:
ports:
- containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-d
namespace: istio-project-1
spec:
replicas: 1
selector:
matchLabels:
app: "project-1"
mirror: "true"
template:
metadata:
labels:
app: "project-1"
mirror: "true"
spec:
containers:
- name: front-end
image: beppev/server-d:latest
ports:
- containerPort: 6000
---
apiVersion: v1
kind: Service
metadata:
name: mirror-service
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
mirror: "true"
ports:
- name: http
protocol: TCP
port: 6000
---
apiVersion: v1
kind: Service
metadata:
@@ -174,6 +212,14 @@ spec:
port:
number: 5000
host: expose-server-service
- match:
- uri:
prefix: /get
route:
- destination:
port:
number: 7000
host: mirror-service
--- # TODO fix gateway zodat we ingress gateway kunnen gebruike ipv de fuken loadbalancer.
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
@@ -209,15 +255,18 @@ spec:
- match:
- port: 6000
route:
- destination:
host: server-check
port:
number: 6000
subset: v1
weight: 50
- destination:
host: server-check
port:
number: 6000
subset: v2
weight: 50
- destination:
host: server-check
port:
number: 6000
subset: v1
weight: 50
- destination:
host: server-check
port:
number: 6000
subset: v2
weight: 50
mirror:
host: mirror-service
mirror_percent: 100

24
serverD/app.py Normal file
View File

@@ -0,0 +1,24 @@
from flask import Flask
from flask import jsonify
app = Flask(__name__)
requ = ""
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def doRequest(path):
requ = +path + ' \n'
with open("test.txt", "a") as myfile:
myfile.write(requ)
return "None"
@app.route('/get')
def get():
with open("test.txt", "r") as infile:
return 'we have something: ' + '\n '.join(infile.readlines())
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=7000)

10
serverD/dockerfile Normal file
View File

@@ -0,0 +1,10 @@
from python:3.7
copy . /app
workdir /app
run pip install -r requirements.txt
expose 7000
entrypoint [ "python" ]
cmd [ "app.py" ]

1
serverD/readme.md Normal file
View File

@@ -0,0 +1 @@
dees is de mirror server

8
serverD/test.txt Normal file
View File

@@ -0,0 +1,8 @@
another request
another request
another request
another request
another request favicon.ico
another request
another request server-a
another request favicon.ico