Skip to content

Commit

Permalink
feat: reconciliation failed kustomization health check
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed Aug 9, 2024
1 parent 155055b commit 3be957a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/health/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ func TestHPA(t *testing.T) {
assertAppHealth(t, "./testdata/hpa-v1-progressing-with-no-annotations.yaml", health.HealthStatusProgressing, health.HealthHealthy, false)
}

func TestKustomization(t *testing.T) {
assertAppHealthMsg(t, "./testdata/kustomization-reconciliation-failed.yaml", "ReconciliationFailed", health.HealthUnhealthy, false, "CronJob/scale-dev-up namespace not specified: the server could not find the requested resource\n")
}

func TestPod(t *testing.T) {
assertAppHealthWithOverwriteMsg(t, "./testdata/pod-not-ready-container-not-ready.yaml", map[string]string{
"2024-07-29T06:32:56Z": time.Now().Add(time.Minute * 10).Format(time.RFC3339),
Expand Down
3 changes: 3 additions & 0 deletions pkg/health/statusMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ Deployment:
Kustomization:
conditions:
Ready:
onFalse:
message: true
health: unhealthy
ready: true
message: true
reasons:
Expand Down
37 changes: 37 additions & 0 deletions pkg/health/testdata/kustomization-reconciliation-failed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
uid: 73ffa0f4-2eb1-4d1b-8367-1c47128e3339
name: cronjobs
labels:
kustomize.toolkit.fluxcd.io/name: flux-objects
kustomize.toolkit.fluxcd.io/namespace: flux-system
namespace: flux-system
finalizers:
- finalizers.fluxcd.io
creationTimestamp: 2024-08-01T06:52:47Z
spec:
path: ./production/ifs-mgmt-mon-eks/cronjobs
force: false
prune: false
interval: 10m0s
sourceRef:
kind: GitRepository
name: infrastructure
decryption:
provider: sops
status:
conditions:
- type: Reconciling
reason: ProgressingWithRetry
status: 'True'
message: Detecting drift for revision
v1.34.0@sha1:bdbb399739638a189b76197d5112968827b6ecd7 with a timeout of
9m30s
- type: Ready
reason: ReconciliationFailed
status: 'False'
message: >
CronJob/scale-dev-up namespace not specified: the server could not find
the requested resource
lastAttemptedRevision: v1.34.0@sha1:bdbb399739638a189b76197d5112968827b6ecd7

0 comments on commit 3be957a

Please sign in to comment.