# This patch injects a secret into the container environment for the controller manager
# to enable New Relic agent to send events about the operator behavior itself.

---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: controller-manager
    namespace: system
  spec:
    selector:
      matchLabels:
        control-plane: controller-manager
    template:
      spec:
        containers:
        - name: manager
          env:
            - name: NEW_RELIC_LICENSE_KEY
              valueFrom:
                secretKeyRef:
                  name: nr-agent
                  key: license-key
                  optional: true
            - name: NEW_RELIC_APP_NAME
              valueFrom:
                configMapKeyRef:
                  name: nr-agent
                  key: app-name
                  optional: true
            - name: NEW_RELIC_HOST
              valueFrom:
                configMapKeyRef:
                  name: nr-agent
                  key: host
                  optional: true
            - name: NEW_RELIC_LOG
              value: stdout
            - name: NEW_RELIC_LOG_LEVEL
              valueFrom:
                configMapKeyRef:
                  name: nr-agent
                  key: log-level
                  optional: true
            - name: NEW_RELIC_DISTRIBUTED_TRACING_ENABLED
              value: "true"
          