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

Fix sentinel refresh and nil pointer issue #77

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

linglingye001
Copy link
Contributor

No description provided.

@@ -76,6 +76,7 @@ func (processor *AppConfigurationProviderProcessor) processFullReconciliation()
processor.RefreshOptions.ConfigMapSettingPopulated = true
processor.RefreshOptions.updatedKeyValueETags = updatedSettings.KeyValueETags
processor.RefreshOptions.updatedFeatureFlagETags = updatedSettings.FeatureFlagETags
processor.RefreshOptions.updatedSentinelETags = updatedSettings.SentinelETags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we check if the returned updatedSettings.SentinelETags is not nil, then we also change the processor.RefreshOptions.sentinelChanged=true? Then we don't have to add additional check in Finish()

Copy link
Contributor

@RichardChen820 RichardChen820 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing this we can also ensure that the processor.ReconciliationState.SentinelETags would never be set to nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be 2 scenarios when shouldReconcile is true. User adds monitoring section or removes it. If no sentinel is setup, we need to make sure the ReconciliationState.SentinelETags be updated to empty list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that sentinelETags should not be nil.

// Initialize the updatedETags with the current eTags
refreshedETags[sentinel] = eTag
}
for sentinel, currentETag := range eTags {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add a nil check for the eTags?

@linglingye001 linglingye001 merged commit 9997638 into release/v2/stable Nov 1, 2024
3 checks passed
@linglingye001 linglingye001 deleted the linglingye/fixSentinel branch November 1, 2024 08:53
linglingye001 added a commit that referenced this pull request Nov 8, 2024
* fix sentinel refresh and nil pointer

* update

* avoid return nil sentinelETags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants