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

Create func test for node/pod (anti-)affinity #1144

Closed
slintes opened this Issue Jun 12, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@slintes
Member

slintes commented Jun 12, 2018

see #1120 (comment) and following

@slintes

This comment has been minimized.

Show comment
Hide comment
@slintes

slintes Jul 3, 2018

Member

Some context: with the mentioned PR we added pod affinity and anti-affinity to VMs. Since a pod is directly related to the virtual machine, this is basically virtual machine affinity / anti-affinity.
Both node and pod affinity still need a functional test. In order to test this, you can e.g. combine both:

  • use 2 nodes
  • start 2 pods:
    • pod 1 has node affinity to node 1
    • pod 2 has node affinity to node 1 AND pod anti-affinity to pod 1: this should result in an unschedulable pod.
    • when you remove node affinity of pod 2, it should be scheduled to node 2
    • or when you change pod anti-affinity to affinity, it should be scheduled to node 1
Member

slintes commented Jul 3, 2018

Some context: with the mentioned PR we added pod affinity and anti-affinity to VMs. Since a pod is directly related to the virtual machine, this is basically virtual machine affinity / anti-affinity.
Both node and pod affinity still need a functional test. In order to test this, you can e.g. combine both:

  • use 2 nodes
  • start 2 pods:
    • pod 1 has node affinity to node 1
    • pod 2 has node affinity to node 1 AND pod anti-affinity to pod 1: this should result in an unschedulable pod.
    • when you remove node affinity of pod 2, it should be scheduled to node 2
    • or when you change pod anti-affinity to affinity, it should be scheduled to node 1
@yanirq

This comment has been minimized.

Show comment
Hide comment
@yanirq

yanirq Jul 8, 2018

Contributor

Note to Developer:

Writing functional tests is an important aspect of the ongoing development.
All tests can be run local without the need of CI. Have a look at the testing section.

Functional tests are located under tests folder in the main src directory.

To grasp the general idea about affinity and anti-affinity see :
Pod affinity and anti-affinity and VM affinity and anti-affinity.

The test cases above can be added to tests/vmlifecycle_test.go, setting pod affinity/anti-affinity rules on a VM and ensures that the VM can start (or shouldn't start) and scheduled on the right node.
Using a node selector could be beneficial for the test (see comment)

Example of how to add Affinity to a VM instance in tests

Contributor

yanirq commented Jul 8, 2018

Note to Developer:

Writing functional tests is an important aspect of the ongoing development.
All tests can be run local without the need of CI. Have a look at the testing section.

Functional tests are located under tests folder in the main src directory.

To grasp the general idea about affinity and anti-affinity see :
Pod affinity and anti-affinity and VM affinity and anti-affinity.

The test cases above can be added to tests/vmlifecycle_test.go, setting pod affinity/anti-affinity rules on a VM and ensures that the VM can start (or shouldn't start) and scheduled on the right node.
Using a node selector could be beneficial for the test (see comment)

Example of how to add Affinity to a VM instance in tests

@fabiand fabiand assigned mhenriks and unassigned mhenriks Jul 18, 2018

@yanirq

This comment has been minimized.

Show comment
Hide comment
@yanirq

yanirq Aug 7, 2018

Contributor

/assign

Contributor

yanirq commented Aug 7, 2018

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment