File tree Expand file tree Collapse file tree 7 files changed +345
-0
lines changed
resource_customizations/keda.sh/ScaledJob Expand file tree Collapse file tree 7 files changed +345
-0
lines changed Original file line number Diff line number Diff line change 1+ local hs = {}
2+ local healthy = false
3+ local degraded = false
4+ local suspended = false
5+ if obj .status ~= nil then
6+ if obj .status .conditions ~= nil then
7+ for i , condition in ipairs (obj .status .conditions ) do
8+ if condition .status == " False" and condition .type == " Ready" then
9+ hs .message = condition .message
10+ degraded = true
11+ end
12+ if condition .status == " True" and condition .type == " Ready" then
13+ hs .message = condition .message
14+ healthy = true
15+ end
16+ if condition .status == " True" and condition .type == " Paused" then
17+ hs .message = condition .message
18+ suspended = true
19+ end
20+ if condition .status == " Unknown" and condition .type == " Ready" then
21+ hs .message = condition .message
22+ degraded = true
23+ end
24+ end
25+ end
26+ end
27+ if degraded == true then
28+ hs .status = " Degraded"
29+ return hs
30+ elseif healthy == true and suspended == false then
31+ hs .status = " Healthy"
32+ return hs
33+ elseif healthy == true and suspended == true then
34+ hs .status = " Suspended"
35+ return hs
36+ end
37+ hs .status = " Progressing"
38+ hs .message = " Waiting for ScaledJob"
39+ return hs
Original file line number Diff line number Diff line change 1+ tests :
2+ - healthStatus :
3+ status : Progressing
4+ message : " Waiting for ScaledJob"
5+ inputPath : testdata/keda-progressing.yaml
6+ - healthStatus :
7+ status : Degraded
8+ message : " Triggers defined in ScaledJob are not working correctly"
9+ inputPath : testdata/keda-degraded.yaml
10+ - healthStatus :
11+ status : Healthy
12+ message : " ScaledJob is defined correctly and is ready to scaling"
13+ inputPath : testdata/keda-healthy.yaml
14+ - healthStatus :
15+ status : Degraded
16+ message : " Some triggers defined in ScaledJob are not working correctly"
17+ inputPath : testdata/keda-unknown.yaml
18+ - healthStatus :
19+ status : Suspended
20+ message : " ScaledJob is paused"
21+ inputPath : testdata/keda-suspended.yaml
Original file line number Diff line number Diff line change 1+ apiVersion : keda.sh/v1alpha1
2+ kind : ScaledJob
3+ metadata :
4+ annotations :
5+ finalizers :
6+ - finalizer.keda.sh
7+ name : keda
8+ namespace : keda
9+ resourceVersion : ' 157163'
10+ uid : 9a6b7c4f-c35b-46ca-a801-ee5cb515ce0a
11+ spec :
12+ jobTargetRef :
13+ backoffLimit : 1
14+ template :
15+ metadata :
16+ creationTimestamp : null
17+ spec :
18+ containers :
19+ - command :
20+ - sleep
21+ - ' 10'
22+ envFrom :
23+ - secretRef :
24+ name : scaledjob-conditions-test-secret
25+ image : docker.io/library/busybox
26+ imagePullPolicy : IfNotPresent
27+ name : sleeper
28+ resources : {}
29+ restartPolicy : Never
30+ maxReplicaCount : 5
31+ pollingInterval : 5
32+ rollout : {}
33+ scalingStrategy : {}
34+ triggers :
35+ - metadata :
36+ hostFromEnv : RabbitApiHost
37+ mode : QueueLength
38+ queueName : not-existing-queue
39+ value : ' 1'
40+ type : rabbitmq
41+ status :
42+ authenticationsTypes : ' '
43+ conditions :
44+ - message : Triggers defined in ScaledJob are not working correctly
45+ reason : TriggerError
46+ status : ' False'
47+ type : Ready
48+ - message : Scaling is not performed because triggers are not active
49+ reason : ScalerNotActive
50+ status : ' False'
51+ type : Active
52+ - status : Unknown
53+ type : Fallback
54+ - status : ' False'
55+ type : Paused
56+ triggersTypes : rabbitmq
57+
Original file line number Diff line number Diff line change 1+ apiVersion : keda.sh/v1alpha1
2+ kind : ScaledJob
3+ metadata :
4+ annotations :
5+ finalizers :
6+ - finalizer.keda.sh
7+ name : keda
8+ namespace : keda
9+ resourceVersion : ' 157477'
10+ uid : 9a6b7c4f-c35b-46ca-a801-ee5cb515ce0a
11+ spec :
12+ jobTargetRef :
13+ backoffLimit : 1
14+ template :
15+ metadata :
16+ creationTimestamp : null
17+ spec :
18+ containers :
19+ - command :
20+ - sleep
21+ - ' 10'
22+ envFrom :
23+ - secretRef :
24+ name : scaledjob-conditions-test-secret
25+ image : docker.io/library/busybox
26+ imagePullPolicy : IfNotPresent
27+ name : sleeper
28+ resources : {}
29+ restartPolicy : Never
30+ maxReplicaCount : 5
31+ pollingInterval : 5
32+ rollout : {}
33+ scalingStrategy : {}
34+ triggers :
35+ - metadata :
36+ hostFromEnv : RabbitApiHost
37+ mode : QueueLength
38+ queueName : hello
39+ value : ' 1'
40+ type : rabbitmq
41+ status :
42+ authenticationsTypes : ' '
43+ conditions :
44+ - message : ScaledJob is defined correctly and is ready to scaling
45+ reason : ScaledJobReady
46+ status : ' True'
47+ type : Ready
48+ - message : Scaling is performed because triggers are active
49+ reason : ScalerActive
50+ status : ' True'
51+ type : Active
52+ - status : Unknown
53+ type : Fallback
54+ - status : ' False'
55+ type : Paused
56+ triggersTypes : rabbitmq
57+
Original file line number Diff line number Diff line change 1+ apiVersion : keda.sh/v1alpha1
2+ kind : ScaledJob
3+ metadata :
4+ annotations :
5+ finalizers :
6+ - finalizer.keda.sh
7+ name : keda
8+ namespace : keda
9+ resourceVersion : ' 159237'
10+ uid : 9a6b7c4f-c35b-46ca-a801-ee5cb515ce0a
11+ spec :
12+ jobTargetRef :
13+ backoffLimit : 1
14+ template :
15+ metadata :
16+ creationTimestamp : null
17+ spec :
18+ containers :
19+ - command :
20+ - sleep
21+ - ' 10'
22+ envFrom :
23+ - secretRef :
24+ name : scaledjob-conditions-test-secret
25+ image : docker.io/library/busybox
26+ imagePullPolicy : IfNotPresent
27+ name : sleeper
28+ resources : {}
29+ restartPolicy : Never
30+ maxReplicaCount : 5
31+ pollingInterval : 5
32+ rollout : {}
33+ scalingStrategy : {}
34+ triggers :
35+ - metadata :
36+ hostFromEnv : RabbitApiHost
37+ mode : QueueLength
38+ queueName : hello
39+ value : ' 1'
40+ type : rabbitmq
41+ status :
42+ authenticationsTypes : ' '
43+ conditions :
44+ - message : Waiting for ScaledJob
45+ reason : Running
46+ status : ' True'
47+ type : Running
48+ triggersTypes : rabbitmq
49+
Original file line number Diff line number Diff line change 1+ apiVersion : keda.sh/v1alpha1
2+ kind : ScaledJob
3+ metadata :
4+ annotations :
5+ autoscaling.keda.sh/paused : ' true'
6+ finalizers :
7+ - finalizer.keda.sh
8+ name : keda
9+ namespace : keda
10+ resourceVersion : ' 157163'
11+ uid : 9a6b7c4f-c35b-46ca-a801-ee5cb515ce0a
12+ spec :
13+ jobTargetRef :
14+ backoffLimit : 1
15+ template :
16+ metadata :
17+ creationTimestamp : null
18+ spec :
19+ containers :
20+ - command :
21+ - sleep
22+ - ' 10'
23+ envFrom :
24+ - secretRef :
25+ name : scaledjob-conditions-test-secret
26+ image : docker.io/library/busybox
27+ imagePullPolicy : IfNotPresent
28+ name : sleeper
29+ resources : {}
30+ restartPolicy : Never
31+ maxReplicaCount : 5
32+ pollingInterval : 5
33+ rollout : {}
34+ scalingStrategy : {}
35+ triggers :
36+ - metadata :
37+ hostFromEnv : RabbitApiHost
38+ mode : QueueLength
39+ queueName : hello
40+ value : ' 1'
41+ type : rabbitmq
42+ status :
43+ authenticationsTypes : ' '
44+ conditions :
45+ - message : ScaledJob is paused, skipping reconcile loop
46+ reason : ScaledJobReady
47+ status : ' True'
48+ type : Ready
49+ - message : Scaling is not performed because triggers are not active
50+ reason : ScalerNotActive
51+ status : ' False'
52+ type : Active
53+ - status : Unknown
54+ type : Fallback
55+ - message : ScaledJob is paused
56+ reason : ScaledJobPaused
57+ status : ' True'
58+ type : Paused
59+ triggersTypes : rabbitmq
Original file line number Diff line number Diff line change 1+ apiVersion : keda.sh/v1alpha1
2+ kind : ScaledJob
3+ metadata :
4+ annotations :
5+ finalizers :
6+ - finalizer.keda.sh
7+ name : keda
8+ namespace : keda
9+ resourceVersion : ' 158276'
10+ uid : 9a6b7c4f-c35b-46ca-a801-ee5cb515ce0a
11+ spec :
12+ jobTargetRef :
13+ backoffLimit : 1
14+ template :
15+ metadata :
16+ creationTimestamp : null
17+ spec :
18+ containers :
19+ - command :
20+ - sleep
21+ - ' 10'
22+ envFrom :
23+ - secretRef :
24+ name : scaledjob-conditions-test-secret
25+ image : docker.io/library/busybox
26+ imagePullPolicy : IfNotPresent
27+ name : sleeper
28+ resources : {}
29+ restartPolicy : Never
30+ maxReplicaCount : 5
31+ pollingInterval : 5
32+ rollout : {}
33+ scalingStrategy : {}
34+ triggers :
35+ - metadata :
36+ hostFromEnv : RabbitApiHost
37+ mode : QueueLength
38+ queueName : hello
39+ value : ' 1'
40+ type : rabbitmq
41+ - metadata :
42+ hostFromEnv : RabbitApiHost
43+ mode : QueueLength
44+ queueName : not-existing-queue
45+ value : ' 1'
46+ type : rabbitmq
47+ status :
48+ authenticationsTypes : ' '
49+ conditions :
50+ - message : Some triggers defined in ScaledJob are not working correctly
51+ reason : PartialTriggerError
52+ status : Unknown
53+ type : Ready
54+ - message : Scaling is performed because triggers are active
55+ reason : ScalerActive
56+ status : ' True'
57+ type : Active
58+ - status : Unknown
59+ type : Fallback
60+ - status : ' False'
61+ type : Paused
62+ triggersTypes : rabbitmq
63+
You can’t perform that action at this time.
0 commit comments