apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
  name: signoz-clickhouse
  namespace: signoz
spec:
  templates:
    podTemplates:
    - name: clickhouse
      spec:
        initContainers:
        - name: signoz-clickhouse-udf-init
          command:
          - /bin/sh
          - -c
          - |
            set -e
            # Copy histogram-quantile from local storage instead of downloading
            mkdir -p /var/lib/clickhouse/user_scripts
            cp /mnt/histogram/histogram-quantile /var/lib/clickhouse/user_scripts/histogramQuantile
            chmod +x /var/lib/clickhouse/user_scripts/histogramQuantile
            echo "histogram-quantile installed successfully from local copy"
          volumeMounts:
          - name: histogram-volume
            mountPath: /mnt/histogram
        volumes:
        - name: histogram-volume
          hostPath:
            path: /kube/storage
            type: Directory