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

Added checking for MachineDeployments availability to update ManagedCluster status #546

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

slysunkin
Copy link
Contributor

@slysunkin slysunkin commented Oct 23, 2024

Description

Fixing #379
Added checking for MachineDeployments availability to update ManagedCluster status.

How it works:

When cluster deployment is just initialized.
From clusterctl perspective:

NAME                                                         READY  SEVERITY  REASON                                     SINCE  MESSAGE                                                                              
Cluster/eks-dev-slava-1                                      False  Info      WaitingForControlPlane                     118s                                                                                          
│           ├─ControlPlaneInitialized                        False  Info      WaitingForControlPlaneProviderInitialized  118s   Waiting for control plane provider to indicate the control plane has been initialized  
│           ├─ControlPlaneReady                              False  Info      WaitingForControlPlane                     118s                                                                                          
│           └─InfrastructureReady                            True                                                        118s                                                                                          
├─ClusterInfrastructure - AWSManagedCluster/eks-dev-slava-1                                                                                                                                                            
├─ControlPlane - AWSManagedControlPlane/eks-dev-slava-1-cp                                                                                                                                                            
│             ├─InternetGatewayReady                         True                                                        50s                                                                                          
│             ├─NatGatewaysReady                             False  Info      NatGatewaysCreationStarted                 50s                                                                                          
│             ├─SubnetsReady                                 True                                                        51s                                                                                          
│             └─VpcReady                                     True                                                        56s                                                                                          
└─Workers                                                                                                                                                                                                              
  └─MachineDeployment/eks-dev-slava-1-md                     False  Warning   WaitingForAvailableMachines                118s   Minimum availability requires 3 replicas, current 0 available                          
    │           ├─Available                                  False  Warning   WaitingForAvailableMachines                118s   Minimum availability requires 3 replicas, current 0 available                          
    │           └─MachineSetReady                            False  Warning   ScalingUp                                  118s   Scaling up MachineSet to 3 replicas (actual 0)                                        
    └─3 Machines...                                          False  Info      WaitingForBootstrapData                    118s   See eks-dev-slava-1-md-xwhd6-8rgsg, eks-dev-slava-1-md-xwhd

From ManagedCluster K8s object:

NAME              READY   STATUS
eks-dev-slava-1   False   eks-dev-slava-1: Waiting for control plane provider to indicate the control plane has been initialized. eks-dev-slava-1-md: Minimum availability requires 3 replicas, current 0 available. 

or

  status:
    conditions:
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Template is valid
      reason: Succeeded
      status: "True"
      type: TemplateReady
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Helm chart is valid
      reason: Succeeded
      status: "True"
      type: HelmChartReady
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: Helm install succeeded for release hmc-system/eks-dev-slava-1.v1 with
        chart [email protected]
      reason: InstallSucceeded
      status: "True"
      type: HelmReleaseReady
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Credential is Ready
      reason: Succeeded
      status: "True"
      type: CredentialReady
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: 'eks-dev-slava-1: Waiting for control plane provider to indicate the
        control plane has been initialized'
      reason: WaitingForControlPlaneProviderInitialized
      status: "False"
      type: ControlPlaneInitialized
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: 'eks-dev-slava-1-md: Minimum availability requires 3 replicas, current
        0 available'
      reason: WaitingForAvailableMachines
      status: "False"
      type: Available

When cluster is created, but machines are not yet:

NAME                                                         READY  SEVERITY  REASON                       SINCE  MESSAGE                                                                
Cluster/eks-dev-slava-1                                      True                                          3m31s                                                                          
│           ├─ControlPlaneInitialized                        True                                          3m28s                                                                          
│           ├─ControlPlaneReady                              True                                          3m31s                                                                          
│           └─InfrastructureReady                            True                                          14m                                                                            
├─ClusterInfrastructure - AWSManagedCluster/eks-dev-slava-1                                                                                                                                
├─ControlPlane - AWSManagedControlPlane/eks-dev-slava-1-cp   True                                          3m28s                                                                          
│             ├─ClusterSecurityGroupsReady                   True                                          11m                                                                            
│             ├─EKSAddonsConfigured                          True                                          3m30s                                                                          
│             ├─EKSControlPlaneCreating                      False  Info      created                      3m31s                                                                          
│             ├─EKSControlPlaneReady                         True                                          3m30s                                                                          
│             ├─EKSIdentityProviderConfigured                True                                          3m30s                                                                          
│             ├─IAMAuthenticatorConfigured                   True                                          3m28s                                                                          
│             ├─IAMControlPlaneRolesReady                    True                                          11m                                                                            
│             ├─InternetGatewayReady                         True                                          13m                                                                            
│             ├─NatGatewaysReady                             True                                          11m                                                                            
│             ├─RouteTablesReady                             True                                          11m                                                                            
│             ├─SubnetsReady                                 True                                          13m                                                                            
│             └─VpcReady                                     True                                          13m                                                                            
└─Workers                                                                                                                                                                                  
  └─MachineDeployment/eks-dev-slava-1-md                     False  Warning   WaitingForAvailableMachines  14m    Minimum availability requires 3 replicas, current 0 available            
    │           ├─Available                                  False  Warning   WaitingForAvailableMachines  14m    Minimum availability requires 3 replicas, current 0 available            
    │           └─MachineSetReady                            False  Warning   ScalingUp                    14m    Scaling up MachineSet to 3 replicas (actual 0)                          
    └─3 Machines...                                          False  Info      WaitingForBootstrapData      14m    See eks-dev-slava-1-md-xwhd6-8rgsg, eks-dev-slava-1-md-xwhd6-c2rlq, ...  

From ManagedCluster K8s object:

NAME              READY   STATUS
eks-dev-slava-1   False   eks-dev-slava-1-md: Minimum availability requires 3 replicas, current 0 available.

or

  status:
    conditions:
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Template is valid
      reason: Succeeded
      status: "True"
      type: TemplateReady
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Helm chart is valid
      reason: Succeeded
      status: "True"
      type: HelmChartReady
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: Helm install succeeded for release hmc-system/eks-dev-slava-1.v1 with
        chart [email protected]
      reason: InstallSucceeded
      status: "True"
      type: HelmReleaseReady
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Credential is Ready
      reason: Succeeded
      status: "True"
      type: CredentialReady
    - lastTransitionTime: "2024-10-30T16:05:59Z"
      message: eks-dev-slava-1 is Ready
      reason: Succeeded
      status: "True"
      type: ControlPlaneInitialized
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: 'eks-dev-slava-1-md: Minimum availability requires 3 replicas, current
        0 available'
      reason: WaitingForAvailableMachines
      status: "False"
      type: Available

When ManagedCluster is ready:

NAME                                                         READY  SEVERITY  REASON   SINCE  MESSAGE                                                                 
Cluster/eks-dev-slava-1                                      True                      9m37s                                                                           
│           ├─ControlPlaneInitialized                        True                      9m34s                                                                           
│           ├─ControlPlaneReady                              True                      9m37s                                                                           
│           └─InfrastructureReady                            True                      20m                                                                             
├─ClusterInfrastructure - AWSManagedCluster/eks-dev-slava-1                                                                                                            
├─ControlPlane - AWSManagedControlPlane/eks-dev-slava-1-cp   True                      9m34s                                                                           
│             ├─ClusterSecurityGroupsReady                   True                      17m                                                                             
│             ├─EKSAddonsConfigured                          True                      9m36s                                                                           
│             ├─EKSControlPlaneCreating                      False  Info      created  9m37s                                                                           
│             ├─EKSControlPlaneReady                         True                      9m36s                                                                           
│             ├─EKSIdentityProviderConfigured                True                      9m36s                                                                           
│             ├─IAMAuthenticatorConfigured                   True                      9m34s                                                                           
│             ├─IAMControlPlaneRolesReady                    True                      17m                                                                             
│             ├─InternetGatewayReady                         True                      19m                                                                             
│             ├─NatGatewaysReady                             True                      17m                                                                             
│             ├─RouteTablesReady                             True                      17m                                                                             
│             ├─SubnetsReady                                 True                      19m                                                                             
│             └─VpcReady                                     True                      19m                                                                             
└─Workers                                                                                                                                                              
  └─MachineDeployment/eks-dev-slava-1-md                     True                      8s                                                                              
    │           ├─Available                                  True                      8s                                                                              
    │           └─MachineSetReady                            True                      8s                                                                              
    └─3 Machines...                                          True                      27s    See eks-dev-slava-1-md-xwhd6-8rgsg, eks-dev-slava-1-md-xwhd6-c2rlq, ...  
  status:
    conditions:
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Template is valid
      reason: Succeeded
      status: "True"
      type: TemplateReady
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Helm chart is valid
      reason: Succeeded
      status: "True"
      type: HelmChartReady
    - lastTransitionTime: "2024-10-30T15:54:34Z"
      message: Helm install succeeded for release hmc-system/eks-dev-slava-1.v1 with
        chart [email protected]
      reason: InstallSucceeded
      status: "True"
      type: HelmReleaseReady
    - lastTransitionTime: "2024-10-30T16:15:28Z"
      message: ManagedCluster is ready
      reason: Succeeded
      status: "True"
      type: Ready
    - lastTransitionTime: "2024-10-30T15:54:33Z"
      message: Credential is Ready
      reason: Succeeded
      status: "True"
      type: CredentialReady
    - lastTransitionTime: "2024-10-30T16:05:59Z"
      message: eks-dev-slava-1 is Ready
      reason: Succeeded
      status: "True"
      type: ControlPlaneInitialized
    - lastTransitionTime: "2024-10-30T16:15:25Z"
      message: eks-dev-slava-1-md is Ready
      reason: Succeeded
      status: "True"
      type: Available

@slysunkin slysunkin force-pushed the HMC-379 branch 3 times, most recently from 25ee1a3 to c536deb Compare October 24, 2024 18:46
@slysunkin slysunkin marked this pull request as ready for review October 24, 2024 18:46
@slysunkin slysunkin changed the title Added checking for Machines availability to update ManagedCluster status Added checking for MachineDeployments availability to update ManagedCluster status Oct 24, 2024
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
@slysunkin slysunkin requested a review from Kshatrix October 28, 2024 15:41
@slysunkin slysunkin marked this pull request as draft October 28, 2024 15:47
@slysunkin slysunkin marked this pull request as ready for review October 28, 2024 16:36
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
@slysunkin
Copy link
Contributor Author

Merged with recent changes introduced in #341.
Also we need to check for the statuses of the only MachineDeployment, i.e. "A MachineDeployment orchestrates deployments over a fleet of MachineSets" (https://cluster-api.sigs.k8s.io/developer/architecture/controllers/machine-deployment)

@slysunkin slysunkin requested a review from zerospiel November 1, 2024 17:47
@slysunkin slysunkin force-pushed the HMC-379 branch 2 times, most recently from b575118 to 15b8938 Compare November 1, 2024 19:51
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/controller/managedcluster_controller.go Outdated Show resolved Hide resolved
internal/utils/status/status.go Outdated Show resolved Hide resolved
@Kshatrix Kshatrix merged commit ca22e30 into k0rdent:main Nov 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants