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

CORE-7343 License: add fallback license env var #23583

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

pgellert
Copy link
Contributor

@pgellert pgellert commented Oct 1, 2024

This is part of a series of changes to verify that clusters have a valid enterprise license during major version upgrades if they use enterprise features.

This adds an environment variable that can be used to insert an enterprise license on startup into a non-compliant cluster when it is failing the license enforcement check. This should be an undocumented escape hatch we can use if we ever need to inject a license into this check if we cannot add it into the controller log via rpk cluster license set (eg. if we cannot downgrade the broker to a previous version for any reason).

Fixes https://redpandadata.atlassian.net/browse/CORE-7343

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.2.x
  • v24.1.x
  • v23.3.x

Release Notes

  • none

@pgellert pgellert requested a review from a team October 1, 2024 18:07
@pgellert pgellert self-assigned this Oct 1, 2024
@pgellert pgellert requested review from oleiman and michael-redpanda and removed request for a team October 1, 2024 18:07
@pgellert
Copy link
Contributor Author

pgellert commented Oct 1, 2024

/dt

@pgellert pgellert marked this pull request as ready for review October 1, 2024 18:08
Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

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

seems legit

tests/rptest/utils/rpenv.py Outdated Show resolved Hide resolved
@@ -309,17 +309,36 @@ void feature_manager::verify_enterprise_license() {
}

const auto& license = _feature_table.local().get_license();
auto license_missing_or_expired = !license || license->is_expired();
std::optional<security::license> fallback_license = std::nullopt;
auto fallback_license_str = std::getenv("RP_FALLBACK_ENTERPRISE_LICENSE");
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there's tons of precedent for this, but maybe

Suggested change
auto fallback_license_str = std::getenv("RP_FALLBACK_ENTERPRISE_LICENSE");
auto fallback_license_str = std::getenv("REDPANDA_FALLBACK_ENTERPRISE_LICENSE");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prior art of existing env vars:

  • Redpanda:
RP_SI_CREDS_API_ADDRESS (undocumented)
RP_BOOTSTRAP_USER (only documented Redpanda env var)
RP_FIXTURE_ENV (testing)

REDPANDA_ENVIRONMENT (undocumented, set by operator to "kubernetes", used for phone-home data)

__REDPANDA_SKIP_IAM_TOKEN (testing)
__REDPANDA_LICENSE_CHECK_INTERVAL_SEC (testing)
__REDPANDA_TOPIC_REC_DL_CHECK_MILLIS (testing)
__REDPANDA_TEST_FEATURES (testing)
__REDPANDA_TEST_FEATURE_NO_AUTO_ACTIVATE_BRAVO (testing)
__REDPANDA_LATEST_LOGICAL_VERSION (testing)
__REDPANDA_EARLIEST_LOGICAL_VERSION (testing)
__REDPANDA_TEST_DISK_SIZE (testing)
  • Rpk uses REDPANDA_ prefix
  • Wasm transforms use the REDPANDA_ prefix

So, there is no clear consistency so far, but I think it makes sense to prefer the REDPANDA_ prefix for this and env vars going forward. Some env vars also use the __ prefix, but that seems to be the pattern for test-only variables, so I think we don't want to add that for this variable.

I've changed this to REDPANDA_FALLBACK_ENTERPRISE_LICENSE now.

Copy link
Member

Choose a reason for hiding this comment

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

oh yeah, missed RP_BOOTSTRAP_USER. The __ prefix is definitely meant for "hidden" knobs, so no worries there. I don't think it's worth belaboring too much, but we might want to ask product.

@pgellert pgellert force-pushed the license/escape-hatch branch from 62cd9b9 to fb8fc5f Compare October 2, 2024 09:52
@pgellert
Copy link
Contributor Author

pgellert commented Oct 2, 2024

Force-push:

  • Rename env var to REDPANDA_FALLBACK_ENTERPRISE_LICENSE
  • Refactor test assertion

Copy link
Contributor

@michael-redpanda michael-redpanda left a comment

Choose a reason for hiding this comment

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

seems legit

too legit to quit

@vbotbuildovich
Copy link
Collaborator

new failures in https://buildkite.com/redpanda/redpanda/builds/55642#01924cfd-80f8-4475-83b8-9c35ab4bd3be:

"rptest.tests.partition_force_reconfiguration_test.PartitionForceReconfigurationTest.test_basic_reconfiguration.acks=-1.restart=True.controller_snapshots=False"

oleiman
oleiman previously approved these changes Oct 2, 2024
...instead of `const ss:string&` to allow passing in the contents of an
environment variable stored as a `char*`.
This is to make it easier to reuse the assertion and its message outside
of `redpanda.install_license`. I am going to reuse it in the next
commit.
This adds an environment variable that can be used to insert an
enterprise license on startup into a non-compliant cluster when it is
failing the license enforcement check. This should be an undocumented
escape hatch we can use if we ever need to inject a license into this
check without being able to add it into the controller log via
`rpk cluster license set` (eg. if we can't downgrade the broker to a
previous version).
@pgellert pgellert dismissed stale reviews from oleiman and michael-redpanda via 0847ba1 October 4, 2024 10:17
@pgellert pgellert force-pushed the license/escape-hatch branch from fb8fc5f to 0847ba1 Compare October 4, 2024 10:17
@pgellert
Copy link
Contributor Author

pgellert commented Oct 4, 2024

Force-push: rebased to dev now that the base PR is merged

@pgellert pgellert merged commit 9e54c0a into redpanda-data:dev Oct 4, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants