fix(k8s): use call_api for patch_pvc — _headers and _content_type both unsupported - #1210
Open
shenshouer wants to merge 1 commit into
Open
fix(k8s): use call_api for patch_pvc — _headers and _content_type both unsupported#1210shenshouer wants to merge 1 commit into
shenshouer wants to merge 1 commit into
Conversation
…h unsupported 生成的 patch_namespaced_persistent_volume_claim 方法在旧版 kubernetes-client 中既不支持 _content_type 也不支持 _headers 参数。 修复历程: 1. _content_type -> 生产环境 client 不支持(部署版本为 pre-OpenAPI-generator) 2. _headers -> 同样不支持,该类版本不生成任何下划线参数 3. ApiClient.call_api() + header_params + auth_settings -> 最终方案 call_api 是 kubernetes-client 最底层的方法,header_params 在所有版本 中均受支持。需同时指定 auth_settings=['BearerToken'] 否则请求以 system:anonymous 发送导致 403 Forbidden。 Fixes opensandbox-group#1199
shenshouer
requested review from
Generalwin,
Pangjiping,
hittyt,
jwx0925 and
ninan-nn
as code owners
July 7, 2026 02:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
_attach_pvc_owner_references在给自动创建的 PVC 附加ownerReferences时失败,导致 K8s GC 无法级联删除 PVC。修复历程
call_api是 kubernetes-client 最底层的方法,header_params在所有版本中均受支持。需同时指定auth_settings=['BearerToken'],否则请求以system:anonymous身份发送导致 403 Forbidden。Fixes #1199
测试