fix: metric recorders for all conditionals (#1998)

* fix(controller): decode old object for delete requests

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* fix: preserve ca-bundles injected from external providers

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* feat: add metadata enforcement

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* feat: add metadata enforcement

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: add resourcepoolclaim validation

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: add resourcepoolclaim validation

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: add resourcepoolclaim validation

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: add resourcepoolclaim validation

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: wave of fixes

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

---------

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Oliver Bähler
2026-07-03 14:38:41 +02:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 8e1cc910bd
commit 4b07463705
27 changed files with 1176 additions and 297 deletions
+2 -12
View File
@@ -18,7 +18,6 @@ import (
"github.com/projectcapsule/capsule/pkg/runtime/gvk"
"github.com/projectcapsule/capsule/pkg/runtime/handlers"
"github.com/projectcapsule/capsule/pkg/runtime/indexers/tenantresource"
"github.com/projectcapsule/capsule/pkg/tenant"
)
type replicaHandler struct{}
@@ -39,13 +38,13 @@ func (h *replicaHandler) OnCreate(
}
func (h *replicaHandler) OnDelete(
_ client.Client,
c client.Client,
reader client.Reader,
_ admission.Decoder,
recorder events.EventRecorder,
) handlers.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return nil
return h.handler(ctx, c, req, recorder)
}
}
@@ -66,15 +65,6 @@ func (h *replicaHandler) handler(
req admission.Request,
recorder events.EventRecorder,
) *admission.Response {
tnt, err := tenant.TenantByStatusNamespace(ctx, c, req.Namespace)
if err != nil {
return ad.ErroredResponse(err)
}
if tnt == nil {
return nil
}
// Checking if the object is managed by a TenantResource, local or global
ref := gvk.ResourceID{
Group: req.Kind.Group,