Skip to content

Commit

Permalink
fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nmarukovich committed Mar 19, 2024
1 parent c81ca24 commit a5b2605
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/apis/psmdb/v1/psmdb_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ func (rs *ReplsetSpec) setSafeDefaults(log logr.Logger) {
}

func (m *MultiAZ) reconcileOpts(cr *PerconaServerMongoDB) {
m.reconcileAffinityOpts()
m.reconcileAffinityOpts(cr)
m.reconcileTopologySpreadConstraints(cr)
if cr.CompareVersion("1.15.0") >= 0 {
if m.TerminationGracePeriodSeconds == nil || (!cr.Spec.UnsafeConf && *m.TerminationGracePeriodSeconds < 30) {
Expand Down Expand Up @@ -798,7 +798,16 @@ const AffinityOff = "none"
// - if topology key is set and the value not the one of `affinityValidTopologyKeys` - set to `defaultAffinityTopologyKey`
// - if topology key set to valuse of `AffinityOff` - disable the affinity at all
// - if `Advanced` affinity is set - leave everything as it is and set topology key to nil (Advanced options has a higher priority)
func (m *MultiAZ) reconcileAffinityOpts() {
func (m *MultiAZ) reconcileAffinityOpts(cr *PerconaServerMongoDB) {

if cr.CompareVersion("1.16.0") < 0 {
affinityValidTopologyKeys = map[string]struct{}{
AffinityOff: {},
"kubernetes.io/hostname": {},
"failure-domain.beta.kubernetes.io/zone": {},
"failure-domain.beta.kubernetes.io/region": {},
}
}
switch {
case m.Affinity == nil:
m.Affinity = &PodAffinity{
Expand Down

0 comments on commit a5b2605

Please sign in to comment.