-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for worker persistence with KEDA v2.0.0 in helm chart #13209
Conversation
5c3b003
to
2c8fc60
Compare
2d1191c
to
7480a7b
Compare
7480a7b
to
1e15128
Compare
@mik-laj following your comment here #13183 (comment) i added a mechanism for validating CRD objects i enabled schema validation for the keda scaledojbect, and also removed the option to disable schema validation since it's no longer necessary |
75fcd02
to
3e8525d
Compare
The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason. |
3e8525d
to
9576585
Compare
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
ba0e1cb
to
8df0757
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstandish Minor fix requested in README
Can you do a rebase? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Great -- will do |
8df0757
to
0fa8bc5
Compare
@@ -24,27 +24,23 @@ KEDA stands for Kubernetes Event Driven Autoscaling. | |||
`KEDA <https://github.com/kedacore/keda>`__ is a custom controller that | |||
allows users to create custom bindings to the Kubernetes `Horizontal Pod | |||
Autoscaler <https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/>`__. | |||
We have built scalers that allows users to create scalers based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i removed this sentence because if i recall correctly the "we" is astronomer, so in this repo it doesn't really have the same meaning and i don't think the statement belongs. but it's also sortof beside the point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly it was me and Daniel, so not only Astronomer. Also Airflow is on KEDA users page. But I agree that it creates not value here.
@@ -61,7 +88,7 @@ def validate_k8s_object(instance): | |||
validate.validate(instance) | |||
|
|||
|
|||
def render_chart(name="RELEASE-NAME", values=None, show_only=None, validate_schema=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate_schema
was added recently to allow tests for CRDs but with this PR we have a way of pulling in the definition.
it does require a network call here fwiw: https://github.com/apache/airflow/pull/13209/files#diff-91361141bde70cbfc90142ebe2377ce918025d3343d9216e00e50c66f083b12cR65
pollingInterval: {{ .Values.workers.keda.pollingInterval }} # Optional. Default: 30 seconds | ||
cooldownPeriod: {{ .Values.workers.keda.cooldownPeriod }} # Optional. Default: 300 seconds | ||
maxReplicaCount: {{ .Values.workers.keda.maxReplicaCount }} # Optional. Default: 100 | ||
triggers: | ||
- type: postgresql | ||
metadata: | ||
targetQueryValue: "1" | ||
connection: AIRFLOW_CONN_AIRFLOW_DB | ||
query: "SELECT ceil(COUNT(*)::decimal / {{ .Values.config.celery.worker_concurrency }}) FROM task_instance WHERE state='running' OR state='queued'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while updating connectionFromEnv
just decided to make this a bit more readable by splitting onto separate lines
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease. |
063d9ae
to
cc33c3e
Compare
@mik-laj do you want to have another look post-rebase? Also what is the convention for committer-authors? Should the author merge it themselves after there is approval or is it expected that you wait for the reviewer to merge? Thank you 🙏 |
Generally we can merge our selves after a review. Use your judgment if you need a re-review. |
OK in that case since the rebase was just about docs and nothing materially changed i'll go ahead and merge. Thanks all |
cc33c3e
to
b4f61d8
Compare
forgot to push fixup adding |
KEDA 2.0.0 introduces support for StatefulSets, so we can now remove the constraint that worker persistence must be disabled.
b4f61d8
to
3c814cf
Compare
@mik-laj @ianstanton after taking another look at this i thought that adding the namedtuple in this case was maybe a little overkill / confusing because the elements are never accessed it's just a way constructing a key in the dict for the URL lookup, given the two components -- api version and kind. can you please take a look and let me know what you think of this perhaps simpler (though less explicit) alternative. and maybe you have a better suggestion. crd_lookup = {
'keda.sh/v1alpha1::ScaledObject': 'https://raw.githubusercontent.com/kedacore/keda/v2.0.0/config/crd/bases/keda.sh_scaledobjects.yaml',
}
...
def get_schema_crd(api_version, kind):
url = crd_lookup.get(f"{api_version}::{kind}")
if not url:
return None
response = requests.get(url)
yaml_schema = response.content.decode('utf-8')
schema = yaml.safe_load(StringIO(yaml_schema))
return schema so i'm just joining the two components with i'm gonna just go ahead and add this in a second commit and request review and go from there |
@@ -31,9 +32,12 @@ | |||
|
|||
BASE_URL_SPEC = "https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.14.0" | |||
|
|||
crd_lookup = { | |||
'keda.sh/v1alpha1::ScaledObject': 'https://raw.githubusercontent.com/kedacore/keda/v2.0.0/config/crd/bases/keda.sh_scaledobjects.yaml', # noqa: E501 # pylint: disable=line-too-long | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above concatenation of api version and kind in this way, keda.sh/v1alpha1::ScaledObject is a made-up syntax that only serves to provide a simple way to look up the url for a particular combination of api version + kind for CRDs
it is only referenced in one place:
url = crd_lookup.get(f"{api_version}::{kind}") |
@dstandish this approach seems acceptable to me 👍 |
Yup that is true, currently we don't need to put anything in Updating.md |
…ache/airflow#13209) * Upgrade KEDA to v2.0.0 and add support for worker persistence KEDA 2.0.0 introduces support for StatefulSets, so we can now remove the constraint that worker persistence must be disabled. Co-authored-by: Daniel Standish <[email protected]> Partial Commit Extracted From: https://github.com/apache/airflow
Hi, sorry for commenting an old PR. I see here https://github.com/apache/airflow/blob/main/chart/values.yaml#LL501C4-L501C15 there is still a comment as far as I understand from this PR, the comment is a leftover (since this PR), right? |
Here we upgrade keda to v2.0.0 in helm chart update the docs since things have changed a bit.
Notably, since 2.0.0 adds support for statefulsets, the ScaledObject definition is updated to add support for the case where
workers.persistence.enabled=True
.