k8s deployer: WaitForDeploymentAvailable errors on a 0-replica Deployment (keda scale-to-zero redeploy)
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go, kubernetes
調査の方向性
Start by reading WaitForDeploymentAvailable and checkIfDeploymentIsAvailable in pkg/k8s/wait.go, then compare how deployments are applied in pkg/k8s/deployer.go. Add coverage for the zero-replica case and verify the existing wait behavior remains intact; a KEDA-backed redeploy can provide the integration repro if needed.
索引モデルが issue の本文から書いたものです。
説明
Summary
WaitForDeploymentAvailable (pkg/k8s/wait.go) can fail a redeploy with
could not find current pod-template-hash for deployment <name> when the live
Deployment has 0 desired replicas. This is reachable today via the keda
(HTTP-scaler) deployer, whose ScaledObject scales idle functions down to zero.
Note: this is reasoned from the code, not yet reproduced (it's a timing race).
Filing so the analysis is tracked; repro TBD.
Details
WaitForDeploymentAvailable re-fetches the live Deployment on every poll tick:
deployment, err := clientset.AppsV1().Deployments(namespace).Get(ctx, deploymentName, metav1.GetOptions{})
...
return checkIfDeploymentIsAvailable(ctx, clientset, deployment)
checkIfDeploymentIsAvailable finds the active ReplicaSet by looking for one with
*rs.Spec.Replicas > 0. A Deployment sitting at 0 desired replicas has no such
ReplicaSet, so currentPodTemplateHash stays empty and the function returns an error
(pkg/k8s/wait.go):
if currentPodTemplateHash == "" {
return false, fmt.Errorf("could not find current pod-template-hash for deployment %s", deployment.Name)
}
The func deployer itself always applies replicas >= 1 (pkg/k8s/deployer.go), so
it never creates a 0-replica Deployment. But because the wait inspects live state,
reachability is governed by what KEDA does during the wait, not by what func wrote:
- An idle keda-HTTP function has been scaled to 0 replicas by KEDA.
- User redeploys. func applies the Deployment with
replicas: 1, then starts polling. - If the KEDA controller reasserts 0 replicas on the live Deployment before the poll
observes it as ready, the live fetch returnsspec.replicas == 0, and the wait
returns the pod-template-hash error — failing the redeploy.
Suggested fix
Short-circuit when there is nothing to wait for:
desiredReplicas := *deployment.Spec.Replicas
if desiredReplicas == 0 {
return true, nil // no replicas desired; nothing to wait for
}
This also unblocks any future spec-level scale-to-zero on the raw/keda Deployment.
Notes
- Reasoned from code; not reproduced. A repro needs a cluster with KEDA and an idle,
scaled-to-zero HTTP function being redeployed. - Fix is small and self-contained but likely wants a repro or unit test first, hence
filing as an issue rather than an immediate PR.
- 主要言語
- Go
- スター
- 365
- フォーク
- 224
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
knative/func のほかの issue
-
KEDA deployer: default minReplicaCount prevents scale-to-zero対応中かも @Tushar-Khandelwal-2004 が 111 日前に担当しました。 オープンlifecycle/stale
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
knative/func#3924 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
git/gitlab: default project webhooks to SSL verification when creating hooks対応中かも @Vi-shub が 158 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
mcp: config add/remove handlers bypass readonly guard対応中かも @Elvand-Lie が 160 日前に担当しました。 オープンkind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
knative/func#3704 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
operator sync creates registry auth Secret as Opaque/config.json, incompatible with func-operator (expects dockerconfigjson)対応中かも @gauron99 が 6 日前に担当しました。 オープン
メンテナーはふだん 2 日以内に返信
-
func.yaml schema generator truncates fractional `minimum` values (e.g. 0.01 -> 0)対応中かも @Elvand-Lie が 23 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/rocketmq-dashboard#7243 ·
メンテナーはふだん 3 日以内に返信
-
Missing example coverage: getClock対応中かも @camunda-sdk-automation が今日担当しました。 オープンnew-operations
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
camunda/orchestration-cluster-api-go#75 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[schema-coverage] elasticstack_kibana_security_entity_store_status対応中かも @github-actions が今日担当しました。 オープンacceptance-tests phase-coding schema-coverage testing triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
elastic/terraform-provider-elasticstack#5396 ·
メンテナーはふだん 1 日以内に返信
-
Go device SDK: Whisper transcriber keeps buffering and transcribing audio appended after Stop()対応中かも @apoorvdarshan が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BasedHardware/omi#22770 ·
メンテナーはふだん 1 日以内に返信
-
Bug v3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信