Skip to content

Commit 97d6899

Browse files
authored
Merge branch 'main' into google-oauth
2 parents 2a37c50 + 9165467 commit 97d6899

File tree

146 files changed

+15223
-2900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+15223
-2900
lines changed

.claude/settings.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@
1212
"Bash(pre-commit install:*)",
1313
"Bash(pre-commit autoupdate:*)",
1414
"Bash(helm-docs:*)",
15-
"Bash(codespell:*)"
15+
"Bash(codespell:*)",
16+
"Bash(task operator-install-crds)",
17+
"Bash(task operator-uninstall-crds)",
18+
"Bash(task operator-deploy-latest)",
19+
"Bash(task operator-deploy-local)",
20+
"Bash(task operator-undeploy)",
21+
"Bash(task operator-generate)",
22+
"Bash(task operator-manifests)",
23+
"Bash(task operator-test)",
24+
"Bash(task operator-e2e-test)",
25+
"Bash(task crdref-install)",
26+
"Bash(task crdref-gen)"
1627
],
1728
"deny": []
1829
}

.github/workflows/issue-triage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
- Be specific but comprehensive
8080
- Consider platform labels (kubernetes) if applicable
8181
- If you find similar issues using mcp__github__search_issues, consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue.
82+
- DO NOT add labels that pertain to priority, such as p0, p1, p2, etc.
8283
8384
5. Apply the selected labels:
8485
- Use mcp__github__update_issue to apply your selected labels

.github/workflows/test.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,28 @@ jobs:
1919
go-version-file: 'go.mod'
2020
cache: true
2121

22+
- name: Set up gotestfmt
23+
uses: gotesttools/gotestfmt-action@v2
24+
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
25+
# with:
26+
# token: ${{ secrets.GITHUB_TOKEN }}
27+
2228
- name: Install Task
2329
uses: arduino/setup-task@v2
2430
with:
2531
version: 3.x
2632
repo-token: ${{ secrets.GITHUB_TOKEN }}
2733

28-
- name: Run tests
29-
run: task test
34+
- name: Run tests with coverage
35+
run: task test-coverage
36+
37+
- name: Upload coverage reports to Codecov with GitHub Action
38+
uses: codecov/codecov-action@v5
39+
with:
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
slug: stacklok/toolhive
42+
43+
- name: Upload coverage to Coveralls
44+
uses: coverallsapp/github-action@v2
45+
with:
46+
file: coverage/coverage.out

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
</p>
1313

1414
[![Release][release-img]][release] [![Build status][ci-img]][ci]
15+
[![Coverage Status][coveralls-img]][coveralls]
1516
[![License: Apache 2.0][license-img]][license]
1617
[![Star on GitHub][stars-img]][stars] [![Discord][discord-img]][discord]
1718

@@ -104,6 +105,8 @@ This project is licensed under the [Apache 2.0 License](./LICENSE).
104105
[release]: https://github.com/stacklok/toolhive/releases/latest
105106
[ci-img]: https://img.shields.io/github/actions/workflow/status/stacklok/toolhive/run-on-main.yml?style=flat&logo=github&label=Build
106107
[ci]: https://github.com/stacklok/toolhive/actions/workflows/run-on-main.yml
108+
[coveralls-img]: https://coveralls.io/repos/github/stacklok/toolhive/badge.svg?branch=main
109+
[coveralls]: https://coveralls.io/github/stacklok/toolhive?branch=main
107110
[license-img]: https://img.shields.io/badge/License-Apache2.0-blue.svg?style=flat
108111
[license]: https://opensource.org/licenses/Apache-2.0
109112
[stars-img]: https://img.shields.io/github/stars/stacklok/toolhive.svg?style=flat&logo=github&label=Stars

Taskfile.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ tasks:
4646
platforms: [linux, darwin]
4747
internal: true
4848
cmds:
49-
- go test -v -race $(go list ./... | grep -v '/test/e2e')
49+
- go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
50+
# we have to use ldflags to avoid the LC_DYSYMTAB linker error.
51+
# https://github.com/stacklok/toolhive/issues/1687
52+
- go test -ldflags=-extldflags=-Wl,-w -v -json -race $(go list ./... | grep -v '/test/e2e') | gotestfmt
5053

5154
test-windows:
5255
desc: Run unit tests (excluding e2e tests) on Windows with race detection
@@ -74,7 +77,10 @@ tasks:
7477
cmds:
7578
- cmd: mkdir -p coverage
7679
platforms: [linux, darwin]
77-
- go test -race -coverprofile=coverage/coverage.out $(go list ./... | grep -v '/test/e2e')
80+
- go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
81+
# we have to use ldflags to avoid the LC_DYSYMTAB linker error.
82+
# https://github.com/stacklok/toolhive/issues/1687
83+
- go test -ldflags=-extldflags=-Wl,-w -json -race -coverprofile=coverage/coverage.out $(go list ./... | grep -v '/test/e2e') | gotestfmt
7884
- go tool cover -func=coverage/coverage.out
7985
- echo "Generating HTML coverage report in coverage/coverage.html"
8086
- go tool cover -html=coverage/coverage.out -o coverage/coverage.html

cmd/thv-operator/CLAUDE.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
- CRDs are in cmd/thv-operator/api/v1alpha1/mcpserver_types.go
2-
- After modifying the CRDs, the following changes need to be done:
3-
- `task operator-generate`, `task operator-manifests` and `task crdref-gen`.
4-
- it is important to run `task crdref-gen` inside cmd/thv-operator as the current directory
5-
- When committing a change that changes CRDs, it is important to bump the chart version in deploy/charts/operator-crds/Chart.yaml and deploy/charts/operator-crds/README.md
1+
# Claude.md
2+
3+
This document will explain all necessary information for Claude to understand the ToolHive Operator.
4+
5+
## CustomResourceDefinitions
6+
7+
The CRD's are in `cmd/thv-operator/api/v1alpha1/`
8+
9+
After modifying the CRDs, the following needs to be run:
10+
- `task operator-generate`
11+
- `task operator-manifests`
12+
- `task crdref-gen` (it is important to run this command inside `cmd/thv-operator` as the current directory)
13+
14+
When committing a change that changes CRDs, it is important to bump the chart version as described in the [CLAUDE.md](../../deploy/charts/operator-crds/CLAUDE.md#bumping-crd-chart) doc for the CRD Helm Chart.
15+
16+
## OpenTelemetry (OTEL) Stack for Testing
17+
18+
When you have been asked to stand up an OTEL stack to test ToolHives integration inside of Kubernetes, you will need to perform the following tasks inside of the cluster that you have been instructed to use.
19+
20+
- Install the [`kube-prometheus-stack`](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) using Helm
21+
- Install the [OTEL Collector](https://opentelemetry.io/docs/platforms/kubernetes/helm/collector/) using Helm
622

723
## Keycloak Development Setup
824

cmd/thv-operator/api/v1alpha1/mcpserver_types.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ type MCPServerSpec struct {
7979
// ToolsFilter is the filter on tools applied to the MCP server
8080
// +optional
8181
ToolsFilter []string `json:"tools,omitempty"`
82+
83+
// Telemetry defines observability configuration for the MCP server
84+
// +optional
85+
Telemetry *TelemetryConfig `json:"telemetry,omitempty"`
8286
}
8387

8488
// ResourceOverrides defines overrides for annotations and labels on created resources
@@ -436,6 +440,64 @@ type InlineAuthzConfig struct {
436440
EntitiesJSON string `json:"entitiesJson,omitempty"`
437441
}
438442

443+
// TelemetryConfig defines observability configuration for the MCP server
444+
type TelemetryConfig struct {
445+
// OpenTelemetry defines OpenTelemetry configuration
446+
// +optional
447+
OpenTelemetry *OpenTelemetryConfig `json:"openTelemetry,omitempty"`
448+
449+
// Prometheus defines Prometheus-specific configuration
450+
// +optional
451+
Prometheus *PrometheusConfig `json:"prometheus,omitempty"`
452+
}
453+
454+
// OpenTelemetryConfig defines pure OpenTelemetry configuration
455+
type OpenTelemetryConfig struct {
456+
// Enabled controls whether OpenTelemetry is enabled
457+
// +kubebuilder:default=false
458+
// +optional
459+
Enabled bool `json:"enabled,omitempty"`
460+
461+
// Endpoint is the OTLP endpoint URL for tracing and metrics
462+
// +optional
463+
Endpoint string `json:"endpoint,omitempty"`
464+
465+
// ServiceName is the service name for telemetry
466+
// If not specified, defaults to the MCPServer name
467+
// +optional
468+
ServiceName string `json:"serviceName,omitempty"`
469+
470+
// Headers contains authentication headers for the OTLP endpoint
471+
// Specified as key=value pairs
472+
// +optional
473+
Headers []string `json:"headers,omitempty"`
474+
475+
// Insecure indicates whether to use HTTP instead of HTTPS for the OTLP endpoint
476+
// +kubebuilder:default=false
477+
// +optional
478+
Insecure bool `json:"insecure,omitempty"`
479+
480+
// Metrics defines OpenTelemetry metrics-specific configuration
481+
// +optional
482+
Metrics *OpenTelemetryMetricsConfig `json:"metrics,omitempty"`
483+
}
484+
485+
// PrometheusConfig defines Prometheus-specific configuration
486+
type PrometheusConfig struct {
487+
// Enabled controls whether Prometheus metrics endpoint is exposed
488+
// +kubebuilder:default=false
489+
// +optional
490+
Enabled bool `json:"enabled,omitempty"`
491+
}
492+
493+
// OpenTelemetryMetricsConfig defines OpenTelemetry metrics configuration
494+
type OpenTelemetryMetricsConfig struct {
495+
// Enabled controls whether OTLP metrics are sent
496+
// +kubebuilder:default=true
497+
// +optional
498+
Enabled bool `json:"enabled,omitempty"`
499+
}
500+
439501
// MCPServerStatus defines the observed state of MCPServer
440502
type MCPServerStatus struct {
441503
// Conditions represent the latest available observations of the MCPServer's state

cmd/thv-operator/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)