mirror of
https://github.com/bvanroll/cicdTest.git
synced 2025-08-29 03:52:44 +00:00
aanpassing deployment voor traffic mirror test
This commit is contained in:
73
deploy.yaml
73
deploy.yaml
@@ -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
24
serverD/app.py
Normal 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
10
serverD/dockerfile
Normal 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
1
serverD/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
dees is de mirror server
|
8
serverD/test.txt
Normal file
8
serverD/test.txt
Normal 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
|
Reference in New Issue
Block a user