Repository navigation
Conversation
84737b9 to
cfa0468
Compare
| from chart_utils.helm_template_generator import render_chart as _render_chart | ||
|
|
||
|
|
||
| def _deep_merge(base: dict, override: dict) -> dict: |
There was a problem hiding this comment.
I would prefer modifying the tests instead of adding logic to handle the change. Going in that direction, maintenance of the tests will get harder and harder.
There was a problem hiding this comment.
I'll meet you most of the way, though for a reason slightly different from the one you gave.
The concrete problem with the wrapper wasn't maintenance, it was that it made a test name false: test_should_run_by_default asserted the job renders, while the whole point of the change is that it does not render by default. It passed only because the helper silently switched the job on. A reader who trusts the name comes away with the wrong idea about the chart.
What I wanted to avoid is pasting the same four lines of opt-in into thirty tests, which has its own maintenance cost — and a fixture would need touching every signature while staying just as implicit. So instead of hiding the opt-in, I stopped shadowing it: the imported render_chart keeps its own name, the helper is now render_chart_with_user_job, and every call site says which one it means. The two tests that are about the job being off call the plain one. test_should_run_by_default is now test_should_run_when_enabled_with_credentials, and a new test_should_not_create_job_by_default renders the chart untouched.
Pushed as bd51cf35a4. Reasonable?
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
There was a problem hiding this comment.
There is no commit like that.
There was a problem hiding this comment.
Sorry, my mistake — the SHA in my reply was from before a rebase. The change is 56ea433358 ("Make the create-user-job test opt-in explicit and trim the docs") on the current branch: render_chart_with_user_job is the explicit opt-in helper, the plain render_chart is used where the test is about the job being off, and test_should_not_create_job_by_default renders the chart untouched.
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
There was a problem hiding this comment.
What I wanted to avoid is pasting the same four lines of opt-in into thirty tests, which has its own maintenance cost
I understand and support that. What I don't agree with is how it was done. We don't need the whole _deep_merge function here, which is pretty nice, but is far too complicated IMHO for what we need here. Despite 2/3 tests, we can create a static variable with config and add it directly in values={**static_value, ...}, and for the remaining tests, do something similar, just slightly differently.
bd51cf3 to
d17f52c
Compare
|
Rebased onto current All six review points are addressed, four of them exactly as suggested — the production-guide wording and the security note were taken verbatim, and both Two I partly pushed back on, and those replies are still open for you to agree or not:
The test wrapper is gone rather than argued for: Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
Miretpl
left a comment
There was a problem hiding this comment.
One small thing + 2 comments from iteration before with ongoing discussion.
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.
The test helper shadowed the imported render_chart, so a test could be named for the chart's default while asserting the opposite of it - test_should_run_by_default passed only because the helper silently switched the job on. Naming the helper for what it does puts the opt-in back in front of the reader at every call site, and the default is now covered by a test that renders the chart untouched. In the production guide, showing how to create a FAB user reads as endorsing FAB as the production path, which it is not; the surrounding prose also narrated the old behaviour at more length than an operator needs to understand why the default changed. Generated-by: Claude Opus 5
The history of the old admin/admin default belongs in the release notes, not in the chart values. Generated-by: Claude Opus 5
d17f52c to
79d74ff
Compare
|
@Miretpl @jedcunningham — all review suggestions are addressed (last push 2026-10-04). Could you take another look and re-review when you have a moment? |
| from chart_utils.helm_template_generator import render_chart as _render_chart | ||
|
|
||
|
|
||
| def _deep_merge(base: dict, override: dict) -> dict: |
There was a problem hiding this comment.
What I wanted to avoid is pasting the same four lines of opt-in into thirty tests, which has its own maintenance cost
I understand and support that. What I don't agree with is how it was done. We don't need the whole _deep_merge function here, which is pretty nice, but is far too complicated IMHO for what we need here. Despite 2/3 tests, we can create a static variable with config and add it directly in values={**static_value, ...}, and for the remaining tests, do something similar, just slightly differently.
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:
Anything able to reach the API server could sign in with the Admin role. That is not narrow by default:
networkPolicies.enabledisfalse, so every workload in the cluster can reach the service, and the documented ingress path widens it further.What changed
createUserJobis 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:
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.txtno longer prints the password after install. It prints the username when the job ran, and theairflow users createinvocation when it did not — advertising the credential was part of the same problem.Behaviour
--set createUserJob.enabled=trueenabled=true+ password onlyenabled=true+ username and passwordhelm lintclean; 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/adminand 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 existingcreateUserJobvalues.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 ownserviceAccountsetup 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.rstgains a Creating the first user section covering both routes, and recommends supplying the password from a Kubernetes Secret rather thanvalues.yaml, since values files are frequently committed.significantnewsfragment records the behaviour change and the migration path.values.schema.jsondefault forenabledcorrected tofalse.🤖 Generated with Claude Code