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

Add KCP conditions, split reconcileHealth into preflight and reconcileEtcdMembers, make both use conditions #3900

Merged

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR adds KCP specific conditions to KCP itself and to machines providing visibility in:

  • the status of control plane components/static pods generated by kubeadm
  • the status of etcd members

The initial PR attempt was based on the idea of assigning to reconcileHealth the additional responsibility of computing conditions, however, after discovering a few problems during tests it was decided to propose a bigger refactor that

  • assigns the responsibility of upgrading conditions to a new reconcileControlPlaneConditions func and to workloadcluster.UpdateStaticPodConditions and workloadcluster.UpdateEtcdConditions
  • replaces reconcileHealth with preflightChecks, now based on conditions state.
  • introduces reconcileEtcdMembers, for taking care of etcd members without machines (before this was improperly implemented in reconcileHealth

Which issue(s) this PR fixes:
Fixes #3138
Fixes #3862
Fixes #3861
Fixes #3875

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 3, 2020
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 3, 2020
@fabriziopandini
Copy link
Member Author

/milestone v0.3.11

@fabriziopandini
Copy link
Member Author

/pull-cluster-api-e2e-full-release-0-3

Copy link

@sedefsavas sedefsavas left a comment

Choose a reason for hiding this comment

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

Code is much more cleaner and readable. Thanks for doing this big refactoring @fabriziopandini

Have a few comments, nothing important in terms of logic.
I will continue reviewing worload_cluster_conditions.go.

controlplane/kubeadm/api/v1alpha3/condition_consts.go Outdated Show resolved Hide resolved
controlplane/kubeadm/api/v1alpha3/condition_consts.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/scale.go Show resolved Hide resolved
controlplane/kubeadm/controllers/scale.go Outdated Show resolved Hide resolved
@sedefsavas
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2020
@vincepri
Copy link
Member

vincepri commented Nov 5, 2020

Now reviewing this PR

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2020
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

I'm ~80% of the way to finish the review, although I'd like to get these comments out there first and then proceed.

Let's also please change the title of this PR with something more descriptive. There way lots of changes included and it'd be great to capture them in the release notes.

controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
controlplane/kubeadm/controllers/controller.go Outdated Show resolved Hide resolved
Comment on lines 483 to 484
workloadCluster.UpdateStaticPodConditions(ctx, controlPlane.KCP, controlPlane.Machines.UnsortedList())
workloadCluster.UpdateEtcdConditions(ctx, controlPlane.KCP, controlPlane.Machines.UnsortedList())
Copy link
Member

Choose a reason for hiding this comment

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

Why are these methods on workload cluster? Aren't the conditions updated on the KCP object?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, condition are set on machines and KCP objects, but conditions are based on the observation of the workload cluster.
Also, we are using several workloadcluster internals link getControlPlaneNodes, etcdClientGenerator and moving this code somewhere else will requires to make that method public, but if you think this makes sense I can move this under controllers conditions.go

Copy link
Member

Choose a reason for hiding this comment

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

Let's open an issue to cleanup all these structs, they're really confusing

Copy link
Member Author

Choose a reason for hiding this comment

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

As per https://kubernetes.slack.com/archives/C8TSNPY4T/p1604601792219100, I will open an issue so we can reconsider this in v1alpha4

controlplane/kubeadm/internal/workload_cluster.go Outdated Show resolved Hide resolved
@fabriziopandini
Copy link
Member Author

/retitle Add KCP conditions, split reconcileHealth into preflight and reconcileEtcdMembers, make both use conditions

@k8s-ci-robot k8s-ci-robot changed the title 🌱 KCP conditions Add KCP conditions, split reconcileHealth into preflight and reconcileEtcdMembers, make both use conditions Nov 5, 2020
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2020
@vincepri
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 10, 2020
Copy link
Member

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

@fabriziopandini
Copy link
Member Author

/pull-cluster-api-e2e-full-release-0-3

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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

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
4 participants