mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat: Add custom health check for cluster-api AWSManagedControlPlane (#19304)
* add custom health check for awsmanagedcontrolplane Signed-off-by: Iulian Taiatu <itaiatu@adobe.com> * chore(deps): bump github.com/aws/aws-sdk-go from 1.55.3 to 1.55.4 (#19295) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.3 to 1.55.4. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.3...v1.55.4) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Iulian Taiatu <itaiatu@adobe.com> * add new line at the end of health_test.yaml file Signed-off-by: Iulian Taiatu <itaiatu@adobe.com> --------- Signed-off-by: Iulian Taiatu <itaiatu@adobe.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
local health_status = {
|
||||
status = "Progressing",
|
||||
message = "Provisioning..."
|
||||
}
|
||||
|
||||
-- If .status is nil or doesn't have conditions, then the control plane is not ready
|
||||
if obj.status == nil or obj.status.conditions == nil then
|
||||
return health_status
|
||||
end
|
||||
|
||||
-- Accumulator for the error messages (could be multiple conditions in error state)
|
||||
err_msg = ""
|
||||
|
||||
-- Iterate over the conditions to determine the health status
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
-- Check if the Ready condition is True, then the control plane is ready
|
||||
if condition.type == "Ready" and condition.status == "True" then
|
||||
health_status.status = "Healthy"
|
||||
health_status.message = "Control plane is ready"
|
||||
return health_status
|
||||
end
|
||||
|
||||
-- If we have a condition that is False and has an Error severity, then the control plane is in a degraded state
|
||||
if condition.status == "False" and condition.severity == "Error" then
|
||||
health_status.status = "Degraded"
|
||||
err_msg = err_msg .. condition.message .. " "
|
||||
end
|
||||
end
|
||||
|
||||
-- If we have any error conditions, then the control plane is in a degraded state
|
||||
if health_status.status == "Degraded" then
|
||||
health_status.message = err_msg
|
||||
return health_status
|
||||
end
|
||||
|
||||
-- If .status.ready is False, then the control plane is not ready
|
||||
if obj.status.ready == false then
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Control plane is not ready (.status.ready is false)"
|
||||
return health_status
|
||||
end
|
||||
|
||||
-- If we reach this point, then the control plane is not ready and we don't have any error conditions
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Control plane is not ready"
|
||||
|
||||
return health_status
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: 'Control plane is ready'
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: 'Control plane is not ready (.status.ready is false)'
|
||||
inputPath: testdata/progressing_ready_false.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: 'Control plane is not ready'
|
||||
inputPath: testdata/progressing_ready_true.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: '7 of 10 completed failed reconciling OIDC provider for cluster: failed to create OIDC provider: error creating provider: LimitExceeded: Cannot exceed quota for OpenIdConnectProvidersPerAccount: 100 '
|
||||
inputPath: testdata/degraded.yaml
|
||||
@@ -0,0 +1,50 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
|
||||
kind: AWSManagedControlPlane
|
||||
metadata:
|
||||
name: test
|
||||
namespace: ns-test
|
||||
ownerReferences:
|
||||
- apiVersion: cluster.x-k8s.io/v1beta1
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: Cluster
|
||||
name: test
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "False"
|
||||
severity: Error
|
||||
message: "7 of 10 completed"
|
||||
type: Ready
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: ClusterSecurityGroupsReady
|
||||
- lastTransitionTime: "2024-07-30T02:20:06Z"
|
||||
status: "True"
|
||||
type: EKSAddonsConfigured
|
||||
- lastTransitionTime: "2024-07-26T14:43:57Z"
|
||||
reason: created
|
||||
severity: Info
|
||||
status: "False"
|
||||
type: EKSControlPlaneCreating
|
||||
- lastTransitionTime: "2024-07-25T09:22:46Z"
|
||||
message: "failed reconciling OIDC provider for cluster: failed to create OIDC provider: error creating provider: LimitExceeded: Cannot exceed quota for OpenIdConnectProvidersPerAccount: 100"
|
||||
reason: EKSControlPlaneReconciliationFailed
|
||||
severity: Error
|
||||
status: "False"
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "True"
|
||||
type: EKSControlPlaneReady
|
||||
- lastTransitionTime: "2024-07-26T15:28:01Z"
|
||||
status: "True"
|
||||
type: IAMAuthenticatorConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:27:58Z"
|
||||
status: "True"
|
||||
type: IAMControlPlaneRolesReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: SubnetsReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:46Z"
|
||||
status: "True"
|
||||
type: VpcReady
|
||||
ready: true
|
||||
@@ -0,0 +1,46 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
|
||||
kind: AWSManagedControlPlane
|
||||
metadata:
|
||||
name: test
|
||||
namespace: ns-test
|
||||
ownerReferences:
|
||||
- apiVersion: cluster.x-k8s.io/v1beta1
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: Cluster
|
||||
name: test
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "True"
|
||||
type: Ready
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: ClusterSecurityGroupsReady
|
||||
- lastTransitionTime: "2024-07-30T02:20:06Z"
|
||||
status: "True"
|
||||
type: EKSAddonsConfigured
|
||||
- lastTransitionTime: "2024-07-26T14:43:57Z"
|
||||
reason: created
|
||||
severity: Info
|
||||
status: "False"
|
||||
type: EKSControlPlaneCreating
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "True"
|
||||
type: EKSControlPlaneReady
|
||||
- lastTransitionTime: "2024-07-30T13:05:45Z"
|
||||
status: "True"
|
||||
type: EKSIdentityProviderConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:28:01Z"
|
||||
status: "True"
|
||||
type: IAMAuthenticatorConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:27:58Z"
|
||||
status: "True"
|
||||
type: IAMControlPlaneRolesReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: SubnetsReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:46Z"
|
||||
status: "True"
|
||||
type: VpcReady
|
||||
ready: true
|
||||
@@ -0,0 +1,46 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
|
||||
kind: AWSManagedControlPlane
|
||||
metadata:
|
||||
name: test
|
||||
namespace: ns-test
|
||||
ownerReferences:
|
||||
- apiVersion: cluster.x-k8s.io/v1beta1
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: Cluster
|
||||
name: test
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "False"
|
||||
type: Ready
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: ClusterSecurityGroupsReady
|
||||
- lastTransitionTime: "2024-07-30T02:20:06Z"
|
||||
status: "True"
|
||||
type: EKSAddonsConfigured
|
||||
- lastTransitionTime: "2024-07-26T14:43:57Z"
|
||||
reason: created
|
||||
severity: Info
|
||||
status: "False"
|
||||
type: EKSControlPlaneCreating
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "True"
|
||||
type: EKSControlPlaneReady
|
||||
- lastTransitionTime: "2024-07-30T13:05:45Z"
|
||||
status: "True"
|
||||
type: EKSIdentityProviderConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:28:01Z"
|
||||
status: "True"
|
||||
type: IAMAuthenticatorConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:27:58Z"
|
||||
status: "True"
|
||||
type: IAMControlPlaneRolesReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: SubnetsReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:46Z"
|
||||
status: "True"
|
||||
type: VpcReady
|
||||
ready: false
|
||||
@@ -0,0 +1,46 @@
|
||||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
|
||||
kind: AWSManagedControlPlane
|
||||
metadata:
|
||||
name: test
|
||||
namespace: ns-test
|
||||
ownerReferences:
|
||||
- apiVersion: cluster.x-k8s.io/v1beta1
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: Cluster
|
||||
name: test
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "False"
|
||||
type: Ready
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: ClusterSecurityGroupsReady
|
||||
- lastTransitionTime: "2024-07-30T02:20:06Z"
|
||||
status: "True"
|
||||
type: EKSAddonsConfigured
|
||||
- lastTransitionTime: "2024-07-26T14:43:57Z"
|
||||
reason: created
|
||||
severity: Info
|
||||
status: "False"
|
||||
type: EKSControlPlaneCreating
|
||||
- lastTransitionTime: "2024-07-30T11:10:03Z"
|
||||
status: "True"
|
||||
type: EKSControlPlaneReady
|
||||
- lastTransitionTime: "2024-07-30T13:05:45Z"
|
||||
status: "True"
|
||||
type: EKSIdentityProviderConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:28:01Z"
|
||||
status: "True"
|
||||
type: IAMAuthenticatorConfigured
|
||||
- lastTransitionTime: "2024-07-26T15:27:58Z"
|
||||
status: "True"
|
||||
type: IAMControlPlaneRolesReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:48Z"
|
||||
status: "True"
|
||||
type: SubnetsReady
|
||||
- lastTransitionTime: "2024-07-26T14:35:46Z"
|
||||
status: "True"
|
||||
type: VpcReady
|
||||
ready: true
|
||||
Reference in New Issue
Block a user