feat: replicating resources upon namespace creation (#2080)

* feat: replicating resources upon namespace creation

This feature enhances the (Global)TenantResource replication by
triggering a replication of resources upon a Namespace creation: this
speeds up the replication of resources without waiting for the
resyncPeriod that could be delayed for several reasons.

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* fix: addressing fix from github copilot

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

---------

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
Co-authored-by: Oliver Bähler <26610571+oliverbaehler@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Dario Tranchitella
2026-08-17 10:51:09 +02:00
committed by GitHub
co-authored by Copilot Autofix powered by AI Oliver Bähler
parent 305cabd4f6
commit fed61d2815
16 changed files with 1482 additions and 171 deletions
+13
View File
@@ -9,6 +9,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/projectcapsule/capsule/pkg/runtime/configuration"
"github.com/projectcapsule/capsule/pkg/runtime/gvk"
)
type Processor struct {
@@ -25,3 +26,15 @@ type ProcessorOptions struct {
Force bool
Owner *metav1.OwnerReference
}
// Scope narrows a reconciliation down to the items replicated into a
// single Namespace of a single Tenant.
type Scope struct {
Tenant string
Namespace string
}
// Matches states whether the given resource identity belongs to the scope.
func (s Scope) Matches(id gvk.ResourceID) bool {
return id.Tenant == s.Tenant && id.Namespace == s.Namespace
}