--node-affinity panics without Type and wipes existing affinity settings
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
pkg/flags/podspec_helper.go の UpdateNodeAffinity から始め、Type をどのように解析し、spec.Affinity を更新するかを追ってください。近くにあるテストで、型がない場合と既存の affinity 条件を確認してください。型がない場合に Required | Preferred を列挙するエラーが返され、項を追加しても他の affinity 設定が保持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug report
--node-affinity (UpdateNodeAffinity in pkg/flags/podspec_helper.go) has two problems:
-
When no
Type=is given, kn panics with a nil pointer dereference instead of reporting an error, becausespec.Affinityis only initialized inside theTypebranches:$ kn service create foo --image gcr.io/knative-samples/helloworld-go --node-affinity Key=topology.kubernetes.io/zone,Operator=In,Values=antarctica-east1 panic: runtime error: invalid memory address or nil pointer dereference -
When the requested clause (
RequiredorPreferred) doesn't exist on the service yet, the wholespec.Affinityis replaced by a new empty object. This silently deletes everything else in it: the other node affinity clause and anypodAffinity/podAntiAffinity. For example, adding aPreferredterm to a service with aRequiredterm removes theRequiredterm.
Expected behavior
- A missing type is reported as an error listing the valid values (
Required | Preferred). - The new term is added to the requested clause and all other affinity settings of the service are kept.
Steps to reproduce the problem
With the node affinity feature flag enabled in Knative Serving:
kn service create foo --image gcr.io/knative-samples/helloworld-go \
--node-affinity Type=Required,Key=topology.kubernetes.io/zone,Operator=In,Values=antarctica-east1
kn service update foo \
--node-affinity Type=Preferred,Key=disktype,Operator=In,Values=ssd,Weight=1
kn service describe foo -o yaml # requiredDuringSchedulingIgnoredDuringExecution is gone
kn version
main (f2bfc7f3)
Knative (serving/eventing) version
Nightly
- 主要言語
- Go
- スター
- 387
- フォーク
- 278
- 平均マージ
- 3日 21時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
knative/client のほかの issue
-
Env vars given with --env/--env-value-from/--env-file are silently dropped when they can't be matched in the command line対応中かも @NopeCharon が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
kind/bug lifecycle/stale triage/accepted
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
[48h Knative] KServe plugin再び着手できるかも @sharmaansh21 が 1064 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンknative48h triage/accepted
-
CLI: add support for experimental new filters API in trigger再び着手できるかも @JuneOh710 が 1065 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンkind/feature triage/accepted
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
Service export should handle securityContext field再び着手できるかも @thiagomedina が 430 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンgood first issue kind/feature triage/accepted
似ている issue
-
bug converter
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
grafana/sigma-rule-deployment#435 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google/go-containerregistry#2491 ·
メンテナーはふだん 1 日以内に返信
-
type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
nightgauge/nightgauge#2688 ·
メンテナーはふだん 1 日以内に返信
-
aiac enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信