From c8a23f04540d60f1971f4fcc8ed90d9e2ce85b2a Mon Sep 17 00:00:00 2001 From: caretak3r <50377477+caretak3r@users.noreply.github.com> Date: Wed, 18 Feb 2026 21:13:33 -0500 Subject: [PATCH] feat(kube): add OrderedStrategy WaitStrategy for HIP-0025 sequencing - Add OrderedStrategy constant to WaitStrategy enum - OrderedStrategy delegates to StatusWatcher for readiness checks - Batching/sequencing logic handled by action layer - Accept --wait=ordered in CLI flag parser --- pkg/cmd/flags.go | 6 +++--- pkg/kube/client.go | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/flags.go b/pkg/cmd/flags.go index 6d9d117f8..da01a615e 100644 --- a/pkg/cmd/flags.go +++ b/pkg/cmd/flags.go @@ -59,7 +59,7 @@ func AddWaitFlag(cmd *cobra.Command, wait *kube.WaitStrategy) { cmd.Flags().Var( newWaitValue(kube.HookOnlyStrategy, wait), "wait", - "wait until resources are ready (up to --timeout). Use '--wait' alone for 'watcher' strategy, or specify one of: 'watcher', 'hookOnly', 'legacy'. Default when flag is omitted: 'hookOnly'.", + "wait until resources are ready (up to --timeout). Use '--wait' alone for 'watcher' strategy, or specify one of: 'watcher', 'hookOnly', 'legacy', 'ordered'. Default when flag is omitted: 'hookOnly'. 'ordered' enables HIP-0025 sequencing.", ) cmd.Flags().Lookup("wait").NoOptDefVal = string(kube.StatusWatcherStrategy) } @@ -80,7 +80,7 @@ func (ws *waitValue) String() string { func (ws *waitValue) Set(s string) error { switch s { - case string(kube.StatusWatcherStrategy), string(kube.LegacyStrategy), string(kube.HookOnlyStrategy): + case string(kube.StatusWatcherStrategy), string(kube.LegacyStrategy), string(kube.HookOnlyStrategy), string(kube.OrderedStrategy): *ws = waitValue(s) return nil case "true": @@ -92,7 +92,7 @@ func (ws *waitValue) Set(s string) error { *ws = waitValue(kube.HookOnlyStrategy) return nil default: - return fmt.Errorf("invalid wait input %q. Valid inputs are %s, %s, and %s", s, kube.StatusWatcherStrategy, kube.HookOnlyStrategy, kube.LegacyStrategy) + return fmt.Errorf("invalid wait input %q. Valid inputs are %s, %s, %s, and %s", s, kube.StatusWatcherStrategy, kube.HookOnlyStrategy, kube.LegacyStrategy, kube.OrderedStrategy) } } diff --git a/pkg/kube/client.go b/pkg/kube/client.go index fc706496d..bf9d2d848 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -117,6 +117,11 @@ const ( // HookOnlyStrategy: wait only for hook Pods/Jobs to complete; does not wait for general chart resources. HookOnlyStrategy WaitStrategy = "hookOnly" + + // OrderedStrategy: deploy resources in dependency order defined by HIP-0025 + // sequencing annotations. Each batch of resources is deployed and waited for + // before the next batch begins. Uses StatusWatcherStrategy for readiness checks. + OrderedStrategy WaitStrategy = "ordered" ) type FieldValidationDirective string @@ -200,10 +205,14 @@ func (c *Client) GetWaiterWithOptions(strategy WaitStrategy, opts ...WaitOption) return nil, err } return &hookOnlyWaiter{sw: sw}, nil + case OrderedStrategy: + // Ordered strategy uses the status watcher for readiness checks. + // The batching/sequencing logic is handled by the action layer. + return c.newStatusWatcher(opts...) case "": - return nil, errors.New("wait strategy not set. Choose one of: " + string(StatusWatcherStrategy) + ", " + string(HookOnlyStrategy) + ", " + string(LegacyStrategy)) + return nil, errors.New("wait strategy not set. Choose one of: " + string(StatusWatcherStrategy) + ", " + string(HookOnlyStrategy) + ", " + string(LegacyStrategy) + ", " + string(OrderedStrategy)) default: - return nil, errors.New("unknown wait strategy (s" + string(strategy) + "). Valid values are: " + string(StatusWatcherStrategy) + ", " + string(HookOnlyStrategy) + ", " + string(LegacyStrategy)) + return nil, errors.New("unknown wait strategy (s" + string(strategy) + "). Valid values are: " + string(StatusWatcherStrategy) + ", " + string(HookOnlyStrategy) + ", " + string(LegacyStrategy) + ", " + string(OrderedStrategy)) } }