---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: ephemeral-roles
  namespace: ephemeral-roles
  labels:
    app: ephemeral-roles
spec:
  replicas: 10
  selector:
    matchLabels:
      app: ephemeral-roles
  serviceName: ephemeral-roles
  template:
    metadata:
      labels:
        app: ephemeral-roles
    spec:
      terminationGracePeriodSeconds: 30
      containers:
        - name: ephemeral-roles
          image: ewohltman/ephemeral-roles:v1.8.1
          imagePullPolicy: Always
          env:
            - name: SHARD_COUNT
              value: "10"
            - name: LOG_LEVEL
              value: "info"
            - name: LOG_TIMEZONE_LOCATION
              value: "America/New_York"
            - name: JAEGER_SERVICE_NAME
              value: ephemeral-roles.ephemeral-roles
            - name: JAEGER_PROPAGATION
              value: jaeger,b3
            - name: INSTANCE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: BOT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: ephemeral-roles
                  key: bot-token
            - name: DISCORDRUS_WEBHOOK_URL
              valueFrom:
                secretKeyRef:
                  name: ephemeral-roles
                  key: discordrus-webhook-url
          ports:
            - name: http
              containerPort: 8081
          resources:
            limits:
              memory: "512Mi"
            requests:
              memory: "512Mi"
        - name: jaeger-agent
          image: jaegertracing/jaeger-agent:1.17.1
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 5775
              name: zk-compact-trft
              protocol: UDP
            - containerPort: 5778
              name: config-rest
              protocol: TCP
            - containerPort: 6831
              name: jg-compact-trft
              protocol: UDP
            - containerPort: 6832
              name: jg-binary-trft
              protocol: UDP
            - containerPort: 14271
              name: admin-http
              protocol: TCP
          resources:
            limits:
              cpu: "100m"
              memory: "256Mi"
            requests:
              cpu: "100m"
              memory: "256Mi"
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.hostIP
          args:
            - --reporter.grpc.host-port=dns:///jaeger-collector-headless.ephemeral-roles:14250
            - --reporter.type=grpc
