spiderpool icon indicating copy to clipboard operation
spiderpool copied to clipboard

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

Open cyclinder opened this issue 1 year ago • 7 comments

Thanks for contributing!

What type of PR is this?

  • release/feature

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:

cyclinder avatar Jun 26 '24 11:06 cyclinder

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

@@            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 Coverage Δ
unittests 79.30% <0.00%> (-2.39%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/podmanager/pod_webhook.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

codecov[bot] avatar Jun 26 '24 11:06 codecov[bot]

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

weizhoublue avatar Jun 27 '24 03:06 weizhoublue

仍然在排查 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

cyclinder avatar Jun 28 '24 10:06 cyclinder

the server could not find the requested resource

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

weizhoublue avatar Jun 28 '24 11:06 weizhoublue

just go ahead next Monday

weizhoublue avatar Jun 28 '24 12:06 weizhoublue

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

cyclinder avatar Jul 01 '24 02:07 cyclinder

@weizhoublue 我建议这个webhook 只对带有某些 label 的 pod 生效(比如 resources.spidernet.io/webhook-resources: true),不然可能会影响其他 pod 甚至是 apiserver 的正常启动, 测试过程也发现了这个问题

cyclinder avatar Jul 08 '24 07:07 cyclinder

dup with https://github.com/spidernet-io/spiderpool/pull/4239

cyclinder avatar Oct 31 '24 08:10 cyclinder