Skip to content
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

feat: resource customization for psmdb.percona.com/PerconaServerMongoDB #20628

Merged
merged 7 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ""
Loading