Builder's `For`, `Owns` and `Watches` methods overwrite multiple options
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Builder's の For、Owns、Watches のエントリポイントと、対応する ForOption、OwnsOption、WatchesOption の実装を特定します。各 ApplyTo メソッドが複数のオプションをどのように処理するかを比較し、そのうえで、リポジトリの関連するテストを使って、指定されたすべてのオプションの述語が上書きされずに保持されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
The Builder struct's For, Owns and Watches methods all follow the same pattern of having a variable number of modifying Option structs as the final parameter to the method. Here is the code for the For method:
// For defines the type of Object being *reconciled*, and configures the ControllerManagedBy to respond to create / delete /
// update events by *reconciling the object*.
// This is the equivalent of calling
// Watches(&source.Kind{Type: apiType}, &handler.EnqueueRequestForObject{})
func (blder *Builder) For(object runtime.Object, opts ...ForOption) *Builder {
input := ForInput{object: object}
for _, opt := range opts {
opt.ApplyToFor(&input)
}
blder.forInput = input
return blder
}
The problem with the above is if you call For with more than one ForOption, the builder's forInput member ends up containing only the predicates contained in the last ForOption. The reason is because the ForOption.ApplyToFor assigns the ForOption.predicates member to the supplied ForInput.predicates member (note: ForOption is an interface that is implemented by the Predicates struct):
// ApplyToFor applies this configuration to the given ForInput options.
func (w Predicates) ApplyToFor(opts *ForInput) {
opts.predicates = w.predicates
}
The solution is to append w.predicates to the supplied opt.predicates instead of assigning/overwriting the value of opts.predicates:
// ApplyToFor applies this configuration to the given ForInput options.
func (w Predicates) ApplyToFor(opts *ForInput) {
opts.predicates = append(opts.predicates, w.predicates...)
}
- 主要言語
- Go
- スター
- 3k
- フォーク
- 1.3k
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 48
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
kubernetes-sigs/controller-runtime のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
kubernetes-sigs/controller-runtime#3704 ·
メンテナーはふだん 1 日以内に返信
-
lifecycle/rotten
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kubernetes-sigs/controller-runtime#3537 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Read-your-writes consistency is not applied to unstructured objects written with Update or Patch対応中かも @7616e5a9c573ffb221843a498885ab0f が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
kubernetes-sigs/controller-runtime#3702 ·
メンテナーはふだん 1 日以内に返信
-
Client and DynamicRESTMapper keep a kind's old scope after its CRD is recreated with a different `scope`対応中かも @AdamMagued が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
kubernetes-sigs/controller-runtime#3671 ·
メンテナーはふだん 1 日以内に返信
-
ReadYourWrite doesn't correctly deal with mutating requests removing the last finalizer対応中かも @AdamMagued が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
kubernetes-sigs/controller-runtime#3670 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
kubernetes-sigs/controller-runtime の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
OneBusAway/watchdog#470 ·
メンテナーはふだん 1 日以内に返信
-
area: session
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
charmbracelet/crush#4484 ·
メンテナーはふだん 1 日以内に返信
-
[Resource]: Hearthオープンresource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
hesreallyhim/awesome-claude-code#3713 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
expr-lang/expr#1037 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
provider-key submission
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
opentofu/registry#6740 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信