## Datakit-Operator v1.5.12 Configuration YAML
---
apiVersion: v1
kind: Service
metadata:
  name: datakit-operator
  namespace: datakit
spec:
  selector:
    app: datakit-operator
  ports:
    - name: http
      port: 443
      targetPort: 9543
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: datakit-operator-config
  namespace: datakit
data:
  jsonconfig: |-
    {
        "server_listen": "0.0.0.0:9543",
        "log_level":     "info",
        "admission_inject": {
            "ddtrace": {
                "enabled_namespaces":     [],
                "enabled_labelselectors": [],
                "images": {
                    "java_agent_image": "pubrepo.guance.com/datakit-operator/dd-lib-java-init:v1.36.2-guance"
                },
                "envs": {
                    "DD_AGENT_HOST":           "datakit-service.datakit.svc",
                    "DD_TRACE_AGENT_PORT":     "9529",
                    "DD_JMXFETCH_STATSD_HOST": "datakit-service.datakit.svc",
                    "DD_JMXFETCH_STATSD_PORT": "8125",
                    "DD_SERVICE":              "{fieldRef:metadata.labels['service']}",
                    "POD_NAME":                "{fieldRef:metadata.name}",
                    "POD_NAMESPACE":           "{fieldRef:metadata.namespace}",
                    "NODE_NAME":               "{fieldRef:spec.nodeName}",
                    "DD_TAGS":                 "pod_name:$(POD_NAME),pod_namespace:$(POD_NAMESPACE),host:$(NODE_NAME)"
                }
            },
            "logfwd": {
                "images": {
                    "logfwd_image": "pubrepo.guance.com/datakit/logfwd:1.26.0"
                },
                "envs": {
                    "LOGFWD_GLOBAL_SERVICE": "{fieldRef:metadata.labels['app']}",
                    "LOGFWD_POD_NAME":       "{fieldRef:metadata.name}",
                    "LOGFWD_POD_NAMESPACE":  "{fieldRef:metadata.namespace}"
                },
                "resources": {
                    "requests": {
                        "cpu":    "100m",
                        "memory": "64Mi"
                    },
                    "limits": {
                       "cpu":    "500m",
                       "memory": "512Mi"
                    }
                }
            },
            "profiler": {
                "images": {
                    "java_profiler_image":   "pubrepo.guance.com/datakit-operator/async-profiler:0.1.0",
                    "python_profiler_image": "pubrepo.guance.com/datakit-operator/py-spy:0.1.0",
                    "golang_profiler_image": "pubrepo.guance.com/datakit-operator/pprof:0.1.0"
                },
                "envs": {
                    "DK_AGENT_HOST":  "datakit-service.datakit.svc",
                    "DK_AGENT_PORT":  "9529",
                    "DK_PROFILE_VERSION": "1.2.333",
                    "DK_PROFILE_ENV": "prod",
                    "DK_PROFILE_DURATION": "240",
                    "DK_PROFILE_SCHEDULE": "0 * * * *"
                },
                "resources": {
                    "requests": {
                        "cpu":    "100m",
                        "memory": "64Mi"
                    },
                    "limits": {
                       "cpu":    "500m",
                       "memory": "512Mi"
                    }
                }
            }
        },
        "admission_mutate": {
            "logging": [
                {
                    "namespace_selectors": [],
                    "label_selectors":     [],
                    "config": ""
                }
            ]
        }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: datakit-operator
  namespace: datakit
  labels:
    app: datakit-operator
spec:
  replicas: 1  # Do not change the ReplicaSet number!
  selector:
     matchLabels:
       app: datakit-operator
  template:
    metadata:
      labels:
        app: datakit-operator
    spec:
      containers:
        - name: operator
          image: pubrepo.guance.com/datakit-operator/datakit-operator:v1.5.12
          imagePullPolicy: Always
          env:
          - name: ENV_JSON_CONFIG
            valueFrom:
              configMapKeyRef:
                name: datakit-operator-config
                key: jsonconfig
          ports:
            - name: http
              containerPort: 9543
          resources:
            requests:
              cpu: "100m"
              memory: "64Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: datakit-operator-mutation
webhooks:
  - name: "mutation.datakit.svc"
    rules:
      - operations: [ "CREATE", "UPDATE"]
        apiGroups: [ "" ]
        apiVersions: [ "v1" ]
        resources: [ "pods" ]
        scope: "Namespaced"
    clientConfig:
      service:
        namespace: datakit
        name: datakit-operator
        path: "/v1/webhooks/inject"
      caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURKakNDQWc2Z0F3SUJBZ0lVYjFPSkkzRTc3RzBoR1NveDJtZ3lYQUlLSEY0d0RRWUpLb1pJaH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