Skip to content

feat: add support for safe start#391

Draft
fernandezcuesta wants to merge 3 commits into
masterfrom
390-missing-mr-activation-policies-support
Draft

feat: add support for safe start#391
fernandezcuesta wants to merge 3 commits into
masterfrom
390-missing-mr-activation-policies-support

Conversation

@fernandezcuesta

@fernandezcuesta fernandezcuesta commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Add safe start support for provider-sql by wrapping the Setup method into a gated setup, now common to all Setups.

Fix: #390

@fernandezcuesta fernandezcuesta linked an issue Jun 2, 2026 that may be closed by this pull request
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
@fernandezcuesta fernandezcuesta force-pushed the 390-missing-mr-activation-policies-support branch from e7e1d21 to 0245e0b Compare June 2, 2026 15:59
@fernandezcuesta fernandezcuesta marked this pull request as draft June 2, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds “safe-start” support to provider-sql by introducing a common, gated controller setup helper and refactoring all managed resource controllers to register their setup behind a CRD-availability gate, deferring controller creation until the corresponding CRDs exist.

Changes:

  • Introduces pkg/controller/setup.Setup to centralize managed reconciler/controller creation behind o.Gate.Register.
  • Refactors all cluster and namespaced SQL controllers to use the new gated setup helper.
  • Wires up the CRD gate in cmd/provider/main.go and declares the safe-start capability in the package metadata.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/controller/setup/setup.go Adds a shared gated controller setup helper used by all managed controllers.
pkg/controller/namespaced/postgresql/schema/reconciler.go Switches Schema controller setup to the shared gated setup helper.
pkg/controller/namespaced/postgresql/role/reconciler.go Switches Role controller setup to the shared gated setup helper.
pkg/controller/namespaced/postgresql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/namespaced/postgresql/extension/reconciler.go Switches Extension controller setup to the shared gated setup helper.
pkg/controller/namespaced/postgresql/default_privileges/reconciler.go Switches DefaultPrivileges controller setup to the shared gated setup helper.
pkg/controller/namespaced/postgresql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
pkg/controller/namespaced/mysql/user/reconciler.go Switches User controller setup to the shared gated setup helper.
pkg/controller/namespaced/mysql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/namespaced/mysql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
pkg/controller/namespaced/mssql/user/reconciler.go Switches User controller setup to the shared gated setup helper.
pkg/controller/namespaced/mssql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/namespaced/mssql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/schema/reconciler.go Switches Schema controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/role/reconciler.go Switches Role controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/extension/reconciler.go Switches Extension controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/default_privileges/reconciler.go Switches DefaultPrivileges controller setup to the shared gated setup helper.
pkg/controller/cluster/postgresql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
pkg/controller/cluster/mysql/user/reconciler.go Switches User controller setup to the shared gated setup helper.
pkg/controller/cluster/mysql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/cluster/mysql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
pkg/controller/cluster/mssql/user/reconciler.go Switches User controller setup to the shared gated setup helper.
pkg/controller/cluster/mssql/grant/reconciler.go Switches Grant controller setup to the shared gated setup helper.
pkg/controller/cluster/mssql/database/reconciler.go Switches Database controller setup to the shared gated setup helper.
package/crossplane.yaml Declares the provider’s safe-start capability.
go.mod Promotes k8s.io/apiextensions-apiserver to a direct dependency for CRD gating types.
cmd/provider/main.go Initializes the GVK gate, adds CRD types to scheme, and sets up the CRD gate controller.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/controller/namespaced/mysql/grant/reconciler.go
Comment thread pkg/controller/cluster/mysql/grant/reconciler.go
Comment thread pkg/controller/namespaced/mssql/grant/reconciler.go
Comment thread pkg/controller/cluster/mssql/grant/reconciler.go
Comment on lines +46 to +48
func Setup(mgr ctrl.Manager, o xpcontroller.Options, cfg ControllerConfig) error {
o.Gate.Register(func() {
name := managed.ControllerName(cfg.GVK.GroupKind().String())
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
@fernandezcuesta fernandezcuesta marked this pull request as ready for review June 2, 2026 17:18
@fernandezcuesta fernandezcuesta marked this pull request as draft June 2, 2026 22:35
@fernandezcuesta

Copy link
Copy Markdown
Collaborator Author

Duplicate of #287

@fernandezcuesta fernandezcuesta marked this as a duplicate of #287 Jun 2, 2026
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing MR activation policies support

2 participants