Skip to content

feat: pkg manager - #272

Draft
jakobve wants to merge 17 commits into
openmcp-project:mainfrom
jakobve:feat/manager-pkg
Draft

feat: pkg manager#272
jakobve wants to merge 17 commits into
openmcp-project:mainfrom
jakobve:feat/manager-pkg

Conversation

@jakobve

@jakobve jakobve commented Aug 12, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

  • Introduces manager logic from pkg/external-secrets to controller-utils/pkg/manager and controller-utils/pkg/manager/flux to be reusable for other service providers

Which issue(s) this PR fixes:
Fixes openmcp-project/backlog#620

Special notes for your reviewer:
Related PR: openmcp-project/service-provider-external-secrets#124

Release note:

Introduce manager package for reuse in multiple service-providers

jakobve added 16 commits July 31, 2026 14:12
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
…tants

Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>
@jakobve jakobve changed the title Feat/manager pkg feat: pkg manager Aug 12, 2026
@christophrj
christophrj self-requested a review August 12, 2026 09:10
Signed-off-by: Jakob Bergmeier <jakob.vetter@sap.com>

@christophrj christophrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @jakobve I really appreciate you taking the time to create this PR ❤️ I see a lot of really nice improvements, especially with the result handling 👍 Let's use the opportunity to revisit naming and structure while the PR is still in draft 🚀

Comment thread pkg/manager/utils_test.go
helmv2 "github.com/fluxcd/helm-controller/api/v2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/openmcp-project/controller-utils/pkg/clusters"
"github.com/openmcp-project/opencontrolplane-runtime/testdata/api/v1alpha1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The manager should not depend on the runtime testdata.

Comment thread pkg/manager/flux/flux.go
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/openmcp-project/controller-utils/pkg/manager"
"github.com/openmcp-project/opencontrolplane-runtime/pkg/serviceprovider/clusteraccess"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should not depend on the runtime.

Comment thread pkg/manager/flux/flux.go
// Interval defines the OCIRepository and HelmRelease reconcile intervals.
Interval time.Duration
// ClusterContext of the current reconciliation context.
ClusterContext clusteraccess.ClusterContext

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's replace this with a kubeconfig field to get rid of the runtime dependency.

Comment thread go.mod
require (
github.com/evanphx/json-patch/v5 v5.9.11
github.com/go-logr/logr v1.4.4
github.com/fluxcd/helm-controller/api v1.6.3

@christophrj christophrj Aug 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looking at these flux imports I wonder if a new extensibility-utils module would be a better fit than controller-utils. @maximiliantech what do you think?

Comment thread pkg/manager/secret.go
@@ -0,0 +1,76 @@
package manager

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets move secrets into a dedicated package similar to the flux functionality. This way we clearly distinguish between the base manager part vs the (convenience) functionality provided on top of the manager.

// ResourceStatusWriter is implemented by a consumer's CRD-embedded resource type.
// ProjectResources drives it to populate a consumer-owned status entry from a
// framework ManagedResource, keeping pkg/manager decoupled from any CRD schema.
type ResourceStatusWriter interface {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Imo we don't need this but let's discuss (see comment below).

// ResourceRef identifies a managed resource. It is passed to a consumer's
// ResourceStatusWriter so the consumer can decide how to store the fields
// (e.g. whether to represent an empty Namespace or APIGroup as nil).
type ResourceRef struct {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's discuss if this can be removed (see comments below)

Comment thread pkg/manager/manager.go
}

// OrphanCleaner removes any previously managed objects that are no longer part of the desired state.
type OrphanCleaner interface {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets rename this to Cleaner

}

// NewOrphanCleaner removes redundant objects in the given target namespace.
func NewOrphanCleaner[T client.ObjectList](cluster ManagedCluster, serviceProvider string, namespace string, clType CleanerType[T]) OrphanCleaner {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's get rid of the Orphan prefix (also for the filename)

Comment thread pkg/manager/flux/flux.go

// ManageFluxResourcesParams groups all parameters needed to register the
// Flux resources (OCIRepository + HelmRelease) on a cluster.
type ManageFluxResourcesParams struct {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's rename ManageFluxResourceParams to ResourceConfig and I would probably want to restructure this into ociRepo and helmRelease options for users to easier understand which parameter belongs to which resource.

We should also allow users to add additional configuration to customize the result beyond our required parameters, e.g.:

	// HelmReleaseMutateFn allows advanced customization if required
	HelmReleaseMutateFn func(s *helmv2.HelmReleaseSpec) error
	// OCIRepoMutateFn allows advanced customization if required
	OCIRepoMutateFn func(s *sourcev1.OCIRepositorySpec) error

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.

Task: Move Service Provider Manager abstraction to controller-utils

2 participants