Warning
This Repository code was migrated to platform-mesh/platform-mesh.
Warning
This repository is under development and not ready for productive use. It is in an alpha stage. APIs and concepts may change on short notice, including breaking changes.
The platform-mesh search-service provides a REST API to query resources indexed in OpenSearch and post-filter results through OpenFGA authorization checks.
The service is organization-aware and derives org context from the request host. It resolves the active SearchIndex in KCP (root:orgs) and uses status.indexName as source of truth for the OpenSearch index.
- REST endpoints:
GET /rest/v1/searchGET /rest/v1/search/resourcesGET /rest/v1/search/filter-values
- Free-text search in OpenSearch with stable cursor pagination (
search_after) - OpenFGA post-filtering (
relation=get) with fail-closed behavior for incomplete auth context - Org-aware context + KCP token/org access pre-check
- SearchIndex-driven resource/field metadata:
defaultFieldsdrive searchable fieldsfilterableFieldsdrive exact-match filterssemanticFieldsare exposed as metadata (no semantic query mode yet)
- Health endpoints:
/healthz,/readyz
GET /rest/v1/search?q=<query>&limit=<n>&cursor=<opaque>&resource=<plural>&filter.<field>=<value>
Query params:
q(required): free-text queryresource(optional): plural resource name; if omitted, searches across all resourcesfilter.<field>(optional, repeatable): exact-match filters; requiresresourcelimit(optional): default20, max100cursor(optional): opaque pagination cursor
Response shape:
results[]with compact fields (id,score,kind,name,namespace,apiGroup,apiVersion,workspacePath,clusterName,organizationId,organizationName,accountId,accountName)results[].resourceindicates which resource index produced the hitsourcecontaining the raw indexed document source per hitnextCursorfor pagination
GET /rest/v1/search/resources
Returns all searchable resources for the org with:
resourcedefaultFieldsfilterableFieldssemanticFields
GET /rest/v1/search/filter-values?resource=<plural>&field=<filterable>&q=<optional>&filter.<field>=<value>
Returns distinct authorized values for one filterable field within a single resource.
- Go
1.25+(see go.mod) - Access to:
- KCP API (for org access check + SearchIndex resolution)
- OpenSearch
- OpenFGA gRPC endpoint
Example:
export OPENSEARCH_USERNAME=<username>
export OPENSEARCH_PASSWORD=<password>
go run . serve \
--kubeconfig ~/.kube/config \
--is-local=true \
--opensearch-url http://localhost:9200 \
--openfga-grpc-addr localhost:8081Use --is-local=true for local development to match the local behavior of kubernetes-graphql-gateway.
When enabled:
- org context is still derived from host (
localhostis mapped to--local-development-org) - JWT claims are still parsed for user/tenant context
- KCP org token validation (
ValidateTokenForOrg) is bypassed
This is intended for local/dev usage only. Keep --is-local=false for production-like environments.
Main runtime flags (with defaults):
--port(default:8080)--opensearch-url(default:http://opensearch.platform-mesh-system.svc.cluster.local:9200)--opensearch-username(default: value of envOPENSEARCH_USERNAME)--opensearch-password(default: value of envOPENSEARCH_PASSWORD)--opensearch-insecure(default:false)--opensearch-timeout(default:10s)--openfga-grpc-addr(default:openfga:8081)--searchindex-workspace-path(default:root:orgs)--searchindex-group(default:core.platform-mesh.io)--searchindex-version(default:v1alpha1)--searchindex-resource(default:searchindexes)--search-default-limit(default:20)--search-max-limit(default:100)--search-fetch-batch-size(default:100)--search-max-scanned-hits(default:1000)--is-local(default:false) enables local development behavior in auth middleware--local-development-org(default: envSEARCH_LOCAL_ORG, fallbacklocal) org used when host islocalhost
Global flags from golang-commons are also available (e.g. logging and kubeconfig related flags).
go test ./...- JWT signature validation is expected to happen upstream (gateway/mesh).
- The service consumes parsed claims from context (
mail, fallbacksub). - Search hits missing required authorization hierarchy fields are dropped (fail-closed).
Releases are performed via GitHub Actions workflows.
Contributions are welcome via pull requests in the Platform Mesh GitHub organization.
Please refer to our Code of Conduct for expected conduct when contributing.
