projectsyn / lieutenant-api

The Project Syn Kubernetes Cluster and Tenants Inventory API
https://docs.syn.tools/lieutenant-api/
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Filtering clusters by tenant does not work #95

Closed mhutter closed 2 years ago

mhutter commented 3 years ago

According to the documentation, clusters can be filtered by tenant ID. This does not work.

Steps to Reproduce the Problem

curl -sS -H "$LIEUTENANT_AUTH" "https://${LIEUTENANT_URL}/clusters?tenant=t-xxx" | jq '.[].displayName'

Actual Behavior

Expected Behavior

Workaround

curl -sS -H "$LIEUTENANT_AUTH" "https://${LIEUTENANT_URL}/clusters" | jq '.[] | select(.tenant == "t-xxx") | .displayName'
srueg commented 3 years ago

You're absolutely right, this has never been implemented. The full list of clusters is always returned: https://github.com/projectsyn/lieutenant-api/blob/master/pkg/service/cluster.go#L30

It should be easy enough to extend this call to use a label selector if for a certain tenant should be filtered: syn.tools/tenant=$TENANT_ID