apiVersion: apps/v1
kind: Deployment
metadata:
  name: clickhouse
spec:
  replicas: 1
  selector:
    matchLabels:
      app: clickhouse
  template:
    metadata:
      labels:
        app: clickhouse
    spec:
      containers:
        - name: clickhouse
          image: clickhouse/clickhouse-server:22.6-alpine
          # You may expose ports if needed (for example, HTTP on 8123)
          ports:
            - containerPort: 8123
          volumeMounts:
            - name: event-data
              mountPath: /var/lib/clickhouse
            - name: clickhouse-config
              mountPath: /etc/clickhouse-server/config.d/logging.xml
              subPath: clickhouse-config.xml
              readOnly: true
            - name: clickhouse-user-config
              mountPath: /etc/clickhouse-server/users.d/logging.xml
              subPath: clickhouse-user-config.xml
              readOnly: true
      volumes:
        - name: event-data
          persistentVolumeClaim:
            claimName: event-data-pvc
        - name: clickhouse-config
          configMap:
            name: clickhouse-config
        - name: clickhouse-user-config
          configMap:
            name: clickhouse-user-config
