Skip to content

[Question] Anti affinity rules for function pods without need to create separate Profile for each function #783

Open
@angel-ivanov

Description

@angel-ivanov

Expected Behaviour

Current Behaviour

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

Which Solution Do You Recommend?

Steps to Reproduce (for bugs)

Context

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):

  • Docker version docker version (e.g. Docker 17.0.05 ):

  • What version and distriubtion of Kubernetes are you using? kubectl version

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • Link to your project or a code example to reproduce issue:

  • What network driver are you using and what CIDR? i.e. Weave net / Flannel

First of all, hello everyone!

I am looking for a way to make the function pods get spread evenly across all available k8s nodes. I was looking for information and tinkering with what is available so far, but I don't see a way to implement this functionality without having separate Profile for each function.

Looking in OpenFaas docs, I understood that I need to create a Profile which contains the anti affinity rule, and then I can link the function to this profile with annotation, and then openfaas will put the anti affinity rule from the profile into the deployment spec of the function.

According again to Profiles docs, I think this is somehow done in order to reuse a single profile for multiple functions, based on the function's requirements. Well in my case, if i have 3 node k8s cluster, and I want the function to scale up to 3 pods, then I want each of the function pod to be running on a different node.

Every function has a label with unique ID, and if my tool was creating the k8s deployment, I could simply put this label with it's ID in the anti affinity pod rule, however I cannot set this directly in the function and the only way using a Profile. To me it seems that currently I cannot create a single Profile with such anti affinity rule and then pass it to every function, because every function has unique ID and the anti affinity rules in kubernetes require specifying both the key and value of the label.

I was wondering if anybody from the community here had the same problem to solve and have found solution without having to create a separate profile for each function.

It is my first time creating an issue in order to ask such thing, but since this is not an actual bug, I've skipped the issue template, I hope that's not a problem.

Regards,
Angel!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions