---
apiVersion: v1
kind: Namespace
metadata:
  name: linkerd-project-1
  annotations:
    linkerd.io/inject: enabled
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-a
  namespace: linkerd-project-1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      namespace: linkerd-project-1
      labels:
        app: frontend
        group: frontend
    spec:
      containers:
        - name: frontend
          image: beppev/server-a:master
          imagePullPolicy: "Always"
          ports:
            - containerPort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: linkerd-project-1
  name: server-b
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend-master
      group: backend
  template:
    metadata:
      namespace: linkerd-project-1
      labels:
        app: backend-master
        group: backend  
    spec:
      containers:
        - name: backend
          image: beppev/server-b:master
          imagePullPolicy: "Always"
          ports:
            - containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: linkerd-project-1
  name: server-b-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend-experimental
      group: backend
  template:
    metadata:
      namespace: linkerd-project-1
      labels:
        app: backend-experimental
        group: backend
    spec:
      containers:
        - name: backend
          image: beppev/server-b:experimental
          imagePullPolicy: "Always"
          ports:
            - containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: linkerd-project-1
  name: server-d
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mirror
  template:
    metadata:
      namespace: linkerd-project-1
      labels:
        group: mirror
        app: mirror
    spec:
      containers:
        - name: mirror
          image: beppev/server-d:master
          ports:
            - containerPort: 6000
---
apiVersion: v1
kind: Service
metadata:
  name: server-check
  namespace: linkerd-project-1
spec:
  ports:
    - name: http
      port: 6000
      targetPort: 6000
---
apiVersion: v1
kind: Service
metadata:
  name: server-check-master
  namespace: linkerd-project-1
spec:
  selector:
    app: backend-master
  ports:
    - name: http
      port: 6000
      targetPort: 6000
---
apiVersion: v1
kind: Service
metadata:
  name: server-check-experimental
  namespace: linkerd-project-1
spec:
  selector:
    app: backend-experimental
  ports:
    - name: http
      port: 6000
      targetPort: 6000
---
apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
  name: splitter
  namespace: linkerd-project-1
spec:
  service: server-check
  backends:
  - service: server-check-experimental
    weight: 90
  - service: server-check-master
    weight: 10 
---
apiVersion: v1
kind: Service
metadata:
  name: expose-server
  namespace: linkerd-project-1
spec:
  selector:
    group: frontend
  ports:
    - name: http
      protocol: TCP
      port: 5000
      targetPort: 5000
      nodePort: 30036
  type: NodePort
---
apiVersion: v1
kind: Service
metadata:
  name: mirror-service
  namespace: linkerd-project-1
spec:
  selector:
    group: mirror
  ports:
    - name: http
      protocol: TCP
      port: 7000
      targetPort: 7000

