Skip to content

outposts: Fix infinite self-recursion in traefik reconciler.#6336

Merged
BeryJu merged 1 commit intogoauthentik:mainfrom
ruifung:fix-traefik-controller-infinite-recursion
Jul 24, 2023
Merged

outposts: Fix infinite self-recursion in traefik reconciler.#6336
BeryJu merged 1 commit intogoauthentik:mainfrom
ruifung:fix-traefik-controller-infinite-recursion

Conversation

@ruifung
Copy link
Contributor

@ruifung ruifung commented Jul 23, 2023

Details

  • Fixes an infinite self recursion in the traefik middleware reconciler due to the facade class forwarding method calls to itself.
  • Due to this issue, at present, it fails to create traefik middleware resources.
  • This appears to have been introduced with providers/proxy: add support for traefik.io API and CRD #5801
Task outpost_controller encountered an error: Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 760, in __protected_call__
    return self.run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/outposts/tasks.py", line 151, in outpost_controller
    logs = getattr(controller, f"{action}_with_logs")()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/outposts/controllers/kubernetes.py", line 92, in up_with_logs
    reconciler.up()
  File "/authentik/outposts/controllers/k8s/base.py", line 65, in up
    reference = self.get_reference_object()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/providers/proxy/controllers/k8s/traefik.py", line 28, in get_reference_object
    return self.get_reference_object()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/providers/proxy/controllers/k8s/traefik.py", line 28, in get_reference_object
    return self.get_reference_object()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/providers/proxy/controllers/k8s/traefik.py", line 28, in get_reference_object
    return self.get_reference_object()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 956 more times]
builtins.RecursionError: maximum recursion depth exceeded

Changes

Change the TraefikMiddlewareReconciler to properly forward all method calls to the wrapped reconciler instance.

New Features

N/A

Breaking Changes

N/A

Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)
  • The translation files have been updated (make i18n-extract)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@ruifung ruifung requested a review from a team as a code owner July 23, 2023 04:19
@ruifung ruifung requested review from smusali and removed request for a team July 23, 2023 04:19
@netlify
Copy link

netlify bot commented Jul 23, 2023

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit 330c624
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/64bcaa3cec74800008bb7784

@ruifung
Copy link
Contributor Author

ruifung commented Jul 23, 2023

@BeryJu Mind taking a look at this since you did #5801? Thanks.

@BeryJu BeryJu changed the title Fix infinite self-recursion in traefik reconciler. outposts: Fix infinite self-recursion in traefik reconciler. Jul 24, 2023
@BeryJu BeryJu enabled auto-merge (squash) July 24, 2023 10:14
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.15 ⚠️

Comparison is base (d435a65) 92.50% compared to head (330c624) 92.34%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6336      +/-   ##
==========================================
- Coverage   92.50%   92.34%   -0.15%     
==========================================
  Files         560      560              
  Lines       26993    26993              
==========================================
- Hits        24967    24925      -42     
- Misses       2026     2068      +42     
Flag Coverage Δ
e2e 50.81% <0.00%> (-0.90%) ⬇️
integration 26.53% <0.00%> (ø)
unit 89.29% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...thentik/providers/proxy/controllers/k8s/traefik.py 78.58% <0.00%> (ø)

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@BeryJu BeryJu merged commit 346c6e6 into goauthentik:main Jul 24, 2023
@ruifung ruifung deleted the fix-traefik-controller-infinite-recursion branch July 24, 2023 12:41
kensternberg-authentik added a commit that referenced this pull request Jul 24, 2023
* main:
  web/admin: hide pagination when no data is loaded yet (#6353)
  web/admin: adjust style of page header (#6355)
  root: set csrf cookie's secure flag same as session (#6350)
  outposts: Fix infinite self-recursion in traefik reconciler. (#6336)
  outposts: fix patch processing (#6338)
  web: bump API Client version (#6351)
  Updates for file web/xliff/en.xlf in zh_CN on branch main (#6340)
  Updates for file web/xliff/en.xlf in zh-Hans on branch main (#6341)
  enterprise: fix license check not using DER as spec specifies (#6348)
  core: bump goauthentik.io/api/v3 from 3.2023061.3 to 3.2023061.4 (#6342)
  core: bump drf-spectacular from 0.26.3 to 0.26.4 (#6343)
  core: bump ruff from 0.0.278 to 0.0.280 (#6344)
  website: bump postcss from 8.4.26 to 8.4.27 in /website (#6345)
  web: bump @esbuild/linux-arm64 from 0.18.15 to 0.18.16 in /web (#6347)
  web: bump @esbuild/darwin-arm64 from 0.18.15 to 0.18.16 in /web (#6346)
  outposts: support json patch for Kubernetes (#6319)
  providers/oauth2: fix grant_type password raising an exception (#6333)
  web: bump API Client version (#6331)
  enterprise: cleanup v2 (#6330)
  web: bump prettier from 2.8.8 to 3.0.0 in /web (#6329)
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.

2 participants