Skip to content

Commit

Permalink
feat: Implement MachineHealthCheck CRD health check
Browse files Browse the repository at this point in the history
Signed-off-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
  • Loading branch information
Jellyfrog committed Oct 7, 2022
1 parent 22ba8f5 commit 7b4d964
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
hs = {}

hs.status = "Progressing"
hs.message = ""

if obj.status ~= nil and obj.status.currentHealthy ~= nil then
if obj.status.expectedMachines == obj.status.currentHealthy then
hs.status = "Healthy"
else
hs.status = "Degraded"
end
end

return hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests:
- healthStatus:
status: Degraded
message: ''
inputPath: testdata/degraded_expectedMachines.yaml
- healthStatus:
status: Healthy
message: ''
inputPath: testdata/healthy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineHealthCheck
metadata:
labels:
cluster.x-k8s.io/cluster-name: test
name: test-node-unhealthy-5m
spec:
clusterName: test
maxUnhealthy: 100%
nodeStartupTimeout: 10m0s
selector:
matchLabels:
cluster.x-k8s.io/deployment-name: test-md-workers-0
unhealthyConditions:
- status: Unknown
timeout: 5m
type: Ready
- status: "False"
timeout: 5m
type: Ready
status:
conditions:
- lastTransitionTime: "2022-10-07T10:33:46Z"
status: "True"
type: RemediationAllowed
currentHealthy: 1
expectedMachines: 3
observedGeneration: 3
remediationsAllowed: 1
targets:
- test-md-workers-0-76f7db5786-8nl6m
- test-md-workers-0-76f7db5786-jjzvf
- test-md-workers-0-76f7db5786-l4vfb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineHealthCheck
metadata:
labels:
cluster.x-k8s.io/cluster-name: test
name: test-node-unhealthy-5m
spec:
clusterName: test
maxUnhealthy: 100%
nodeStartupTimeout: 10m0s
selector:
matchLabels:
cluster.x-k8s.io/deployment-name: test-md-workers-0
unhealthyConditions:
- status: Unknown
timeout: 5m
type: Ready
- status: "False"
timeout: 5m
type: Ready
status:
conditions:
- lastTransitionTime: "2022-10-07T10:33:46Z"
status: "True"
type: RemediationAllowed
currentHealthy: 3
expectedMachines: 3
observedGeneration: 3
remediationsAllowed: 1
targets:
- test-md-workers-0-76f7db5786-8nl6m
- test-md-workers-0-76f7db5786-jjzvf
- test-md-workers-0-76f7db5786-l4vfb

0 comments on commit 7b4d964

Please sign in to comment.