Skip to content

fix: gate RESOURCE_SERVER and local resource management on gateway presence#331

Open
kaiokmo wants to merge 1 commit intomainfrom
fix-default-resource-server-url
Open

fix: gate RESOURCE_SERVER and local resource management on gateway presence#331
kaiokmo wants to merge 1 commit intomainfrom
fix-default-resource-server-url

Conversation

@kaiokmo
Copy link
Member

@kaiokmo kaiokmo commented Mar 24, 2026

EDA server defaults RESOURCE_SERVER__URL to "https://localhost",
which causes default.py to unconditionally override authentication
classes to JWT-only, breaking session-based login for standalone
deployments. This is due to a recent change in EDA server [1] that only
allows authentication through gateway, except when EDA is run in
development mode, which essentially sets RESOURCE_SERVER_URL to None [2]

We now introduce a resource_server_url variable (defaults to empty)
and detect gateway deployments by checking both this variable and the
EDA_RESOURCE_SERVER__URL entry that aap-gateway-operator injects via
extra_settings.

When EDA operator is deployed standalone:

  • EDA_RESOURCE_SERVER__URL is omitted; defaults.py None prevails
  • EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT is set to True
    When EDA is deployed via AAP:
  • EDA_RESOURCE_SERVER__URL is provided by the gateway operator
    extra_settings and rendered in the ConfigMap loop
  • EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT is omitted; defaults to False

The previous version used RESOURCE_SERVER__URL (without EDA_ prefix),
which Dynaconf ignores since it only reads EDA_-prefixed env vars.
It also checked only the operator variable, which gateway operator
never sets, causing ALLOW_LOCAL_RESOURCE_MANAGEMENT to be True
unconditionally, even behind gateway.

[1] ansible/eda-server#1495
[2] https://github.com/ansible/eda-server/blob/9e97dafb06149e5202d98ff1c6d04d2595beb53e/src/aap_eda/settings/development_defaults.py#L25-L26

…esence

EDA server defaults RESOURCE_SERVER__URL to "https://localhost",
which causes default.py to unconditionally override authentication
classes to JWT-only, breaking session-based login for standalone
deployments. This is due to a recent change in EDA server [1] that only
allows authentication through gateway, except when EDA is ran in
development mode, which essentially sets RESOURCE_SERVER_URL to None [2]

We now introduce a `resource_server_url` variable (defaults to empty)
and detect gateway deployments by checking both this variable and the
EDA_RESOURCE_SERVER__URL entry that aap-gateway-operator injects via
extra_settings.

When EDA operator is deployed standalone:
  - EDA_RESOURCE_SERVER__URL is omitted; defaults.py `None` prevails
  - EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT is set to True
When EDA is deployed via AAP:
  - EDA_RESOURCE_SERVER__URL is provided by the gateway operator
    extra_settings and rendered in the ConfigMap loop
  - EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT is omitted; defaults to False

The previous version used RESOURCE_SERVER__URL (without EDA_ prefix),
which Dynaconf ignores since it only reads EDA_-prefixed env vars.
It also checked only the operator variable, which the gateway operator
never sets, causing ALLOW_LOCAL_RESOURCE_MANAGEMENT to be True
unconditionally, even behind gateway.

[1] ansible/eda-server#1495
[2] https://github.com/ansible/eda-server/blob/9e97dafb06149e5202d98ff1c6d04d2595beb53e/src/aap_eda/settings/development_defaults.py#L25-L26
@kaiokmo kaiokmo requested review from dsavineau and mkanoor March 24, 2026 02:36
@sonarqubecloud
Copy link

Comment on lines +40 to +46
{% set _behind_gateway = (resource_server_url | default('') | length > 0) or (extra_settings | default([]) | selectattr('setting', 'equalto', 'EDA_RESOURCE_SERVER__URL') | list | length > 0) %}
{% if resource_server_url | default('') | length > 0 %}
EDA_RESOURCE_SERVER__URL: "{{ resource_server_url }}"
{% endif %}
{% if not _behind_gateway %}
EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT: "True"
{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this logic

we shouldn't have to redefine EDA_RESOURCE_SERVER__URL since it's already injected via extra setting, it doesn't really make sense to have some logic here

for EDA_ALLOW_LOCAL_RESOURCE_MANAGEMENT we can probably just do what we're already doing for all operators and rely on public_base_url instead

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