Compare commits

..

4 Commits

Author SHA1 Message Date
t.behrendt 6ad599ce71 docs: update docs
CI / install-dependencies (pull_request) Successful in 25s
CI / image check (pull_request) Successful in 5s
CI / check format (pull_request) Successful in 24s
CI / check lint (pull_request) Successful in 23s
CI / build check (pull_request) Successful in 1m47s
CI / test (pull_request) Successful in 8m37s
2026-05-18 20:48:54 +02:00
t.behrendt a8f58c13ce refactor: consolidate common controller code
CI / image check (pull_request) Successful in 5s
CI / install-dependencies (pull_request) Successful in 6m57s
CI / build check (pull_request) Successful in 24s
CI / check format (pull_request) Successful in 22s
CI / check lint (pull_request) Successful in 22s
CI / test (pull_request) Successful in 2m24s
2026-05-18 20:41:17 +02:00
t.behrendt a1589c8290 feat: add bare policy binding controller 2026-05-18 20:15:58 +02:00
t.behrendt dedee24389 feat: add bare application controller 2026-05-17 19:17:22 +02:00
+10 -4
View File
@@ -21,6 +21,7 @@ import (
"fmt"
"net/http"
"slices"
"strconv"
"time"
"golang.org/x/time/rate"
@@ -160,11 +161,16 @@ func (c *ApplicationController) ensureFinalizers(ctx context.Context, app *v1alp
}
func (c *ApplicationController) reconcileDelete(ctx context.Context, app *v1alpha1.Application) error {
r, err := c.authentik.CoreApi.CoreApplicationsDestroy(ctx, app.Status.PK).Execute()
pk, err := strconv.ParseInt(app.Status.PK, 10, 32)
if err != nil {
// This handles an edge-case, where when the Application on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return.
return fmt.Errorf("error parsing PK: %v", err)
}
r, err := c.authentik.ProvidersApi.ProvidersProxyDestroy(ctx, int32(pk)).Execute()
if err != nil {
// This handles an edge-case, where when the ProxyProvider on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return.
if r != nil && r.StatusCode != http.StatusNotFound {
return fmt.Errorf("error when calling `CoreAPI.CoreApplicationsDestroy`: %w with response %v", err, r)
return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyDestroy`: %w with response %v", err, r)
}
}
@@ -191,7 +197,7 @@ func (c *ApplicationController) reconcileUpdate(ctx context.Context, app *v1alph
}
resp, r, err := c.authentik.CoreApi.CoreApplicationsPartialUpdate(ctx, app.Spec.Slug).PatchedApplicationRequest(*patchedApplicationRequest).Execute()
if err != nil {
return fmt.Errorf("error when calling `CoreAPI.CoreApplicationsPartialUpdate`: %w with response %v", err, r)
return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyPartialUpdate`: %w with response %v", err, r)
}
app.Status.PK = resp.Pk