# ---
# apiVersion: v1
# kind: Namespace
# metadata:
#   name: consul-project-1
#   annotations:
#     "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-a
  # namespace: consul-project-1
  annotations:
    "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
spec:
  replicas: 1
  selector:
    matchLabels:
      server: "http"
      app: "project-1"
      expose: "true"
  template:
    metadata:
      labels:
        server: "http"
        app: "project-1"
        expose: "true"
      annotations:
        "consul.hashicorp.com/connect-inject": "true"
    spec:
      containers:
        - name: front-end
          image: beppev/server-a-consul:master
          imagePullPolicy: "Always"
          ports:
            - containerPort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-b
  # namespace: consul-project-1
  annotations:
    "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
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"
      annotations:
        "consul.hashicorp.com/connect-inject": "true"
    spec:
      containers:
        - name: front-end
          image: beppev/server-b-consul:master
          imagePullPolicy: "Always"
          ports:
            - containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-b-test
  # namespace: consul-project-1
  annotations:
    "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
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"
      annotations:
        "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
    spec:
      containers:
        - name: front-end
          image: beppev/server-b-consul:experimental
          imagePullPolicy: "Always"
          ports:
            - containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-d
  # namespace: consul-project-1
  annotations:
    "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "project-1"
      mirror: "true"
      server: "http"
  template:
    metadata:
      labels:
        app: "project-1"
        mirror: "true"
        server: "http"
      annotations:
        "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
    spec:
      containers:
        - name: front-end
          image: beppev/server-d-consul:master
          ports:
            - containerPort: 6000
# ---
# apiVersion: v1
# kind: Service
# metadata:
#   name: expose-service
#   # namespace: consul-project-1
#   annotations:
#     "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
#   labels:
#     app: "project-1"
# spec:
#   selector:
#     expose: "true"
#   ports:
#     - name: http
#       protocol: TCP
#       port: 5000
#       targetPort: 5000
#       nodePort: 30036
#   type: NodePort
# ---
# apiVersion: v1
# kind: Service
# metadata:
#   name: server-check
#   # namespace: consul-project-1
#   annotations:
#     "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
#   labels:
#     app: "project-1"
# spec:
#   selector:
#     backend: "true"
#   ports:
#     - name: http
#       protocol: TCP
#       port: 6000
# ---
# apiVersion: v1
# kind: Service
# metadata:
#   name: mirror-service
#   # namespace: consul-project-1
#   annotations:
#     "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
#   labels:
#     app: "project-1"
# spec:
#   selector:
#     mirror: "true"
#   ports:
#     - name: http
#       protocol: TCP
#       port: 6000
---
# kind: service-splitter
# name: server-check
# splits: 
#     - weight: 90
#       service_subset: "v1"
#     - weight: 10
#       service_subset: "v2"