feat(manualapprovalgate): integrate MAG as TektonConfig child component#3762
feat(manualapprovalgate): integrate MAG as TektonConfig child component#3762pratap0007 wants to merge 1 commit into
Conversation
Add ManualApproval field to TektonConfig spec so that TektonConfig manages the ManualApprovalGate CR lifecycle including ownerRef and platform-data-hash propagation for TLS profile changes. - Disabled by default on fresh installs - On upgrade, standalone MAG CRs (no ownerRef) are adopted under TektonConfig instead of being deleted - Add validation for spec.manualApproval.options - Add unit tests for create, delete, ownerRef migration, and platform-data-hash annotation sync Fixes tektoncd#3656 Signed-off-by: Shiv Verma <shverma@redhat.com> Assisted-by: Claude Opus 4.6 (via Claude Code)
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3762 +/- ##
==========================================
+ Coverage 25.49% 25.67% +0.17%
==========================================
Files 449 450 +1
Lines 23370 23491 +121
==========================================
+ Hits 5959 6031 +72
- Misses 16725 16767 +42
- Partials 686 693 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Integrates the ManualApprovalGate (MAG) component into the TektonConfig reconciliation flow so TektonConfig can create/adopt/delete the MAG CR and propagate platform-data-hash changes, aligning MAG with how other Tekton components are managed.
Changes:
- Add
spec.manualApprovaltoTektonConfigSpecwith defaulting + validation wiring. - Introduce shared
manualapprovalgatehelper package to ensure/create/update/delete the MAG CR (including ownerRef andplatform-data-hashpropagation). - Add unit tests covering MAG create/delete, ownerRef migration, and platform-data-hash propagation.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/reconciler/shared/tektonconfig/tektonconfig.go | Wire MAG lifecycle into TektonConfig reconcile/finalize and propagate platform-data-hash. |
| pkg/reconciler/shared/tektonconfig/manualapprovalgate/manualapprovalgate.go | New shared helper functions to ensure/update/delete MAG CR. |
| pkg/reconciler/shared/tektonconfig/manualapprovalgate/manualapprovalgate_test.go | Unit tests for MAG helper behaviors (create/delete/migration/platform hash). |
| pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go | Generated deepcopy updates for new ManualApproval.Disabled pointer + TektonConfigSpec field. |
| pkg/apis/operator/v1alpha1/tektonconfig_validation.go | Add validation for spec.manualApproval.options. |
| pkg/apis/operator/v1alpha1/tektonconfig_types.go | Add ManualApproval field to TektonConfig spec. |
| pkg/apis/operator/v1alpha1/tektonconfig_defaults.go | Default ManualApproval to disabled on fresh installs. |
| pkg/apis/operator/v1alpha1/manualapprovalgate_types.go | Add ManualApproval.Disabled + helpers (setDefaults, IsDisabled). |
Files not reviewed (1)
- pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| magEnabled := !tc.Spec.ManualApproval.IsDisabled() | ||
| if !magEnabled { | ||
| existingMAG, err := manualapprovalgate.GetManualApprovalGate(ctx, r.operatorClientSet.OperatorV1alpha1().ManualApprovalGates(), v1alpha1.ManualApprovalGates) | ||
| if err == nil && len(existingMAG.OwnerReferences) == 0 { | ||
| logger.Debug("Found standalone ManualApprovalGate CR from previous version, adopting under TektonConfig") | ||
| magEnabled = true | ||
| } | ||
| } |
| if old.ObjectMeta.OwnerReferences == nil { | ||
| old.ObjectMeta.OwnerReferences = new.ObjectMeta.OwnerReferences | ||
| updated = true | ||
| } |
Add ManualApproval field to TektonConfig spec so that TektonConfig manages the ManualApprovalGate CR lifecycle including ownerRef and platform-data-hash propagation for TLS profile changes.
Fixes #3656
Assisted-by: Claude Opus 4.6 (via Claude Code)
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lintbefore submitting a PRSee the contribution guide for more details.
Release Notes