Skip to content

Actions fail behind an HTTP proxy: the management token request ignores the model's proxy settings #68

Open

Description

@nsklikas

Context

A Juju model whose only way out of the cluster is an HTTP proxy, given to the models as the controller's juju-http-proxy, juju-https-proxy and juju-no-proxy defaults. tenant-service is related to Hydra over oauth, and Hydra's token endpoint is its public URL. Juju 3.6, the charm at main (abec70c).

Problem

create-tenant fails after about two minutes:

Failed to create tenant: non-zero exit code 1 executing 'tenant-service', stdout='', stderr='Error: failed to create tenant: rpc error: code = Unauthenticated desc = invalid token

and the unit's log has only:

WARNING juju-log Failed to obtain management token

The same happens to every action that runs the CLI with _get_management_token().

  1. The charm asks for its token from the charm container with requests, with no proxy and no timeout (src/clients.py L43-L49). Juju gives the model's proxy settings to the charm as JUJU_CHARM_HTTP_PROXY, JUJU_CHARM_HTTPS_PROXY and JUJU_CHARM_NO_PROXY, which requests does not read. So the request connects directly and waits until the kernel's connect timeout.
  2. _get_management_token() logs a warning and returns None (src/charm.py L717-L736), and the CLI then runs with --token no-token (src/cli.py L361). The action reports invalid token instead of the reason.

get-access-token makes the same request and fails the same way, but it shows the connection error.

The workload is not affected: it gets HTTP_PROXY, HTTPS_PROXY and NO_PROXY from the charm's options.

Steps to reproduce

  1. In a model with juju-https-proxy set and no direct route to Hydra's public URL, deploy tenant-service and relate it to Hydra (oauth), PostgreSQL and Kratos.
  2. juju run tenant-service/0 create-tenant name=test

Expected

The token request goes through the model's proxy (and skips it for the hosts in juju-no-proxy), has a timeout, and when it fails the action fails with the reason.

Possible fix

Give the session the proxies from JUJU_CHARM_HTTP_PROXY, JUJU_CHARM_HTTPS_PROXY and JUJU_CHARM_NO_PROXY, pass a timeout to the request, and let the token error fail the action instead of running the CLI with no-token.

Activity

  1. syncronize-issues-to-jira commented on Oct 16, 2026

    @syncronize-issues-to-jira

    Thank you for reporting your feedback to us!

    The internal ticket has been created: https://warthogs.atlassian.net/browse/IAM-2382.

    This message was autogenerated

  2. added a commit that references this issue on Oct 16, 2026
    744d47c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions