========================================
LJWX Health 数据平台部署成功！
========================================

版本: {{ .Chart.Version }}
命名空间: {{ .Values.global.namespace }}

📦 已部署组件:

{{- if .Values.redpanda.enabled }}
✅ Redpanda (Kafka)
   - 副本数: {{ .Values.redpanda.replicaCount }}
   - Service: redpanda.{{ .Values.global.namespace }}.svc.cluster.local:9092
{{- end }}

{{- if .Values.clickhouse.enabled }}
✅ ClickHouse
   - 副本数: {{ .Values.clickhouse.replicaCount }}
   - HTTP端口: {{ .Values.clickhouse.service.http.port }}
   - Native端口: {{ .Values.clickhouse.service.native.port }}
   - Service: clickhouse.{{ .Values.global.namespace }}.svc.cluster.local
{{- end }}

{{- if .Values.consumers.writer.enabled }}
✅ Writer Consumer
   - 副本数: {{ .Values.consumers.writer.replicaCount }}
{{- end }}

{{- if .Values.consumers.alert.enabled }}
✅ Alert Consumer
   - 副本数: {{ .Values.consumers.alert.replicaCount }}
{{- end }}

{{- if .Values.consumers.aggregator.enabled }}
✅ Aggregator CronJob
   - 调度: {{ .Values.consumers.aggregator.schedule }}
{{- end }}

========================================
🔍 快速验证
========================================

1. 查看所有 Pods:
   kubectl get pods -n {{ .Values.global.namespace }}

2. 查看服务状态:
   kubectl get svc -n {{ .Values.global.namespace }}

{{- if .Values.redpanda.enabled }}

3. 测试 Redpanda (Kafka):
   # 端口转发
   kubectl port-forward -n {{ .Values.global.namespace }} svc/redpanda 9092:9092

   # 列出 Topics
   kubectl exec -it redpanda-0 -n {{ .Values.global.namespace }} -- \
     rpk topic list
{{- end }}

{{- if .Values.clickhouse.enabled }}

4. 测试 ClickHouse:
   # 端口转发
   kubectl port-forward -n {{ .Values.global.namespace }} svc/clickhouse {{ .Values.clickhouse.service.http.port }}:{{ .Values.clickhouse.service.http.port }}

   # 连接 ClickHouse
   kubectl exec -it clickhouse-0 -n {{ .Values.global.namespace }} -- \
     clickhouse-client -u admin --password [密码]

   # 查询示例
   SHOW TABLES FROM {{ .Values.clickhouse.config.database }};
   SELECT count(*) FROM {{ .Values.clickhouse.config.database }}.t_health_raw;
{{- end }}

========================================
📊 数据表结构
========================================

ClickHouse 数据库: {{ .Values.clickhouse.config.database }}

表:
  - t_health_raw      明细表 (180天TTL)
  - t_health_1min     1分钟聚合 (180天TTL)
  - t_health_5min     5分钟聚合 (365天TTL)
  - t_alert_events    告警事件 (365天TTL)

视图:
  - v_heart_rate_alerts      最近24小时心率告警
  - v_user_health_summary    用户健康概览(最近1小时)

========================================
📈 监控和日志
========================================

查看日志:
  # Redpanda
  kubectl logs -n {{ .Values.global.namespace }} -l app=redpanda -f

  # ClickHouse
  kubectl logs -n {{ .Values.global.namespace }} -l app=clickhouse -f

  # Writer Consumer
  kubectl logs -n {{ .Values.global.namespace }} -l app=health-writer-consumer -f

  # Alert Consumer
  kubectl logs -n {{ .Values.global.namespace }} -l app=health-alert-consumer -f

========================================
🛠️ 管理命令
========================================

升级部署:
  helm upgrade {{ .Release.Name }} . -f values-mac.yaml -n {{ .Values.global.namespace }}

卸载:
  helm uninstall {{ .Release.Name }} -n {{ .Values.global.namespace }}

查看状态:
  helm status {{ .Release.Name }} -n {{ .Values.global.namespace }}

========================================
📚 文档
========================================

详细文档: docs/02-architecture/data-platform-mvp.md
K8s部署: docs/03-deployment/kubernetes/data-platform-k8s-deployment.md

========================================

祝您使用愉快！🎉
