[Helm-Chart] BugFix: Wrong broker URL secret ref#65006
[Helm-Chart] BugFix: Wrong broker URL secret ref#65006Desdroid wants to merge 4 commits intoapache:mainfrom
Conversation
|
A Workaround for this bug is this config: # Workaround until https://github.com/apache/airflow/pull/65006 gets merged
enableBuiltInSecretEnvVars:
AIRFLOW__CELERY__BROKER_URL: false
extraEnv: |
- name: AIRFLOW__CELERY__BROKER_URL
valueFrom:
secretKeyRef:
name: '{{ include "airflow.fullname" . }}-broker-url'
key: connection |
e0d9990 to
94b06b0
Compare
|
On a side note #52953 So we ended up with uninstalling the entire helm chart release and doing a fresh install, while retaining the persistent volumes of db etc. |
Miretpl
left a comment
There was a problem hiding this comment.
Good catch! Could you add a test case for?
chart/templates/_helpers.yaml
Outdated
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ default (printf "%s-broker-url" .Release.Name) .Values.data.brokerUrlSecretName }} | ||
| name: {{ default (printf "%s-broker-url" (include "airflow.fullname" .)) .Values.data.brokerUrlSecretName }} |
There was a problem hiding this comment.
It would be good to do a template and use it in a proper secret file (also for consistency matter with other secrets).
There was a problem hiding this comment.
There are no tests for using the chart as a dependency. However this bug has 2 prerequisites:
useStandardNaming: true and having fullnameOverride != Release.Name, nameOverride != Release.Name or use the airflow helm chart as a dependency.
So i added a test for the fullnameOverride case. If you want a different test case, let me know.
There was a problem hiding this comment.
I was thinking more about the name matches test between the given secret and the environment variable. I think that this issue is not chart dependency specific, but is affecting any setup where .Relase.Name != airflow.fullname which is possible to do by using different configuration options.
I think it was just missed before the release that it can, potentially, break some stuff. Sorry for the inconvenience and thanks for the PR!
I think some extension to the |
94b06b0 to
a80eb32
Compare
Sure 😃 I think that also
I added a newsfragment and also included a possible workaround, though I'm not 100% sure that the workaround is correct. I'll try to test with our installation. |
Dang, it's not everything. Since there is also the change in the service name of the statefulset as I said previously and also the ingress can't be replaced if it is used. Tried to use |
a80eb32 to
16baa83
Compare
| ``fernet-key``, ``redis-password`` and ``broker-url`` secrets migrated to use standard naming as well as some other K8s resources. | ||
|
|
||
| This likely breaks existing installations with ``useStandardNaming=True`` that have a ``fullnameOverride != Release.Name``, ``nameOverride != Release.Name`` or use the airflow helm chart as a dependency. |
There was a problem hiding this comment.
This newsfragment appears to overstate the scope of the change: it says fernet-key and redis-password secrets (and "some other K8s resources") were migrated to standard naming, but the PR changes shown are specifically about the broker URL secret reference (secretKeyRef name) matching airflow.fullname. Please rewrite this fragment to describe the actual behavior change (fixing broker URL secret name resolution when useStandardNaming/fullnameOverride cause airflow.fullname != .Release.Name) and only call out breaking behavior if there is a confirmed upgrade impact.
| ``fernet-key``, ``redis-password`` and ``broker-url`` secrets migrated to use standard naming as well as some other K8s resources. | |
| This likely breaks existing installations with ``useStandardNaming=True`` that have a ``fullnameOverride != Release.Name``, ``nameOverride != Release.Name`` or use the airflow helm chart as a dependency. | |
| Fixed broker URL secret name resolution to use ``airflow.fullname`` consistently. | |
| This fixes deployments where ``useStandardNaming=True`` and ``airflow.fullname != .Release.Name``, for example when using ``fullnameOverride``, ``nameOverride``, or the Airflow Helm chart as a dependency. |
There was a problem hiding this comment.
I somewhat agree with this. My change is only a bugfix not a breaking change.
If we include this newsfragment now, it looks like the change is only in there since the next release, which simply is wrong and misleading for users.
But in fact it's been changed since v.1.19 - so imo the release notes there should be adapted and the newsfragment here be removed.
@Miretpl @jscheffl What do you think?
There was a problem hiding this comment.
Not sure if we are doing something like that - updating documentation back. I recall that it happened in the past, but it was like 1 or 2 times (at least since I'm following Airflow, which is a couple of years already). Updating release notes for 1.19 would be the best, and here, we have only the fix-related info, but if an update of the past will not be possible, I think it would be good to inform users 2 releases later than not at all.
There was a problem hiding this comment.
I'm fine with whatever you decide.
Good catch!
I went through all of the doc, and I haven't found any information regarding the old setup. So I would say that we are good with the doc, and newsfragment should be sufficient. |
16baa83 to
f76065d
Compare
f76065d to
cf8df62
Compare
|
Anything still needed to get this merged ? |
If the helm chart creates the secret for the broker URL it uses the template
{{ include "airflow.fullname" . }}-broker-url- see SourceHowever the default airflow env variables use a different template, just using the Release.
{{ default (printf "%s-broker-url" .Release.Name) .Values.data.brokerUrlSecretName }}see SourceThis is fatal as soon as someone uses the original chart as a dependency, so that
airflow-fullname != Release.Nameresulting in wrong secret key references and therefore a failed deployment due toInit:CreateContainerConfigError.It is broken since eabe6b8 -> since v1.19. We hit it today while upgrading from 1.18 -> 1.20
This PR fixes this issue.
Please note, that I saw that the secrets are all not using the secrets names as set in the helpers, so that the name is duplicated.
https://github.com/apache/airflow/blob/main/chart/templates/_helpers.yaml#L406-L480 and following lines.
If it is desired I could use the helper templates also to set the name of the secrets in the secrets dir. This could be done in another PR ofc.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.