go composition function: observed XR managedFields leak into SSA status patch
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
internal/xfn/utils.go、特に AsStruct() から始め、SSA ステータスパッチが構築される composition_functions.go を確認します。crossplane render と metadata.managedFields を含むクラスターのレスポンスとの差分を再現し、そのフィールドが目的の composite resource に到達する箇所を追跡します。生成された構造体のラウンドトリップによって拒否される SSA ステータスパッチが生成されなくなり、managedFields のカバレッジが追加されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened?
I am using the Crossplane project sturcture generating the go structs for the composed and composite
resources. The object retains the ManagedFields from the request and when set to the response via
mapAny, err := runtime.DefaultUnstructuredConverter.ToUnstructured(goStructOfComposite)
unstr := unstructured.Unstructured{Object: mapAny}
response.SetDesiredCompositeResource(rsp, &resource.Composite{Resource: &composite.Unstructured{Unstructured: unstr}}),
the metadata.managedFields populated by the API server survive into the SSA patch
body, and Kubernetes rejects it
Below is an analysis by Claude:
When a Go composition function round-trips the observed XR through a generated
struct and calls response.SetDesiredCompositeResource, the
metadata.managedFields populated by the API server survive into the SSA patch
body, and Kubernetes rejects it:
cannot apply composite resource status: metadata.managedFields must be nil
AsStruct() (L52–76)
copies the full observed XR backing map into the RunFunctionRequest proto
without stripping managedFields. Generated ObjectMeta structs include
ManagedFields *[]ManagedFieldsEntry, so the field survives the Go struct
round-trip and reaches the
SSA patch in composition_functions.go,
where Kubernetes rejects it.
crossplane render does not populate managedFields
in the observed XR proto, so render passes while the cluster fails.
Workaround: call unstr.SetManagedFields(nil) before SetDesiredCompositeResource.
Related: crossplane/crossplane#7453
What environment did it happen in?
Crossplane version: v2.3.2, v2.3.
- 主要言語
- Go
- スター
- 19
- フォーク
- 31
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 53
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crossplane/cli のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
crossplane/cli#282 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
crossplane/cli#384 ·
-
crossplane/cli#379 · 担当者 1 名 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
crossplane/cli#370 · リアクション 1 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
crossplane/cli#369 ·
似ている issue
-
bug github_actions
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
registrystack/registry-stack#1393 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JakeChampion/lang#10213 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
oasisprotocol/oasis-sdk#2523 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100