---
# Source: opentelemetry-collector/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: example-opentelemetry-collector
  namespace: default
  labels:
    helm.sh/chart: opentelemetry-collector-0.93.3
    app.kubernetes.io/name: opentelemetry-collector
    app.kubernetes.io/instance: example
    app.kubernetes.io/version: "0.102.1"
    app.kubernetes.io/managed-by: Helm
    
spec:
  serviceName: example-opentelemetry-collector
  podManagementPolicy: Parallel
  replicas: 2
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Delete
    whenScaled: Delete
  selector:
    matchLabels:
      app.kubernetes.io/name: opentelemetry-collector
      app.kubernetes.io/instance: example
      component: statefulset-collector
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/config: 310972ba57a3758b59997a37bafab01b0b79be94be3164eaf90f5d96a9fd8c2a
        
      labels:
        app.kubernetes.io/name: opentelemetry-collector
        app.kubernetes.io/instance: example
        component: statefulset-collector
        
    spec:
      
      serviceAccountName: example-opentelemetry-collector
      securityContext:
        {}
      containers:
        - name: opentelemetry-collector
          command:
            - /otelcol-k8s
          args:
            - --config=/conf/relay.yaml
          securityContext:
            {}
          image: "otel/opentelemetry-collector-k8s:0.102.1"
          imagePullPolicy: IfNotPresent
          ports:
            
            - name: jaeger-compact
              containerPort: 6831
              protocol: UDP
            - name: jaeger-grpc
              containerPort: 14250
              protocol: TCP
            - name: jaeger-thrift
              containerPort: 14268
              protocol: TCP
            - name: otlp
              containerPort: 4317
              protocol: TCP
            - name: otlp-http
              containerPort: 4318
              protocol: TCP
            - name: zipkin
              containerPort: 9411
              protocol: TCP
          env:
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
            - name: GOMEMLIMIT
              value: "152MiB"
          livenessProbe:
            httpGet:
              path: /
              port: 13133
          readinessProbe:
            httpGet:
              path: /
              port: 13133
          resources:
            limits:
              cpu: 100m
              memory: 200M
          volumeMounts:
            - mountPath: /conf
              name: opentelemetry-collector-configmap
            - mountPath: /var/lib/storage/queue
              name: queue
      initContainers:
        - command:
          - sh
          - -c
          - 'chown -R 10001: /var/lib/storage/queue'
          image: busybox:latest
          name: init-fs
          volumeMounts:
          - mountPath: /var/lib/storage/queue
            name: queue
      volumes:
        - name: opentelemetry-collector-configmap
          configMap:
            name: example-opentelemetry-collector-statefulset
            items:
              - key: relay
                path: relay.yaml
      hostNetwork: false
  volumeClaimTemplates:
  - metadata:
      name: queue
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: standard
