spidernet-io / spiderpool

Underlay and RDMA network solution of the Kubernetes, for bare metal, VM and any public cloud
https://spidernet-io.github.io/spiderpool/
Apache License 2.0
503 stars 72 forks source link

webhook: automatically insert the rdma resource to pod by DRA claim #3670

Open cyclinder opened 5 days ago

cyclinder commented 5 days ago

Thanks for contributing!

What type of PR is this?

What this PR does / why we need it:

webhook: auto inject the rdma resource to pod.

pod.resourceClaims -> spiderclaimparameters.staticNics -> spidermultusconfig -> resourceName -> pod.resource.requests.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

codecov[bot] commented 5 days ago

Codecov Report

Attention: Patch coverage is 0% with 103 lines in your changes missing coverage. Please review.

Project coverage is 79.30%. Comparing base (5ff6c82) to head (7663fa2).

:exclamation: Current head 7663fa2 differs from pull request most recent head 7f26f0b

Please upload reports for the commit 7f26f0b to get more accurate results.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670/graphs/tree.svg?width=650&height=150&src=pr&token=YKXY2E4Q8G&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io)](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) ```diff @@ Coverage Diff @@ ## main #3670 +/- ## ========================================== - Coverage 81.68% 79.30% -2.39% ========================================== Files 50 51 +1 Lines 4391 4494 +103 ========================================== - Hits 3587 3564 -23 - Misses 643 773 +130 + Partials 161 157 -4 ``` | [Flag](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | `79.30% <0.00%> (-2.39%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | Coverage Δ | | |---|---|---| | [pkg/podmanager/pod\_webhook.go](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670?src=pr&el=tree&filepath=pkg%2Fpodmanager%2Fpod_webhook.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io#diff-cGtnL3BvZG1hbmFnZXIvcG9kX3dlYmhvb2suZ28=) | `0.00% <0.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3670/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io)
weizhoublue commented 5 days ago

没有 E2E ,至少 需要 把 E2E 设计 提到 doc

cyclinder commented 3 days ago

仍然在排查 webhook 流程问题:

Events:
  Type     Reason        Age                 From                   Message
  ----     ------        ----                ----                   -------
  Warning  FailedCreate  10s (x13 over 31s)  replicaset-controller  Error creating: Internal error occurred: failed calling webhook "pods.kubernetes.io": failed to call webhook: the server could not find the requested resource
root@10-20-1-200:~# kubectl logs  -n kube-system kube-apiserver-spider-control-plane | grep pods.kubernetes.io
W0628 10:24:25.536243       1 dispatcher.go:225] Failed calling webhook, failing closed pods.kubernetes.io: failed calling webhook "pods.kubernetes.io": failed to call webhook: the server could not find the requested resource
    logging error output: "k8s\x00\n\f\n\x02v1\x12\x06Status\x12\xbe\x02\n\x06\n\x00\x12\x00\x1a\x00\x12\aFailure\x1a\x8e\x01Internal error occurred: failed calling webhook \"pods.kubernetes.io\": failed to call webhook: the server could not find the requested resource\"\rInternalError*\x87\x01\n\x00\x12\x00\x1a\x00\"{\n\x00\x12ufailed calling webhook \"pods.kubernetes.io\": failed to call webhook: the server could not find the requested resource\x1a\x00(\x002\x000\xf4\x03\x1a\x00\"\x00"
W0628 10:24:25.553750       1 dispatcher.go:225] Failed calling webhook, failing closed pods.kubernetes.io: failed calling webhook "pods.kubernetes.io": failed to call webhook: the server could not find the requested resource
weizhoublue commented 3 days ago

the server could not find the requested resource

the server could not find the requested resource ---- is spiderpool parameter CRD not registerred ?

weizhoublue commented 3 days ago

just go ahead next Monday

cyclinder commented 1 day ago

the server could not find the requested resource ---- is spiderpool parameter CRD not registered ?

No, all spiderpool CRD has been registered, this webhook is just for pods, the error is extraordinary