Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
424af46383
|
|||
|
81529fa35f
|
|||
|
8e8989c576
|
|||
|
27b55d5a7b
|
@@ -21,7 +21,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/time/rate"
|
||||
@@ -161,16 +160,11 @@ func (c *ApplicationController) ensureFinalizers(ctx context.Context, app *v1alp
|
||||
}
|
||||
|
||||
func (c *ApplicationController) reconcileDelete(ctx context.Context, app *v1alpha1.Application) error {
|
||||
pk, err := strconv.ParseInt(app.Status.PK, 10, 32)
|
||||
r, err := c.authentik.CoreApi.CoreApplicationsDestroy(ctx, app.Status.PK).Execute()
|
||||
if err != nil {
|
||||
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.
|
||||
// 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.
|
||||
if r != nil && r.StatusCode != http.StatusNotFound {
|
||||
return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyDestroy`: %w with response %v", err, r)
|
||||
return fmt.Errorf("error when calling `CoreAPI.CoreApplicationsDestroy`: %w with response %v", err, r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +191,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 `ProvidersAPI.ProvidersProxyPartialUpdate`: %w with response %v", err, r)
|
||||
return fmt.Errorf("error when calling `CoreAPI.CoreApplicationsPartialUpdate`: %w with response %v", err, r)
|
||||
}
|
||||
|
||||
app.Status.PK = resp.Pk
|
||||
|
||||
Reference in New Issue
Block a user