feat(plan): support convertorLabels and convertorAffinity in Plan resource

未關閉 適合新手
#2,849 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@AmenB 已經在處理了。

開始於 2026年11月2日。

  • #2850 來自 @AmenB —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
82/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
kubernetes, python
領域
backend

研究方向

從 ocp_resources/plan.py 開始,參照 convertor_node_selector 在 __init__ 中的接收、儲存,以及在 to_dict() 中寫入 spec["convertorNodeSelector"] 的方式,在其旁邊加入 convertor_labels 和 convertor_affinity 及其 camelCase 的 spec 鍵。在 tests/test_plan.py 中加入文件字串條目和測試案例,檢查每個鍵在設定時出現、在為 None 時省略。當兩個測試都通過且 issue 中的清單皆已滿足時,即為完成。

由索引模型根據 Issue 內容生成。

描述

Problem

The forklift Plan CRD supports spec.convertorLabels (map[string]string) and spec.convertorAffinity (standard Kubernetes affinity dict), but the Plan wrapper (ocp_resources/plan.py) does not expose them. Consumers (e.g. mtv-api-tests, issue RedHatQE/mtv-api-tests#813 for MTV-7085 regression coverage) need to set labels and preferred podAffinity on virt-v2v conversion pods.

Current state

  • convertor_node_selector → spec["convertorNodeSelector"] was added in #2819 — exact pattern to follow.
  • target_affinity → spec["targetAffinity"] already exists as affinity precedent.
  • No convertor_labels / convertor_affinity anywhere in ocp_resources/plan.py.

Proposed change

Mirror the convertor_node_selector pattern in ocp_resources/plan.py:

  1. __init__ params: convertor_labels: dict[str, str] | None = None, convertor_affinity: dict[str, Any] | None = None
  2. Attribute assignment in __init__
  3. to_dict(): if self.convertor_labels is not None: spec["convertorLabels"] = ... and same for convertorAffinity (next to convertorNodeSelector block, ~line 232)
  4. Docstring entries next to convertor_node_selector's
  5. Tests in tests/test_plan.py asserting spec keys emitted when set and omitted when None

Done

  • convertor_labels param maps to spec.convertorLabels in to_dict()
  • convertor_affinity param maps to spec.convertorAffinity in to_dict()
  • Docstrings updated
  • Tests cover both fields (set and None cases)
  • prek run passes
  • uv run --group tests pytest passes
主要語言
Python
星號
28
分支
85
平均合併
1 天 27 分鐘
30 天內合併 PR
28

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

RedHatQE/openshift-python-wrapper 的其他 Issue

查看 RedHatQE/openshift-python-wrapper 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。