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(kubernetes) Support Tolerations in Pod spec #1430

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jgramoll
Copy link
Contributor

Allow adding:

kubernetes:
  tolerations:
    - effect: NoSchedule
      key: foobar
      operator: Equal
      value: "true"

jgramoll and others added 2 commits September 19, 2019 10:33
merge from spinnaker/halyard
Allow adding:

kubernetes:
  tolerations:
    - effect: NoSchedule
      key: foobar
      operator: Equal
      value: "true"
@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • fc3bb37: Merge pull request #3 from spinnaker/master

  • aa0413e: feat(kubernetes)

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@jgramoll jgramoll changed the title feat(kubernetes) feat(kubernetes) Support Tolerations in Pod spec Sep 19, 2019
@ezimanyi
Copy link
Contributor

Thanks for the PR! Isn't it already possible to specify tolerations by setting them under deploymentEnvironment after the changes in #1396? Or is the issue that you'd like a way to specify tolerations that apply to all services (rather than have to specify one-by-one which I think you might need to do)?

@jgramoll
Copy link
Contributor Author

So #1396 allowed for specifying tolerations on deploymentEnvironment which applies the toleration to all pods in the deployment.

We only have a taint on one pod (clouddriver) and need to be able to specify the toleration for only that pod. This provides that by updating getTolerations to check for the pod spec before checking the deploymentEnvironment spec

@ezimanyi
Copy link
Contributor

@jgramoll : I think I'm still confused about when you'd want to set this on deploymentEnvironment vs. under kubernetes. It seems like #1396 allows you to set:

deploymentEnvironment:
  tolerations:
    clouddriver: {} // set tolerations here

to specifically set tolerations for clouddriver. If I'm understanding your above comment correctly, that's what you're trying to do---apply a toleration only to the clouddriver pods, but I may be mis-understanding.

The reason I'm asking is that it feels a bit confusing to have two different places to set the tolerations and I want to make sure we're clear about when users should set one vs the other (and document that). Thanks!

@jgramoll
Copy link
Contributor Author

jgramoll commented Sep 24, 2019

I didn't know that deploymentEnvironment could allow tolerations to be set for single service. I thought it had to be

deploymentEnvironment:
  tolerations:
    - effect: NoSchedule
    ...

So my next question is, we currently have

kubernetes:
  nodeSelector:
    kops.k8s.io/instancegroup: clouddriver

but I couldn't get

deploymentEnvironment:
    nodeSelectors:
      clouddriver:
        kops.k8s.io/instancegroup: clouddriver

to work. I would like to have the settings live side by side. Is deploymentEnvironment then the preferred location, and I should try and get node selectors to work for a single service?

@ezimanyi
Copy link
Contributor

I'll caveat that I haven't personally tried to set tolerations myself in deploymentEnvironment but I have set other properties there on a per-microservice basis and the code for tolerations looks to be doing the same thing. So I'm pretty sure that setting tolerations there should work, but definitely let me know if it doesn't.

It looks like nodeSelectors is a field in deploymentEnvironment though it doesn't support being set on a per-microservice basis. Interestingly though, V2 deployments completely ignore the field and just grab the one from kubernetes. We should probably also look in deploymentEnvironment here.

So maybe the answer is to make the deploymentEvironment nodeSelectors work and then you'd be able to define both there? That being said I don't really have a strong opinion about which place is better, and am not sure I fully understand the history, so am fine with either.

@Eslamanwar
Copy link

for now i just can do this :
additionalServiceSettings:
clouddriver.yml:
kubernetes:
nodeSelector:
dubizzle.com/group: application

@Badbond
Copy link

Badbond commented May 27, 2024

We have had similar issues. If you use (derivatives of) the Helm chart @Eslamanwar mentions, there are only two ways to control the K8s settings of Spinnaker services:

  • Through hal CLI commands, which only supports a subset (e.g. component-sizing).
  • Through service-settings YAML files, which only supports a subset of the fields.

Unfortunately in both paths it is not possible to set up tolerations. The same accounts for node affinity. Note, tweaking the deploymentEnvironment of the Halyard config is not possible as this is constructed through the hal CLI commands of the chart.

We now have a hacky workaround using Kyverno mutation policies to modify the K8s resources when the resources are scheduled for modification.

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.

5 participants