halyard icon indicating copy to clipboard operation
halyard copied to clipboard

feat(kubernetes) Support Tolerations in Pod spec

Open jgramoll opened this issue 5 years ago • 8 comments

Allow adding:

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

jgramoll avatar Sep 19 '19 17:09 jgramoll

The following commits need their title changed:

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

  • aa0413ead3c75458d45f8c022693631353b7993d: 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.

spinnakerbot avatar Sep 19 '19 17:09 spinnakerbot

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)?

ezimanyi avatar Sep 20 '19 22:09 ezimanyi

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

jgramoll avatar Sep 20 '19 22:09 jgramoll

@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!

ezimanyi avatar Sep 24 '19 20:09 ezimanyi

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?

jgramoll avatar Sep 24 '19 21:09 jgramoll

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.

ezimanyi avatar Sep 24 '19 23:09 ezimanyi

  • I suggest to add the toleration in this list https://www.spinnaker.io/reference/halyard/custom/#kubernetes or add hal command to add toleration to services so we can use in the helm chart (https://github.com/helm/charts/tree/master/stable/spinnaker)and add toleration in the additionalServiceSettings: part like this additionalServiceSettings: clouddriver.yml: kubernetes: toleration: - key: dubizzle.com/group operator: Equal value: application

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

Eslamanwar avatar May 05 '20 20:05 Eslamanwar