Skip to content

Commit

Permalink
psmdb.percona.com/PerconaServerMongoDB resource customization (argopr…
Browse files Browse the repository at this point in the history
…oj#20628)

Signed-off-by: Niv Amitai <[email protected]>
  • Loading branch information
niv8 authored Dec 10, 2024
1 parent 9741c06 commit 2f51067
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 0 deletions.
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
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
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
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
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
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
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
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: ""

0 comments on commit 2f51067

Please sign in to comment.