Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ The application respects these environment variables:

- `KUBECONFIG` - Kubernetes configuration file path
- `PROMETHEUS_URL` - Prometheus server URL
- `GRAFANA_URL` - Grafana server URL
- `GRAFANA_API_KEY` - Grafana API authentication key
- `LOG_LEVEL` - Logging level (debug, info, warn, error); unset or invalid values fall back to info

### Configuration Files
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ Tools respect existing authentication and configuration:
- Kubernetes tools use the default kubeconfig or `KUBECONFIG` environment variable
- Helm tools use Helm's default configuration
- Prometheus tools accept custom Prometheus server URLs
- Grafana tools support API key and basic authentication

### Command Execution
The tools use a common `runCommand` function that:
Expand Down Expand Up @@ -263,8 +262,6 @@ This Go implementation provides feature parity with the original Python tools wh
Tools can be configured through environment variables:
- `KUBECONFIG`: Kubernetes configuration file path
- `PROMETHEUS_URL`: Default Prometheus server URL
- `GRAFANA_URL`: Default Grafana server URL
- `GRAFANA_API_KEY`: Default Grafana API key

## Observability

Expand Down
21 changes: 4 additions & 17 deletions helm/kagent-tools/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,24 @@ spec:
resources:
{{- toYaml .Values.tools.resources | nindent 12 }}
env:
- name: KAGENT_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: {{ include "kagent-tools.fullname" . }}-openai
key: OPENAI_API_KEY
optional: true
- name: OTEL_TRACING_ENABLED
value: {{ .Values.otel.tracing.enabled | quote }}
- name: OTEL_SDK_DISABLED
value: {{ not .Values.otel.tracing.enabled | quote }}
{{- if .Values.otel.tracing.enabled }}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{ .Values.otel.tracing.exporter.otlp.endpoint | quote }}
- name: OTEL_EXPORTER_OTLP_TRACES_TIMEOUT
value: {{ .Values.otel.tracing.exporter.otlp.timeout | quote }}
- name: OTEL_EXPORTER_OTLP_TRACES_INSECURE
value: {{ .Values.otel.tracing.exporter.otlp.insecure | quote }}
{{- end }}
- name: TOKEN_PASSTHROUGH
value: {{ (index .Values.tools "k8s" | default dict).tokenPassthrough | default false | quote }}
- name: PROMETHEUS_URL
value: {{ .Values.tools.prometheus.url | quote }}
- name: PROMETHEUS_USERNAME
value: {{ .Values.tools.prometheus.username | quote }}
- name: PROMETHEUS_PASSWORD
value: {{ .Values.tools.prometheus.password | quote }}
- name: GRAFANA_URL
value: {{ .Values.tools.grafana.url | quote }}
- name: GRAFANA_API_KEY
value: {{ .Values.tools.grafana.apiKey | quote }}
{{- with .Values.tools.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
55 changes: 55 additions & 0 deletions helm/kagent-tools/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,58 @@ tests:
value:
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/instance: RELEASE-NAME

- it: should disable the OpenTelemetry SDK when tracing is off
template: deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: OTEL_SDK_DISABLED
value: "true"
- notContains:
path: spec.template.spec.containers[0].env
content:
name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://host.docker.internal:4317
any: true

- it: should export traces to the configured endpoint when tracing is on
template: deployment.yaml
set:
otel:
tracing:
enabled: true
exporter:
otlp:
endpoint: http://otel-collector.observability:4317
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: OTEL_SDK_DISABLED
value: "false"
- contains:
path: spec.template.spec.containers[0].env
content:
name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://otel-collector.observability:4317

- it: should only set env vars the server reads
template: deployment.yaml
asserts:
- notContains:
path: spec.template.spec.containers[0].env
content:
name: OTEL_TRACING_ENABLED
any: true
- notContains:
path: spec.template.spec.containers[0].env
content:
name: PROMETHEUS_PASSWORD
any: true
- notContains:
path: spec.template.spec.containers[0].env
content:
name: GRAFANA_API_KEY
any: true
7 changes: 1 addition & 6 deletions helm/kagent-tools/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ tools:
tokenPassthrough: false
prometheus:
url: "prometheus.kagent.svc.cluster.local:9090"
username: ""
password: ""
grafana: # kubectl port-forward svc/grafana 3000:3000
url: "http://grafana.kagent.svc.cluster.local:3000"
apiKey: ""

service:
type: ClusterIP
Expand Down Expand Up @@ -142,9 +137,9 @@ rbac:

otel:
tracing:
# When false, OTEL_SDK_DISABLED=true is set and no spans are exported or printed.
enabled: false
exporter:
otlp:
endpoint: http://host.docker.internal:4317
timeout: 15
insecure: true
Loading