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 v1beta2 condition to Cluster controller #11364

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:

Which issue(s) this PR fixes:
Rif #11105

@fabriziopandini fabriziopandini added the area/provider/core Issues or PRs related to the core provider label Nov 1, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 1, 2024
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 1, 2024
api/v1beta1/cluster_types.go Outdated Show resolved Hide resolved
api/v1beta1/cluster_types.go Outdated Show resolved Hide resolved
api/v1beta1/cluster_types.go Outdated Show resolved Hide resolved
api/v1beta1/cluster_types.go Outdated Show resolved Hide resolved
api/v1beta1/cluster_types.go Show resolved Hide resolved
internal/controllers/cluster/cluster_controller_status.go Outdated Show resolved Hide resolved
internal/controllers/cluster/cluster_controller_status.go Outdated Show resolved Hide resolved
internal/controllers/cluster/cluster_controller_status.go Outdated Show resolved Hide resolved
// ClusterInfrastructureDeletedV1Beta2Reason surfaces when a referenced infrastructure object has been deleted.
// Note: controllers can't identify if the infrastructure object was deleted by the controller itself, e.g.
// during the deletion workflow, or by a users.
ClusterInfrastructureDeletedV1Beta2Reason = ObjectDeletedV1Beta2Reason
Copy link
Member

@enxebre enxebre Nov 5, 2024

Choose a reason for hiding this comment

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

how is this semantically different from the one above?

Copy link
Member Author

Choose a reason for hiding this comment

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

We use "Deleted" when we know for certain that the object existed at some point, we use "DoesNotExists" when we don't know if it ever existed

ClusterControlPlaneInitializedV1Beta2Condition = "ControlPlaneInitialized"

// ClusterControlPlaneInitializedV1Beta2Reason surfaces when the cluster control plane is initialized.
ClusterControlPlaneInitializedV1Beta2Reason = "Initialized"
Copy link
Member

Choose a reason for hiding this comment

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

have we discussed using "AsExpected" for the happy path?

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 far as I remember, no.
I don't have strong opinions, but now we always use pairs of reasons like Initialized/NotInitialized, ScalingUp/NotScalingUp etc., which IMO is nicely consistent and also accurate and specific to the corresponding.

If we opt in to a generic reason for "all good" we are loosing those properties; also, I'm not sure if we can use it across the board, because e.g. "AsExpected" probably can't be used with conditions like ScalingUp or Remediating

// Note: Stand-alone MachineSets and stand-alone Machines are not included in this condition.
ClusterWorkersAvailableV1Beta2Condition = "WorkersAvailable"

// ClusterWorkersAvailableNoWorkersV1Beta2Reason surfaces when no MachineDeployment and MachinePool exist for the Cluster.
Copy link
Member

Choose a reason for hiding this comment

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

Or they have no replicas?

Copy link
Member Author

Choose a reason for hiding this comment

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

ClusterWorkersAvailableNoWorkersV1Beta2Reason reason is used only of there are no objects to use from inferring workers Available.

If there is at least one MachineDeployment/MachinePool, this condition will aggregate Available condition from those objects, or, if the available conditions is not yet reported by those objects, it will consider available as unknown (and report this).

If you look at this from another angle, WorkersAvailable at cluster level should not look at replicas directly, but it should rely on whatever definition of Available is surfaced by other objects.

internal/contract/types.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

/approve

/assign @enxebre
PTAL :)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Nov 5, 2024
@fabriziopandini
Copy link
Member Author

/hold for squash (keeping commit separated to help @enxebre in his final pass)

@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, 2024
@sbueringer
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 Nov 6, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 664d2f4c90aa3c7d21ce64e1e1c6d217e3a3c3b7

@fabriziopandini fabriziopandini force-pushed the update-v1beta2-status-cluster-controller branch from b96b96e to f766393 Compare November 6, 2024 14:53
@fabriziopandini
Copy link
Member Author

/hold cancel
so we can keep moving on and complete the work on v1beta2 conditions
if @enxebre has some additional feedback, I will take care on a follow up PR

@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 6, 2024
@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: 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-apidiff-main f766393 link false /test pull-cluster-api-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-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot merged commit ec04dcb into kubernetes-sigs:main Nov 6, 2024
15 of 16 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Nov 6, 2024
@fabriziopandini fabriziopandini deleted the update-v1beta2-status-cluster-controller branch November 13, 2024 14:26
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. area/provider/core Issues or PRs related to the core provider 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.

4 participants