Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

To learn more about the release, try:

  $ helm status {{ .Release.Name }} -n {{ include "mca-collector.namespace" . }}
  $ helm get all {{ .Release.Name }} -n {{ include "mca-collector.namespace" . }}

==================================================
MCA OpenTelemetry Collector Deployment
==================================================

1. Get the Collector service endpoints:

{{- if .Values.externalService.enabled }}
{{- if eq .Values.externalService.type "NodePort" }}

   export NODE_PORT_HTTP=$(kubectl get service {{ include "mca-collector.fullname" . }}-external -n {{ include "mca-collector.namespace" . }} -o jsonpath='{.spec.ports[?(@.name=="otlp-http")].nodePort}')
   export NODE_PORT_GRPC=$(kubectl get service {{ include "mca-collector.fullname" . }}-external -n {{ include "mca-collector.namespace" . }} -o jsonpath='{.spec.ports[?(@.name=="otlp-grpc")].nodePort}')
   export NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}')

   OTLP HTTP endpoint: http://$NODE_IP:$NODE_PORT_HTTP
   OTLP gRPC endpoint: $NODE_IP:$NODE_PORT_GRPC

{{- else if eq .Values.externalService.type "LoadBalancer" }}

   NOTE: It may take a few minutes for the LoadBalancer IP to be available.

   export SERVICE_IP=$(kubectl get service {{ include "mca-collector.fullname" . }}-external -n {{ include "mca-collector.namespace" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

   OTLP HTTP endpoint: http://$SERVICE_IP:{{ .Values.externalService.ports.otlpHttp }}
   OTLP gRPC endpoint: $SERVICE_IP:{{ .Values.externalService.ports.otlpGrpc }}

{{- end }}
{{- else }}

   Using ClusterIP service (internal only):

   OTLP HTTP endpoint: http://{{ include "mca-collector.fullname" . }}.{{ include "mca-collector.namespace" . }}.svc.cluster.local:{{ .Values.service.ports.otlpHttp }}
   OTLP gRPC endpoint: {{ include "mca-collector.fullname" . }}.{{ include "mca-collector.namespace" . }}.svc.cluster.local:{{ .Values.service.ports.otlpGrpc }}

{{- end }}

2. Configure your MCA SDK to use the collector:

   from mca_sdk import MCAClient

   client = MCAClient(
       service_name="your-model-name",
       model_id="mdl-001",
       team_name="your-team",
       otel_endpoint="<OTLP_HTTP_ENDPOINT>",  # Use endpoint from step 1
       otel_protocol="http"
   )

3. Verify the collector is running:

   kubectl get pods -n {{ include "mca-collector.namespace" . }} -l app.kubernetes.io/name={{ include "mca-collector.name" . }}

4. Check collector logs:

   kubectl logs -n {{ include "mca-collector.namespace" . }} -l app.kubernetes.io/name={{ include "mca-collector.name" . }} --tail=100

5. Check collector health:

   kubectl port-forward -n {{ include "mca-collector.namespace" . }} svc/{{ include "mca-collector.fullname" . }} {{ .Values.service.ports.health }}:{{ .Values.service.ports.health }}
   curl http://localhost:{{ .Values.service.ports.health }}/

6. Check collector metrics:

   kubectl port-forward -n {{ include "mca-collector.namespace" . }} svc/{{ include "mca-collector.fullname" . }} {{ .Values.service.ports.metrics }}:{{ .Values.service.ports.metrics }}
   curl http://localhost:{{ .Values.service.ports.metrics }}/metrics

==================================================
Configuration
==================================================

Current configuration:
- Environment: {{ .Values.config.processors.attributes.actions | toJson | regexFind "\"value\":\\s*\"([^\"]+)\"" }}
- Replicas: {{ .Values.replicaCount }}
{{- if .Values.hpa.enabled }}
- HPA: Enabled ({{ .Values.hpa.minReplicas }}-{{ .Values.hpa.maxReplicas }} replicas)

⚠️  HPA is enabled with StatefulSet target. Note:
- gRPC connections may not rebalance during scaling
- Use terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} for graceful shutdown
- Monitor connection distribution: kubectl top pods -n {{ include "mca-collector.namespace" . }}
{{- else }}
- HPA: Disabled
{{- end }}
{{- if .Values.pdb.enabled }}
- PDB: Enabled (minAvailable: {{ .Values.pdb.minAvailable }})
{{- else }}
- PDB: Disabled
{{- end }}
- Persistence: {{ .Values.persistence.size }}
{{- if .Values.networkPolicy.enabled }}
- NetworkPolicy: Enabled
{{- else }}
- NetworkPolicy: Disabled
{{- end }}

For more information, see the chart README:
  https://github.com/bhsf/mca-sdk/tree/main/mca-prototype/helm/mca-collector

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