[feat] ensure conversion hooks#790
Merged
Merged
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR forward-ports the “ensure conversion hooks” feature to main by introducing a new converge task that applies a module’s ConversionWebhook resources before its Helm release runs, so CRD conversion is in place before custom resources are created.
Changes:
- Adds a new
ModuleEnsureHookstask (module-ensure-hooks) and wires it into the task handler service. - Queues
ModuleEnsureHooksduring module converge (beforeModuleRun) when the module is detected to contain conversion webhook templates. - Implements webhook detection (static heuristic at module load), rendering (filter rendered manifests by
kind: ConversionWebhook), and applying (CreateOrUpdate viaKubeObjectPatcher) in the module manager.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/task/tasks/module-ensure-hooks/task.go | New task handler that triggers EnsureConversionWebhooks for a module. |
| pkg/task/tasks/converge-modules/task.go | Enqueues the new ensure-hooks task in the converge pipeline and adds a helper constructor. |
| pkg/task/task.go | Adds the new ModuleEnsureHooks task type constant. |
| pkg/task/service/service.go | Registers the new task handler in the task factory map. |
| pkg/task/helpers/helpers.go | Updates task-details formatting to include ModuleEnsureHooks. |
| pkg/module_manager/module_manager.go | Adds EnsureConversionWebhooks and ModuleHasConversionWebhooks to render/apply webhook resources. |
| pkg/module_manager/models/modules/helm.go | Adds webhook rendering helper that filters rendered YAML docs by ConversionWebhook kind. |
| pkg/module_manager/models/modules/basic.go | Adds a static “templates contain ConversionWebhook” heuristic computed on module load. |
| pkg/addon-operator/operator.go | Updates task-details formatting to include ModuleEnsureHooks. |
| pkg/addon-operator/converge/converge.go | Treats ModuleEnsureHooks as a converge task type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com> (cherry picked from commit 04ede3b)
Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
fd263fc to
ab32f52
Compare
ipaqsa
approved these changes
Jul 8, 2026
ldmonster
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Forward-ports the "ensure conversion hooks" feature to
main. It shipped torelease-1.21in #783 but is missing onmain; this bringsmainin line. Cherry-pick (-x) of04ede3b— applied conflict-free on currentmain(3-way auto-merge),go build ./...andgo vetpass.What this PR does / why we need it
Adds a
module-ensure-hookstask that applies a module'sConversionWebhookresources before its Helm release, and wires it into the module converge lifecycle (module_manager,converge-modules, task service,task.go). This lets the cluster's webhook-handler patch the target CRDs'spec.conversionbefore the module creates custom resources that need converting — otherwise the API server stores those resources before conversion is live and prunes the old-version fields.Special notes for your reviewer
Straight forward-port of #783; no changes beyond the conflict-free cherry-pick onto
main. Original author: Stepan Paksashvili.