apiVersion: apps/v1
kind: Deployment
metadata:
  name: cluster-logging-operator-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      registry.operator.cluster-logging: "true"
  template:
    metadata:
      annotations:
        target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      labels:
        registry.operator.cluster-logging: "true"
      name: cluster-logging-operator-registry
    spec:
      securityContext:
        runAsNonRoot: true
      initContainers:
      - name: mutate-csv-and-generate-sqlite-db
        image: ${IMAGE_CLUSTER_LOGGING_OPERATOR_REGISTRY}
        imagePullPolicy: Always
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
              - ALL
        command:
        - sh
        args:
        - /scripts/registry-init.sh
        volumeMounts:
        - name: workdir
          mountPath: /bundle
        env:
        - name: IMAGE_CLUSTER_LOGGING_OPERATOR
          value: ${IMAGE_CLUSTER_LOGGING_OPERATOR}
        - name: IMAGE_LOGGING_CURATOR5
          value: ${IMAGE_LOGGING_CURATOR5}
        - name: IMAGE_LOGGING_FLUENTD
          value: ${IMAGE_LOGGING_FLUENTD}
        - name: IMAGE_LOGGING_VECTOR
          value: ${IMAGE_LOGGING_VECTOR}
        - name: IMAGE_LOG_FILE_METRIC_EXPORTER
          value: ${IMAGE_LOG_FILE_METRIC_EXPORTER}
        - name: RELATED_IMAGE_LOGGING_CONSOLE_PLUGIN
          value: quay.io/openshift-logging/logging-view-plugin:latest

      containers:
      - name: cluster-logging-operator-registry
        image: ${IMAGE_CLUSTER_LOGGING_OPERATOR_REGISTRY}
        imagePullPolicy: Always
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
              - ALL
        command:
        - /usr/bin/registry-server
        - --database=/bundle/bundles.db
        volumeMounts:
        - name: workdir
          mountPath: /bundle
        ports:
        - containerPort: 50051
          name: grpc
          protocol: TCP
        livenessProbe:
          exec:
            command:
            - grpc_health_probe
            - -addr=localhost:50051
        readinessProbe:
          exec:
            command:
            - grpc_health_probe
            - -addr=localhost:50051
        resources:
          requests:
            cpu: 10m
            memory: 100Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      volumes:
      - name: workdir
        emptyDir: {}
