kubernetes / dashboard

General-purpose web UI for Kubernetes clusters
Apache License 2.0
14.52k stars 4.17k forks source link

the server could not find the requested resource #9622

Open liuqi-sun opened 1 month ago

liuqi-sun commented 1 month ago

What happened?

I saw a "the server could not find the requested resource " error when I created resource. Sometimes it works, sometimes it doesn't.I found inconsistencies in the body namespce field of the /api/v1/appdeploymentfromfile API.Sometimes it's "default", sometimes it's "_all". If the value is "default", the resource is successfully created. I think this is a bug in the front-end, the back-end logic is not more scientific .

Modify the scheme as follows: 1.The namespace field is added when the resource is created 2.Modified front end 3.Modified back end,I will submit a PR

What did you expect to happen?

success

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

apiVersion: k8s.tmlake.com/v1 kind: AclProfile metadata: name: test-ap spec: partitionName: k8s-adc name: lj-test aclList:

There is no resource namespace field

Anything else we need to know?

No response

What browsers are you seeing the problem on?

No response

Kubernetes Dashboard version

2.5.1 and 2.6.1

Kubernetes version

1.23 and 1.22

Dev environment

No response

liuqi-sun commented 1 month ago

I have found that the backend code of the master branch also has this problem, but I have not tested the latest version for this problem. I saw that there was no corresponding release branch for the historical version, so I modified the pr based on v2.6.1 on a new branch, and the new branch name was v2.6.1-patch

liuqi-sun commented 1 month ago

I tested this issue with postman in release-7.10.0 and the problem persisted. The test API body is as follows: {"name":"","namespace":"_all","content":"apiVersion: k8s.tmlake.com/v1\nkind: VirtualServer\nmetadata:\n name: test-vs-http\nspec:\n resourceClassName: dev1\n partitionName: k8s-adc\n name: httpvs\n ipType: ipv4\n vip: 0.0.0.0:456\n httpProfileName: test-hp\n aclProfileName: test-ap\n enable: \"on\"\n protocol: smart-http\n natName: [\"default\", \"n1\"]\n natRules:\n - name: n1\n desc: \"n1 desc\"\n - name: n2\n desc: \"n2 desc\"\n toSrcType: ip_pool\n ipPool:\n method: conn_rr\n bindingVlanName: vlan_ha\n snatIp:\n - 192.168.80.1-192.168.80.255\n - 192.168.56.1-192.168.56.255\n snatIpv6:\n - fe80::2291:1dcc:1ccb:f5ea-fe80::2291:1dcc:1ccb:ffff\n srcVlan:\n - vlanName: vlan_ha\n - vlanName: vlan_192\n - vlanName: vlan_172\n pool:\n name: tcppool\n service: productpage\n portNumber: 9080\n lb: rr\n\n","validate":true}

Set namespace to "_all", and do not set the namespace field for content.metadata

liuqi-sun commented 1 month ago

so I modified the pr based on 7.10.0 on a new branch, and the new branch name was 7.10.0-patch.