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

Set license to be at the last part of reconciliation #7110

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

pvsune
Copy link
Contributor

@pvsune pvsune commented Nov 7, 2022

Cover letter

Setting license must be set at the end of reconciliation because it requires AdminAPI to be running.
SetLicense don't return specific errors and we don't currently enforce license in the Redpanda cluster.
This PR ignores set license errors and just requeues them after one minute.

Backport Required

  • not a bug fix
  • issue does not exist in previous branches
  • papercut/not impactful enough to backport
  • v22.2.x
  • v22.1.x
  • v21.11.x

UX changes

None

Release notes

Bug Fixes

  • Fixes license setting in Redpanda cluster

@pvsune pvsune changed the title operator: set license to be at the last part of reconciliation Set license to be at the last part of reconciliation Nov 7, 2022
@pvsune pvsune marked this pull request as ready for review November 7, 2022 00:29
@pvsune pvsune requested a review from a team as a code owner November 7, 2022 00:29
Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

Left some questions

}

// setting license should be at the last part as it requires AdminAPI to be running
if err := r.setLicense(ctx, &redpandaCluster, log); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

is the call idempotent? I mean what happens if you re-set the same license? Is redpanda fine with it or is it trying to store the same license over and over?

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 looked into this and we can't check I think if same license is present as we can't decode the one referenced in secret


// setting license should be at the last part as it requires AdminAPI to be running
if err := r.setLicense(ctx, &redpandaCluster, log); err != nil {
log.Info(fmt.Sprintf("setting license: %s", err.Error()))
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this not error? also can you say something like "error setting license, will retry in 1 minute.."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because it's expected to happen at some point (i.e. on first reconciliation while cluster is not yet ready) but I've updated it to check for that 🙏

// setting license should be at the last part as it requires AdminAPI to be running
if err := r.setLicense(ctx, &redpandaCluster, log); err != nil {
log.Info(fmt.Sprintf("setting license: %s", err.Error()))
return ctrl.Result{RequeueAfter: time.Minute * 1}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

why one minute and not rely on the default backoff scheme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is bound to happen at first reconciliation and wanted to avoid a lot of requeues

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

LGTM but let me know what the repeated call to setLicense does :)

@pvsune pvsune merged commit 35a6066 into redpanda-data:dev Nov 7, 2022
@pvsune pvsune deleted the fix/license-setting-end branch November 7, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants