Skip to content
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

Initial stab at adding TSC support to task_proc #220

Merged
merged 4 commits into from
Oct 28, 2024
Merged

Conversation

nemacysts
Copy link
Member

This should help Karpenter spread things out.

This should help Karpenter spread things out.
@@ -88,3 +88,10 @@ class PodEvent(TypedDict):
object: V1Pod
# this is just the dict-ified version of object - but it's too big to type here
raw_object: Dict[str, Any]


class TopologySpreadContraint(TypedDict):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to create a local class since it exists in k8s lib?
I am asking because TSC will be changed in next(ish) release.
e.g. nodeAffinityPolicy, nodeTaintsPolicy, matchLabelKeys, minDomains

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for the typing task_proc task_config data: we get data as dicts and then later translate them to k8s objects

@nemacysts
Copy link
Member Author

I tested this with a local tron using with something like

                topology_spread_constraints=[
                    {
                        "max_skew": 1,
                        "topology_key": "topology.kubernetes.io/zone",
                        "when_unsatisfiable": "ScheduleAnyway",
                        "label_selector": {
                            "app.kubernetes.io/managed-by": "tron",
                        },
                    },
                ],

and pods were correctly spun up with

  topologySpreadConstraints:
  - labelSelector:
      matchLabels:
        app.kubernetes.io/managed-by: tron
    maxSkew: 1
    topologyKey: topology.kubernetes.io/zone
    whenUnsatisfiable: ScheduleAnyway

in their pod specs (and I saw pods launch across multiple AZs)

@nemacysts nemacysts marked this pull request as ready for review October 21, 2024 21:45
task_processing/plugins/kubernetes/utils.py Outdated Show resolved Hide resolved
Co-authored-by: Jen Patague <jfong@yelp.com>
@nemacysts nemacysts requested a review from jfongatyelp October 25, 2024 14:02
@nemacysts nemacysts merged commit 65c7f95 into master Oct 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants