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

EVEREST-1618: affinity per component #592

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

michal-kralik
Copy link
Contributor

@michal-kralik michal-kralik commented Nov 22, 2024

CHANGE DESCRIPTION

Problem:
EVEREST-1618

Short explanation of the problem.
Add configuration of affinity per component.
The affinity configuration is forwarded to the respective operator.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?

Tests

  • Is an Integration test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

@michal-kralik michal-kralik marked this pull request as ready for review November 25, 2024 11:27
@michal-kralik michal-kralik enabled auto-merge (squash) November 25, 2024 11:28
@@ -126,6 +126,9 @@ func (p *applier) Engine() error {
if p.DB.Status.Status == everestv1alpha1.AppStateReady {
pxc.Spec.PXC.PodSpec.Affinity = p.currentPerconaXtraDBClusterSpec.PXC.Affinity
}

p.configureEngineAffinity()
Copy link
Collaborator

@recharte recharte Nov 25, 2024

Choose a reason for hiding this comment

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

I think we need to do some cleanup above because we were setting some default affinity that we got from common.DefaultAffinitySettings.
Besides cleaning up those defaults, we should also ensure that we don't change the affinity for existing clusters (see the if condition 4 lines above this comment) otherwise all DB clusters would restart when upgrading the everest operator to 1.5.

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'm not sure I follow.
Re restarts - the p.configureEngineAffinity() triggers a change only in case you configure affinity configuration for an Engine.
Since the spec does not support affinity at the moment, existing clusters shall not be affected.

Re cleanup - the line

p.Spec.PXC.Affinity.Advanced = affinity
cleans up previous affinity settings. Is there anything else you had in mind?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right when you say that this keeps the backward compatibility and won't lead to any restarts because the field will be empty in existing DBCs but please read on...

the p.configureEngineAffinity() triggers a change only in case you configure affinity configuration for an Engine.

This is actually a deviation from what we envisioned as the intended behavior.
The initial idea was that the affinity field in the DBC spec would be the source of truth, if it was empty there would be no affinity rules applied to the PXC CR. With the current implementation, this is not possible, we'll always have at least the default rule from common.DefaultAffinitySettings() and it will get overwritten by whatever the user inputs in the affinity field. Ultimately, this means that users won't be able to delete all affinity rules.

Always taking the affinity from the DBC spec would be an easy implementation change. However, I don't know how we would be able to ensure that existing DBs wouldn't be affected. The affinity field would need to be automatically populated with the value from common.DefaultAffinitySettings() in order to keep the existing behavior. 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right.
I thought it's better not to restart the DB and keep the behavior consistent across minor versions.
Happy to change this in a way which makes more sense. It doesn't seem to be possible to determine if the default affinity settings are expected if affinity is not provided.

Copy link
Collaborator

@recharte recharte left a comment

Choose a reason for hiding this comment

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

@michal-kralik since this PR will apply the affinity configuration that we get from the UI we need to hold this PR until the FE has also implemented this change 🙂 (Disabled auto-merge)

@michal-kralik
Copy link
Contributor Author

since this PR will apply the affinity configuration that we get from the UI we need to hold this PR until the FE has also implemented this change 🙂 (Disabled auto-merge)

The change will not have any effect if an affinity configuration is not provided. Without the UI change, the behavior will be the same regardless if the PR gets merged.
Why do you think it's important we wait for the UI?

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.

4 participants