Files
cicdTest/deploy.yaml

183 lines
3.3 KiB
YAML

---
apiVersion: v1
kind: Namespace
metadata:
name: istio-project-1
labels:
istio-injection: enabled #zorgt voor auto sidecar injection
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-a
namespace: istio-project-1
spec:
replicas: 1
selector:
matchLabels:
server: "http"
app: "project-1" #app label bepaald groepering pods in kiali dashboard dus makkelijker te gebruiken
expose: "true"
template:
metadata:
labels:
server: "http"
app: "project-1"
expose: "true"
spec:
containers:
- name: front-end
image: beppev/server-a:latest
ports:
- containerPort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-b
namespace: istio-project-1
spec:
replicas: 1
selector:
matchLabels:
server: "http"
app: "project-1"
version: v1
backend: "true"
template:
metadata:
labels:
server: "http"
app: "project-1"
version: v1
backend: "true"
spec:
containers:
- name: front-end
image: beppev/server-b:latest
ports:
- containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-c
namespace: istio-project-1
spec:
replicas: 1
selector:
matchLabels:
server: "http"
app: "project-1"
version: v2
backend: "true"
template:
metadata:
labels:
server: "http"
app: "project-1"
version: v2
backend: "true"
spec:
containers:
- name: front-end
image: beppev/server-c:latest
ports:
- containerPort: 6000
---
apiVersion: v1
kind: Service
metadata:
name: server-check
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
backend: "true"
ports:
- name: http
protocol: TCP
port: 6000
---
kind: Service
apiVersion: v1
metadata:
name: example-loadbalancer
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
expose: "true"
ports:
- name: http
protocol: TCP
targetPort: 5000
port: 80
type: LoadBalancer
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: server-check-destination
namespace: istio-project-1
labels:
app: "project-1"
spec:
host: server-check
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: server-check-gateway
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
expose: "true"
servers:
- port:
number: 6000
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: server-check-service
namespace: istio-project-1
labels:
app: "project-1"
spec:
hosts:
- "*"
gateways:
- server-check-gateway
tcp:
- 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