-
Notifications
You must be signed in to change notification settings - Fork 38
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
Changing 0 rack-id to correct rack id in rackConfig namespaces #288
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -411,6 +418,8 @@ func setDefaultNsConf(asLog logr.Logger, configSpec AerospikeConfigSpec, | |
err, | ||
) | ||
} | ||
} else { | ||
delete(nsMap, "rack-id") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an explanation of this delete. |
||
} | ||
} else { | ||
// User may have added this key or may have patched object with new smaller rackEnabledNamespace list | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"fmt" | ||
"io/fs" | ||
"path/filepath" | ||
"regexp" | ||
"strings" | ||
"text/template" | ||
|
||
|
@@ -106,6 +107,14 @@ func (r *SingleClusterReconciler) createConfigMapData(rack *asdbv1.Rack) ( | |
|
||
confData[aerospikeTemplateConfFileName] = confTemp | ||
|
||
// This field value is rectified in 3.3.0. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace the comment rack-id was historically set to 0 for all namespaces, but since the AKO 3.3.0, it reflects actual values. This change led to hash mismatches during the AKO 3.3.0 upgrade, triggering unnecessary warm restarts. Solution: Replace real rack-id with 0 in hash calculations to avoid this issue. |
||
// Ignore rack-id change from hash computation so that on upgrade clusters are | ||
// not rolling restarted. | ||
re := regexp.MustCompile(`rack-id.*\d+`) | ||
if rackStr := re.FindString(confTemp); rackStr != "" { | ||
confTemp = strings.ReplaceAll(confTemp, rackStr, "rack-id 0") | ||
} | ||
|
||
// Add conf hash | ||
confHash, err := utils.GetHash(confTemp) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a bit of detailed comment.