Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When search for resources in a specified cluster, the response of two url query way is different. #635

Open
KubeKyrie opened this issue Dec 29, 2023 · 3 comments
Labels
kind/bug Something isn't working

Comments

@KubeKyrie
Copy link
Contributor

What happened?

When search for resources in a specified cluster, the response of two url query way is different.
In this case, actually cluster-1 not exists.
In the 2nd way, we may mistakenly assume that deployment does not exist in cluster-1, rather than cluster-1
So I think the 2nd way should also be Error from server (BadRequest): the server could not find the requested cluster

[root@qin-dev ~]# kubectl get --raw="/apis/clusterpedia.io/v1beta1/resources/clusters/cluster-1/apis/apps/v1/deployments"
Error from server (BadRequest): the server could not find the requested cluster
[root@qin-dev ~]#
[root@qin-dev ~]# kubectl get --raw="/apis/clusterpedia.io/v1beta1/resources/apis/apps/v1/deployments?clusters=cluster-1"
{"kind":"DeploymentList","apiVersion":"apps/v1","metadata":{},"items":[]}
[root@qin-dev ~]#
[root@qin-dev ~]# kubectl get pediacluster
NAME              READY   VERSION   APISERVER
cluster-example   True    v1.27.5   https://x.x.x.x:6443

What did you expect to happen?

Error from server (BadRequest): the server could not find the requested cluster

How can we reproduce it (as minimally and precisely as possible)?

Just kubectl get --raw="/apis/clusterpedia.io/v1beta1/resources/apis/apps/v1/deployments?clusters=cluster-1"

Anything else we need to know?

Nope

Clusterpedia Version

None

None

# replace the pod name of clusterpedia apiserver
$ kubectl -n clusterpedia-system exec {clusterpedia-apiserver-pod-name} -- apiserver --version=raw
# paste output here

# replace the pod name of clusterpedia clustersynchro-manager
$ kubectl -n clusterpedia-system exec {clustersynchro-manager-pod-name} -- clustersynchro-manager --version=raw
# paste output here

Host Kubernetes version

None

None

$ kubectl version
# paste output here
@KubeKyrie KubeKyrie added the kind/bug Something isn't working label Dec 29, 2023
@clusterpedia-bot
Copy link

Hi @KubeKyrie,
Thanks for opening an issue!
We will look into it as soon as possible.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@khareyash05
Copy link
Member

khareyash05 commented Dec 31, 2023

Hey! Such a great find @KubeKyrie. Maybe creating a unique token for each cluster and storing it in the storage layer might help.Then we can maybe create a sort of a middleware which checks on each request

@Iceber
Copy link
Member

Iceber commented Jan 4, 2024

This is a known result, and for global searches (paths that do not contain clusters/< cluster >), the parameters passed will only affect the results returned, but no errors will be reported unless the parameters are abnormal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants