Skip to content

Do not create a default Airflow user in the chart - #72209

Open
potiuk wants to merge 2 commits into
apache:mainfrom
potiuk:fix-chart-no-default-admin-user
Open

Do not create a default Airflow user in the chart#72209
potiuk wants to merge 2 commits into
apache:mainfrom
potiuk:fix-chart-no-default-admin-user

Conversation

@potiuk

@potiuk potiuk commented Aug 28, 2026

Copy link
Copy Markdown
Member

The chart ran a create-user job on every install and provisioned a FAB account with a username and password that were the same on every installation:

createUserJob:
  enabled: true
  defaultUser:
    role: Admin
    username: admin
    password: admin

Anything able to reach the API server could sign in with the Admin role. That is not narrow by default: networkPolicies.enabled is false, so every workload in the cluster can reach the service, and the documented ingress path widens it further.

What changed

createUserJob is now disabled by default, and the chart ships no default username or password.

Enabling the job without setting both fails the render, naming the two values and the alternative, rather than falling back to an account whose credentials are public knowledge:

createUserJob.enabled is true but createUserJob.defaultUser.username and/or
createUserJob.defaultUser.password are not set. Set both to credentials of your own,
or leave createUserJob.enabled false and create the user yourself with
`airflow users create`.

Generating a random password instead was considered and rejected: it keeps a default account in existence and only makes its credential harder to guess. Not creating the account removes the class of problem, and matches how the chart already treats other opt-in components.

NOTES.txt no longer prints the password after install. It prints the username when the job ran, and the airflow users create invocation when it did not — advertising the credential was part of the same problem.

Behaviour

Invocation Result
default renders; no user created
--set createUserJob.enabled=true fails, with the message above
enabled=true + password only fails
enabled=true + username and password renders

helm lint clean; Celery, Kubernetes and Local executors all render.

Tests

Tests covering the job opt in the way a deployment would. The job's own test module renders through a wrapper that supplies admin/admin and lets each test's own values win over it, so the opt-in is stated once and is self-explanatory. The other four affected files carry the credentials inside their existing createUserJob values.

Worth noting for review: adding a second "createUserJob" key to those dicts is not equivalent — Python keeps the last one, which silently discards the test's own serviceAccount setup and leaves the test passing while no longer testing what it was written to test. The credentials are merged into the existing keys for that reason.

Docs

  • production-guide.rst gains a Creating the first user section covering both routes, and recommends supplying the password from a Kubernetes Secret rather than values.yaml, since values files are frequently committed.
  • A significant newsfragment records the behaviour change and the migration path.
  • values.schema.json default for enabled corrected to false.

🤖 Generated with Claude Code

@potiuk
potiuk force-pushed the fix-chart-no-default-admin-user branch 2 times, most recently from f971878 to 84737b9 Compare August 28, 2026 17:55
potiuk added 2 commits August 28, 2026 20:09
The create-user job ran on every install and provisioned a FAB 'admin' account
with the password 'admin'. Those credentials were the same on every
installation, so anything able to reach the API server could sign in with the
Admin role - by default any workload in the cluster, since networkPolicies are
off.

createUserJob is now disabled by default, and the chart ships no default
username or password. Enabling the job without setting both fails the render
with a message naming the two values, rather than falling back to an account
whose credentials are public knowledge. NOTES.txt no longer prints the password
after install; it prints the username when the job ran, and the 'airflow users
create' invocation when it did not.

Tests that cover the job opt in the way a deployment would. The job's own test
module renders through a wrapper that supplies admin/admin and lets each test's
values win over it; the other four files carry the credentials in their existing
createUserJob values.

Adds a production-guide section on creating the first user, and a significant
newsfragment for the behaviour change.
The chart no longer creates a user, but the Kubernetes system tests still
authenticate as admin/admin and skaffold dev-mode still expects a UI login,
so both deployments now ask for that account explicitly instead of relying
on a chart default that is gone. The schema's username and password
defaults were left behind at the old values and disagreed with values.yaml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant