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

feat(scheduling): per-Deployment k8s scheduling options #223

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Nov 29, 2024

Related to #220

To test:

  1. helm install cryostat ./charts/cryostat and ensure everything comes up as usual
  2. If you have a multi-node cluster for testing, try setting different nodeSelector, tolerations, and affinity settings introduced by this PR. Else, just verify that the k8s resource manifests look as expected.

@andrewazores andrewazores added feat New feature or request safe-to-test labels Nov 29, 2024
@andrewazores andrewazores requested a review from a team November 29, 2024 18:33
@andrewazores andrewazores changed the title feat(nodeselector): per-Deployment node selectors feat(scheduling): per-Deployment k8s scheduling options Nov 29, 2024
Comment on lines 249 to 250
## @param grafana.affinity [object] Affinity for the Grafana Pod. See: [Affinity](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)
affinity: {}
Copy link
Member

Choose a reason for hiding this comment

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

This is unused as Grafana and Datasource are in the same pod with Cryostat?

@@ -267,6 +277,8 @@ datasource:
nodeSelector: {}
## @param datasource.tolerations [array] Tolerations for the JFR Datasource Pod. See: [Tolerations](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)
tolerations: []
## @param datasource.affinity [object] Affinity for the JFR Datasource Pod. See: [Affinity](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)
affinity: {}
Copy link
Member

Choose a reason for hiding this comment

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

Same here?

Comment on lines +407 to 408
## @param affinity [object] default Affinity for the various Pods. See: [Affinity](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)
affinity: {}
Copy link
Member

Choose a reason for hiding this comment

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

Would it be a better choice that this field represents common affinity specs for managed pods? Then, each pod can overwrite them as needed. This seems a bit more intuitive to me, considering SecurityContext, where container level specs overwrite pod level ones, where possible.

However, this means we need to figure a way to do a strategic merge on this field :( Not sure how that can be done currently.

A simpler way, I suppose, is to remove this field? Since we don't have such default options for tolerations, nodeSelectors. We can just remove this and let the users define their own?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are also default options for tolerations and nodeSelectors now, just a few lines above this one. Each of these is only used if there is no pod-specific attribute provided - there is no merge strategy, each Pod will try to use its specific setting, and if there is none then use these global defaults.

Copy link
Member

@tthvo tthvo Dec 2, 2024

Choose a reason for hiding this comment

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

Ahh, right opps, Sorry, not sure why I didn't see them :D

Also, considering #222, which defines top-level field and behaves like a set of common annotations, I am wondering if it would be better to have this PR behave the same? Or adjust #222 to behave as in this PR?

Otherwise, I guess it's okayy since they are different specs :D what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I figured it made sense for annotations to get merged together since they are really just some kind of metadata tagging on the resources, so it makes sense that the annotation attributes are probably shared between things, even if they have their own specific values to add on top, or overrides to apply.

Things like affinities (or anything that relates to node scheduling) seem like if there is a specific configuration required, then it is probably not something that is intended to be merged or shared with others. So the default setting is there to allow for customizing things to ensure that all of Cryostat gets scheduled together onto one node, but if there are any more specific settings then those are probably being applied to cause the scheduler to put it on a different node.

So I think it makes sense either for these specs to behave differently, or else #222 should work like this one (replace, not merge). This one should not work like #222 IMO.

Copy link
Member

@tthvo tthvo Dec 17, 2024

Choose a reason for hiding this comment

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

Oh right, that makes sense! In that case, the current way fits better! I think #222 won't have to be adjusted as it seems to be the common practice to merge metadata. As long as it is well-documented, there won't be any issue^^

Thanks for the explanations! This sort of design situation bugs me at times :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants