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

Backport node anti affinity and node labeling features #1638

Conversation

srm09
Copy link
Contributor

@srm09 srm09 commented Oct 11, 2022

What this PR does / why we need it:
Backport for PRs #1628, #1629, #1641 and part of #1602

Which issue(s) this PR fixes:
Fixes n/a

Special notes for your reviewer:
n/a

Release note:

Node anti affinity and node labeling features

This patch introduces a change to the VSphereClusterStatus by adding a
field that reports the version of the vCenter instance referred by the
VSphereCluster object.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 30e9ea4)
This patch exposes the logic which creates/deletes a cluster module
construct for every cluster-api object responsible for creating new
Machine/VSphereVM/K8s node objects. For each such object, CAPV creates a
cluster module which best effort guarantees anti affinity placement of
VMs belonging to this CAPI object on the ESXi hosts.

This patch introduces a new feature flag which gates the anti affinity
functionality.
The name of the feature flag is `NodeAntiAffinity` and can be set/reset by
setting the `EXP_NODE_ANTI_AFFINITY` to true/false.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 714af1d)
Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 71b4f73)
This patch introduces a new field to the Status of the VSphereVM object
which contains the information of the host that the VM is placed on.
This information is propagated to the VSphereMachine object and then
added to the Machine object as a label with key
node.cluster.x-k8s.io/esxi-host.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit e3c99d5)
The purpose of this controller is to label all the Kubernetes nodes
whose machines have labels prefixed with a specific label prefix.
This functioanlity is being proposed in CAPI, and this controller will
be removed once such functionality exists.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 9967e2d)
This patch introduces a new feature flag which gates the node labeling
functionality. It controls whether the control responsible for labeling
the node objects with special prefixed labels is added to the manager on
startup.
The name of the feature flag is `NodeLabeling` and can be set/reset by
setting the `EXP_NODE_LABELING` to true/false.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 2497cef)
The e2e test checks for the presence of the
node.cluster.x-k8s.io/esxi-host label on the nodes of the workload
cluster and confirms the value of the label with the variable set on the
corresponding VSphereVM object

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 5ef4ef5)
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 11, 2022
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 11, 2022
@yastij
Copy link
Member

yastij commented Oct 11, 2022

/retest

@srm09
Copy link
Contributor Author

srm09 commented Oct 11, 2022

/cc @yastij

This is a subset of the changes in the PR kubernetes-sigs#1602 that was merged in the
main branch. This specifically updates the feature gate import so that
we are not by default exposing the CAPI feature flags on CAPV which are
not usable.
This is needed since node anti affinity and node labeling
functionalities are under separate and 2 new feature flags

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
@srm09 srm09 force-pushed the backport-1.3/node-aaf-and-labeling branch from 021175d to 9c17235 Compare October 11, 2022 17:07
@srm09
Copy link
Contributor Author

srm09 commented Oct 11, 2022

/test pull-cluster-api-provider-vsphere-full-e2e-release-1-3

This patch adds the logic to fall back to the default resource pool, if
no resource pool is specified, during cluster module creation.
It also checks whether the resource pool is owned by a compute cluster
or a standalone host. In case of the owner being a standalone host, a
warning is introduced on the VSphereCluster object and the cluster
creation proceeds.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
(cherry picked from commit 1260057)
@srm09
Copy link
Contributor Author

srm09 commented Oct 12, 2022

/retest
/test pull-cluster-api-provider-vsphere-full-e2e-release-1-3

@yastij
Copy link
Member

yastij commented Oct 12, 2022

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Oct 12, 2022

@srm09: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-vsphere-apidiff-main f54f3c2 link false /test pull-cluster-api-provider-vsphere-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@yastij yastij left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yastij

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2022
@k8s-ci-robot k8s-ci-robot merged commit 289a033 into kubernetes-sigs:release-1.3 Oct 12, 2022
@srm09 srm09 deleted the backport-1.3/node-aaf-and-labeling branch October 12, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants