Conversation
don't skip hidden in setVotes fix physical restores with hidden members e2e test fix smart update
| if h.LivenessProbe == nil { | ||
| h.LivenessProbe = new(LivenessProbeExtended) | ||
| } | ||
| if h.LivenessProbe.InitialDelaySeconds < 1 { | ||
| h.LivenessProbe.InitialDelaySeconds = rs.LivenessProbe.InitialDelaySeconds | ||
| } | ||
| if h.LivenessProbe.TimeoutSeconds < 1 { | ||
| h.LivenessProbe.TimeoutSeconds = rs.LivenessProbe.TimeoutSeconds | ||
| } | ||
| if h.LivenessProbe.PeriodSeconds < 1 { | ||
| h.LivenessProbe.PeriodSeconds = rs.LivenessProbe.PeriodSeconds | ||
| } | ||
| if h.LivenessProbe.FailureThreshold < 1 { | ||
| h.LivenessProbe.FailureThreshold = rs.LivenessProbe.FailureThreshold | ||
| } | ||
| if h.LivenessProbe.StartupDelaySeconds < 1 { | ||
| h.LivenessProbe.StartupDelaySeconds = rs.LivenessProbe.StartupDelaySeconds | ||
| } | ||
| if h.LivenessProbe.ProbeHandler.Exec == nil { | ||
| h.LivenessProbe.Probe.ProbeHandler.Exec = &corev1.ExecAction{ | ||
| Command: []string{"/opt/percona/mongodb-healthcheck", "k8s", "liveness"}, | ||
| } | ||
|
|
||
| if cr.TLSEnabled() { | ||
| h.LivenessProbe.Probe.ProbeHandler.Exec.Command = append( | ||
| h.LivenessProbe.Probe.ProbeHandler.Exec.Command, | ||
| "--ssl", "--sslInsecure", "--sslCAFile", "/etc/mongodb-ssl/ca.crt", "--sslPEMKeyFile", "/tmp/tls.pem", | ||
| ) | ||
| } | ||
| } | ||
| startupDelaySecondsFlag := "--startupDelaySeconds" | ||
| if !h.LivenessProbe.CommandHas(startupDelaySecondsFlag) { | ||
| h.LivenessProbe.ProbeHandler.Exec.Command = append( | ||
| h.LivenessProbe.ProbeHandler.Exec.Command, | ||
| startupDelaySecondsFlag, strconv.Itoa(h.LivenessProbe.StartupDelaySeconds)) | ||
| } |
There was a problem hiding this comment.
optional: Given that this whole block is focused on liveness, maybe we could extract it to a function like the following:
func (h *HiddenSpec) setLivenessProbe(cr *PerconaServerMongoDB, rs *ReplsetSpec)
It is not that the current share is complicated or anything, but I think the extraction helps readability. Right now has too much detail.
There was a problem hiding this comment.
We can do something similar for the readiness probe.
| case naming.ComponentNonVoting: | ||
| pdbspec = rs.NonVoting.PodDisruptionBudget | ||
| volumeSpec = rs.NonVoting.VolumeSpec | ||
| case naming.ComponentHidden: |
There was a problem hiding this comment.
Given that we added a new case of replsets, I think it would be nice to have a new test case in our statefulset_test.go file, on the TestReconcileStatefulSet set. We have already covered these:
- mongod
- arbiter
- non-voting
| member.Tags = util.MapMerge(mongo.ReplsetTags{ | ||
| naming.ComponentHidden: "true", | ||
| }, tags) | ||
| member.Priority = 0 |
There was a problem hiding this comment.
From what I understand by reading the documentation, the only configuration needed to setup a hidden replica set contains these 2 properties: 1) priority 0 and 2) the hidden tag equal to true. Correct?
ba7f7d9 to
8350a68
Compare
commit: 18ea724 |
CHANGE DESCRIPTION
This PR makes it possible to deploy hidden replicaset members. Implementation is almost identical to non-voting members: Operator will create a separate statefulset for hidden members and properyly configure them in replset.
Hidden members are tested together with non-voting members in
non-voting-and-hiddentest.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability