-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat: Add custom health check for Druid operator #25904
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
Open
LEEAHRI
wants to merge
4
commits into
argoproj:master
Choose a base branch
from
LEEAHRI:health-check-druid
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| local hs = {} | ||
|
|
||
| if obj.status == nil then | ||
| hs.status = "Progressing" | ||
| hs.message = "Waiting for Druid status" | ||
| return hs | ||
| end | ||
|
|
||
| if obj.status.druidNodeStatus ~= nil then | ||
| local nodeStatus = obj.status.druidNodeStatus | ||
|
|
||
| if nodeStatus.druidNodeConditionType == "DruidClusterReady" and nodeStatus.druidNodeConditionStatus == "True" then | ||
| hs.status = "Healthy" | ||
| hs.message = nodeStatus.reason or "Druid cluster is ready" | ||
| return hs | ||
| end | ||
|
|
||
| if nodeStatus.druidNodeConditionType == "DruidNodeErrorState" then | ||
| hs.status = "Degraded" | ||
| local podName = nodeStatus.druidNode or "unknown" | ||
| local reason = nodeStatus.reason or "Pod is not ready" | ||
| hs.message = "Pod " .. podName .. ": " .. reason | ||
| return hs | ||
| end | ||
|
|
||
| if nodeStatus.druidNodeConditionStatus == "False" then | ||
| hs.status = "Degraded" | ||
| hs.message = nodeStatus.reason or "Druid cluster is not ready" | ||
| return hs | ||
| end | ||
| end | ||
|
|
||
| hs.status = "Progressing" | ||
| hs.message = "Druid cluster is being provisioned" | ||
| return hs | ||
25 changes: 25 additions & 0 deletions
25
resource_customizations/druid.apache.org/Druid/health_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| tests: | ||
| - healthStatus: | ||
| status: Healthy | ||
| message: All Druid Nodes are in Ready Condition | ||
| inputPath: testdata/healthy.yaml | ||
|
|
||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Pod druid-test-historicals-0: ContainersNotReady" | ||
| inputPath: testdata/degraded.yaml | ||
|
|
||
| - healthStatus: | ||
| status: Degraded | ||
| message: Some pods are not ready | ||
| inputPath: testdata/degraded_condition_false.yaml | ||
|
|
||
| - healthStatus: | ||
| status: Progressing | ||
| message: Waiting for Druid status | ||
| inputPath: testdata/progressing.yaml | ||
|
|
||
| - healthStatus: | ||
| status: Progressing | ||
| message: Druid cluster is being provisioned | ||
| inputPath: testdata/progressing_with_partial_status.yaml |
11 changes: 11 additions & 0 deletions
11
resource_customizations/druid.apache.org/Druid/testdata/current-error.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-sandbox | ||
| namespace: druid-sandbox | ||
| status: | ||
| druidNodeStatus: | ||
| druidNode: druid-druid-sandbox-routers-676fccd99d-sgs97 | ||
| druidNodeConditionStatus: "True" | ||
| druidNodeConditionType: DruidNodeErrorState | ||
| reason: ContainersNotReady |
27 changes: 27 additions & 0 deletions
27
resource_customizations/druid.apache.org/Druid/testdata/degraded.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| coordinators: | ||
| kind: Deployment | ||
| nodeType: coordinator | ||
| replicas: 1 | ||
| druid.port: 8081 | ||
| historicals: | ||
| kind: StatefulSet | ||
| nodeType: historical | ||
| replicas: 1 | ||
| druid.port: 8083 | ||
| status: | ||
| druidNodeStatus: | ||
| druidNode: druid-test-historicals-0 | ||
| druidNodeConditionStatus: "True" | ||
| druidNodeConditionType: DruidNodeErrorState | ||
| reason: ContainersNotReady | ||
| pods: | ||
| - druid-test-coordinators-0 | ||
| - druid-test-historicals-0 |
21 changes: 21 additions & 0 deletions
21
resource_customizations/druid.apache.org/Druid/testdata/degraded_condition_false.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| coordinators: | ||
| kind: Deployment | ||
| nodeType: coordinator | ||
| replicas: 1 | ||
| druid.port: 8081 | ||
| status: | ||
| druidNodeStatus: | ||
| druidNode: All | ||
| druidNodeConditionStatus: "False" | ||
| druidNodeConditionType: DruidClusterReady | ||
| reason: Some pods are not ready | ||
| pods: | ||
| - druid-test-coordinators-0 |
33 changes: 33 additions & 0 deletions
33
resource_customizations/druid.apache.org/Druid/testdata/healthy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| coordinators: | ||
| kind: Deployment | ||
| nodeType: coordinator | ||
| replicas: 1 | ||
| druid.port: 8081 | ||
| brokers: | ||
| kind: Deployment | ||
| nodeType: broker | ||
| replicas: 1 | ||
| druid.port: 8082 | ||
| historicals: | ||
| kind: StatefulSet | ||
| nodeType: historical | ||
| replicas: 1 | ||
| druid.port: 8083 | ||
| status: | ||
| druidNodeStatus: | ||
| druidNode: All | ||
| druidNodeConditionStatus: "True" | ||
| druidNodeConditionType: DruidClusterReady | ||
| reason: All Druid Nodes are in Ready Condition | ||
| pods: | ||
| - druid-test-coordinators-0 | ||
| - druid-test-brokers-0 | ||
| - druid-test-historicals-0 |
13 changes: 13 additions & 0 deletions
13
resource_customizations/druid.apache.org/Druid/testdata/progressing.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| coordinators: | ||
| kind: Deployment | ||
| nodeType: coordinator | ||
| replicas: 1 | ||
| druid.port: 8081 |
16 changes: 16 additions & 0 deletions
16
resource_customizations/druid.apache.org/Druid/testdata/progressing_with_partial_status.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| coordinators: | ||
| kind: Deployment | ||
| nodeType: coordinator | ||
| replicas: 1 | ||
| druid.port: 8081 | ||
| status: | ||
| pods: | ||
| - druid-test-coordinators-0 |
21 changes: 21 additions & 0 deletions
21
resource_customizations/druid.apache.org/Druid/testdata/replica_mismatch.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| apiVersion: druid.apache.org/v1alpha1 | ||
| kind: Druid | ||
| metadata: | ||
| name: druid-test | ||
| namespace: druid-test | ||
| spec: | ||
| image: apache/druid:latest | ||
| nodes: | ||
| historicals: | ||
| kind: StatefulSet | ||
| nodeType: historical | ||
| replicas: 3 | ||
| druid.port: 8083 | ||
| status: | ||
| druidNodeStatus: | ||
| druidNode: All | ||
| druidNodeConditionStatus: "True" | ||
| druidNodeConditionType: DruidClusterReady | ||
| reason: All Druid Nodes are in Ready Condition | ||
| pods: | ||
| - druid-test-historicals-0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add this check at line 11 to return early. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0d63f12
Thanks for the feedback! Updated.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nitishfy
Any updates?