forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
psmdb.percona.com/PerconaServerMongoDB resource customization (argopr…
…oj#20628) Signed-off-by: Niv Amitai <[email protected]>
- Loading branch information
Showing
8 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/health.lua
This file contains 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,18 @@ | ||
local hs = {} | ||
if obj.status ~= nil then | ||
local state_map = { | ||
initializing = "Progressing", | ||
ready = "Healthy", | ||
error = "Degraded", | ||
stopping = "Progressing", | ||
paused = "Suspended" | ||
} | ||
|
||
hs.status = state_map[obj.status.state] or "Unknown" | ||
hs.message = obj.status.ready .. "/" .. obj.status.size .. " node(s) are ready" | ||
return hs | ||
end | ||
|
||
hs.status = "Unknown" | ||
hs.message = "Cluster status is unknown" | ||
return hs |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/health_test.yaml
This file contains 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: Progressing | ||
message: "0/9 node(s) are ready" | ||
inputPath: testdata/initializing.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: "9/9 node(s) are ready" | ||
inputPath: testdata/ready.yaml | ||
- healthStatus: | ||
status: Suspended | ||
message: "0/9 node(s) are ready" | ||
inputPath: testdata/paused.yaml | ||
- healthStatus: | ||
status: Progressing | ||
message: "6/9 node(s) are ready" | ||
inputPath: testdata/stopping.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: "0/9 node(s) are ready" | ||
inputPath: testdata/error.yaml | ||
- healthStatus: | ||
status: Unknown | ||
message: "0/0 node(s) are ready" | ||
inputPath: testdata/unknown.yaml |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/error.yaml
This file contains 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 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
mongos: | ||
ready: 0 | ||
size: 3 | ||
status: error | ||
observedGeneration: 1 | ||
ready: 0 | ||
replsets: | ||
cfg: | ||
initialized: true | ||
ready: 0 | ||
size: 3 | ||
status: error | ||
rs0: | ||
initialized: true | ||
ready: 0 | ||
size: 3 | ||
status: error | ||
size: 9 | ||
state: error |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/initializing.yaml
This file contains 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 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
mongos: | ||
ready: 0 | ||
size: 3 | ||
status: initializing | ||
observedGeneration: 1 | ||
ready: 0 | ||
replsets: | ||
cfg: | ||
initialized: false | ||
ready: 0 | ||
size: 3 | ||
status: initializing | ||
rs0: | ||
initialized: false | ||
ready: 0 | ||
size: 3 | ||
status: initializing | ||
size: 9 | ||
state: initializing |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/paused.yaml
This file contains 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 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
mongos: | ||
ready: 0 | ||
size: 3 | ||
status: paused | ||
observedGeneration: 1 | ||
ready: 0 | ||
replsets: | ||
cfg: | ||
initialized: true | ||
ready: 0 | ||
size: 3 | ||
status: paused | ||
rs0: | ||
initialized: true | ||
ready: 0 | ||
size: 3 | ||
status: paused | ||
size: 9 | ||
state: paused |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/ready.yaml
This file contains 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 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
mongos: | ||
ready: 3 | ||
size: 3 | ||
status: ready | ||
observedGeneration: 1 | ||
ready: 9 | ||
replsets: | ||
cfg: | ||
initialized: true | ||
ready: 3 | ||
size: 3 | ||
status: ready | ||
rs0: | ||
initialized: true | ||
ready: 3 | ||
size: 3 | ||
status: ready | ||
size: 9 | ||
state: ready |
25 changes: 25 additions & 0 deletions
25
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/stopping.yaml
This file contains 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 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
mongos: | ||
ready: 2 | ||
size: 3 | ||
status: stopping | ||
observedGeneration: 1 | ||
ready: 6 | ||
replsets: | ||
cfg: | ||
initialized: true | ||
ready: 2 | ||
size: 3 | ||
status: stopping | ||
rs0: | ||
initialized: true | ||
ready: 2 | ||
size: 3 | ||
status: stopping | ||
size: 9 | ||
state: stopping |
10 changes: 10 additions & 0 deletions
10
resource_customizations/psmdb.percona.com/PerconaServerMongoDB/testdata/unknown.yaml
This file contains 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,10 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: cluster | ||
spec: {} | ||
status: | ||
observedGeneration: 1 | ||
ready: 0 | ||
size: 0 | ||
state: "" |