---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: service-distributor
  namespace: keptn
  labels:
    app.kubernetes.io/name: distributor
    app.kubernetes.io/instance: keptn
    app.kubernetes.io/part-of: keptn-keptn
    app.kubernetes.io/component: control-plane
    app.kubernetes.io/version: develop
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: distributor
      app.kubernetes.io/instance: keptn
  replicas: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: distributor
        app.kubernetes.io/instance: keptn
        app.kubernetes.io/part-of: keptn-keptn
        app.kubernetes.io/component: control-plane
        app.kubernetes.io/version: develop
    spec:
      serviceAccountName: keptn-default
      containers:
      - name: distributor
        image: keptn/distributor:latest
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "256Mi"
            cpu: "500m"
          limits:
            memory: "256Mi"
            cpu: "500m"
        env:
        - name: PUBSUB_URL
          value: 'nats://keptn-nats-cluster'
        - name: PUBSUB_TOPIC
          value: 'sh.keptn.event.get-action.triggered'
        - name: PUBSUB_RECIPIENT
          value: '127.0.0.1'
        - name: VERSION
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['app.kubernetes.io/version']
        - name: LOCATION
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['app.kubernetes.io/component']
        - name: K8S_DEPLOYMENT_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['app.kubernetes.io/name']
        - name: K8S_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: K8S_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: K8S_NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
