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

✨ Conditions for OpenStackMachines #1288

Merged
merged 1 commit into from
Jul 29, 2022
Merged

✨ Conditions for OpenStackMachines #1288

merged 1 commit into from
Jul 29, 2022

Conversation

apricote
Copy link
Member

@apricote apricote commented Jun 30, 2022

What this PR does / why we need it:

Adds Conditions to the OpenStackMachineStatus.

See this example clusterctl describe output, that showcases the different conditions, and how they "bubble up" to the Machine resources:
screenshot-capo-machine-conditions

So far there are two conditions:

  • InstanceReady (related to the OpenStack Instance) and
  • APIServerIngressReadyCondition (for ControlPlane machines -> LoadBalancer Member or Floating IP attachment)

I set the severity based on:

  • Info, if the reason is expected (missing bootstrap secret)
  • Warning, if the condition is eventually retried (no call to handleUpdateMachineError)
  • Error if handleUpdateMachineError was called and the machine is no longer retried/reconciled

The Ready condition is set to the aggregate of thhe two custom conditions, and the CAPI Machine resource "bubbles up" to Ready message, so any errors can be observed easily, without having to inspect the OpenStackMachine

Which issue(s) this PR fixes:
Fixes #832
Replaces #972

Open Tasks:

Open Questions:

Should we add the conditions to all existing api versions (because its a backwards compatible change) or only to the most recent version (v1alpha6)?

  • Pro: Makes conversion a no-op
  • Pro: Changes are backwards compatible
  • Contra: Changing old API versions feels wrong to me

/hold

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 30, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 30, 2022
@netlify
Copy link

netlify bot commented Jun 30, 2022

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit e91d60b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/62e2731de0f85800082c6d19
😎 Deploy Preview https://deploy-preview-1288--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@mdbooth mdbooth self-assigned this Jun 30, 2022
Copy link
Member

@tobiasgiese tobiasgiese left a comment

Choose a reason for hiding this comment

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

Implementing conditions is a really huge improvement, tbh! I like it.
Some nits, but @mdbooth can certainly help better here 🙂

controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
@apricote
Copy link
Member Author

@tobiasgiese Implemented your suggestions and tried to make other messages consistent with them.


General status update:

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 15, 2022
@seanschneeweiss
Copy link
Contributor

This PR is such a great addon for CAPO. Thanks a lot.

Should we add the conditions to all existing api versions (because its a backwards compatible change) or only to the most recent version (v1alpha6)?

I think it is totally fine to add it to the recent version only.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 25, 2022
@apricote apricote marked this pull request as ready for review July 25, 2022 12:26
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 25, 2022
@k8s-ci-robot k8s-ci-robot requested a review from tobiasgiese July 25, 2022 12:26
@apricote
Copy link
Member Author

I rebased the PR against the current main commit. The bug where the APIServerIngressReady condition was added to non-CP machines is fixed now.

The PR is ready for review.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 26, 2022
@apricote
Copy link
Member Author

ERROR: (gcloud.compute.instances.create) Could not fetch resource:

  • The zone 'projects/k8s-boskos-gce-project-12/zones/us-east4-a' does not have enough resources available to fulfill the request. '(resource type:compute)'.

/retest

Copy link
Contributor

@seanschneeweiss seanschneeweiss left a comment

Choose a reason for hiding this comment

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

/lgtm
👍

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

@tobiasgiese tobiasgiese left a comment

Choose a reason for hiding this comment

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

All in all this looks pretty solid 👌🏻
/approve

controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jul 27, 2022
@apricote
Copy link
Member Author

/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 Jul 27, 2022
@apricote
Copy link
Member Author

Tests will be fixed by #1313. I will rebase once that PR is merged.

@apricote apricote requested a review from seanschneeweiss July 29, 2022 13:21
Copy link
Contributor

@seanschneeweiss seanschneeweiss left a comment

Choose a reason for hiding this comment

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

I wonder if the severity of some conditions should be considered as Warning and not as Error. WDYT?

return ctrl.Result{}, nil
case infrav1.InstanceStateDeleted:
// we should avoid further actions for DELETED VM
scope.Logger.Info("Instance state is DELETED, no actions")
conditions.MarkFalse(openStackMachine, infrav1.InstanceReadyCondition, infrav1.InstanceDeletedReason, clusterv1.ConditionSeverityError, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be an expected state, so don't know if we should really considers this error severity.

@seanschneeweiss
Copy link
Contributor

I wonder if the severity of some conditions should be considered as Warning and not as Error. WDYT?

Oh sorry, I guess the severity can be adapted as soon as the handleUpdateMachineError is removed in #1116.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apricote, seanschneeweiss, tobiasgiese

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:
  • OWNERS [seanschneeweiss,tobiasgiese]

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

@tobiasgiese
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit 6859acb into kubernetes-sigs:main Jul 29, 2022
pierreprinetti pushed a commit to shiftstack/cluster-api-provider-openstack that referenced this pull request Apr 22, 2024
IMO we should check wether it is required (machine == control-plane) before
calling `loadbalancer.Service#ReconcileLoadBalancerMember`. The service
should not be concerned with the type of machine it is called on.

This also fixes one of the open bugs in PR kubernetes-sigs#1288.
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement conditions
5 participants