Skip to content

Commit

Permalink
fixing rack-id issue in operator upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed May 10, 2024
1 parent aa5ad48 commit a29ff51
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/v1/aerospikecluster_mutating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (c *AerospikeCluster) Default(operation v1.Operation) admission.Response {
func (c *AerospikeCluster) setDefaults(asLog logr.Logger) error {
// Set maxUnavailable default to 1
if !GetBool(c.Spec.DisablePDB) && c.Spec.MaxUnavailable == nil {
maxUnavailable := intstr.FromInt(1)
maxUnavailable := intstr.FromInt32(1)
c.Spec.MaxUnavailable = &maxUnavailable
}

Expand Down Expand Up @@ -403,6 +403,13 @@ func setDefaultNsConf(asLog logr.Logger, configSpec AerospikeConfigSpec,
if rackID != nil {
// Add rack-id only in rack specific config, not in global config
defaultConfs := map[string]interface{}{"rack-id": *rackID}

// Delete rack-id from namespace in rack specific config if set to 0
// This could happen in operator below 3.3.0
if id, ok := nsMap["rack-id"]; ok && id == float64(0) && *rackID != 0 {
delete(nsMap, "rack-id")
}

if err := setDefaultsInConfigMap(
asLog, nsMap, defaultConfs,
); err != nil {
Expand Down

0 comments on commit a29ff51

Please sign in to comment.