Repository navigation
feat: replace KUBERNETES_M2M_ENABLED with M2M_AUTH_MODE - #213
Merged
Merged
Conversation
Covers the direct address when the Kubernetes token is accepted, the uncached target after a failed fallback, and the built client reading KUBERNETES_M2M_ENABLED, so the switch to M2M_AUTH_MODE can be checked against the current behavior.
The boolean flag could not express a cluster that uses only Kubernetes tokens: with KUBERNETES_M2M_ENABLED=true the M2M client still fell back to the legacy token and the DBaaS and MaaS clients to their agents, and any value other than true silently meant false. M2M_AUTH_MODE takes legacy (the default and the former false), hybrid (the former true), or k8s, which sends only the Kubernetes token, never falls back, and does not need keycloakTokenSupplier. An unsupported value, true and false included, throws IllegalArgumentException when a client is built, so a misconfigured service fails at startup. In k8s mode the DBaaS and MaaS clients require api.dbaas.address and maas.internal.address and throw IllegalStateException at creation without them. M2MClientBuilder.k8sM2mEnabled(boolean), M2MClient.isK8sM2mEnabled(), the boolean M2MInterceptor constructors, and Env.apiUrl(boolean) move to M2MAuthMode. The feature is unreleased, so there is no deprecation. Refs: Netcracker/qubership-core-infra#428
…IllegalStateException M2MClientBuilder.build now throws IllegalStateException instead of NullPointerException when keycloakTokenSupplier is missing outside k8s mode, and M2MAuthMode.ENV becomes M2M_AUTH_MODE_ENV. Also trims the new documentation and drops the CHANGELOG entry. Refs: Netcracker/qubership-core-infra#428
This was referenced Sep 30, 2026
Merged
An empty api.dbaas.address in Spring passed the k8s check and became the DBaaS URL, and an empty maas.internal.address failed URL parsing with IllegalArgumentException even in legacy mode. Now k8s rejects an empty address and hybrid falls back to the agent. Part of Netcracker/qubership-core-infra#428.
This was referenced Oct 1, 2026
…ybrid mode The hybrid path fell back only on IllegalStateException and IllegalArgumentException. A token file that exists but cannot be read surfaces as a RuntimeException, so the request failed instead of using the legacy token. Part of Netcracker/qubership-core-infra#428.
|
Ksiona
approved these changes
Oct 5, 2026
alsergs
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part of Netcracker/qubership-core-infra#428.
Replaces the boolean
KUBERNETES_M2M_ENABLEDwithM2M_AUTH_MODEin the Java M2M, DBaaS, and MaaS clients:legacy(default, the formerfalse)hybrid(the formertrue)api.dbaas.address,maas.internal.address, or the agent when not setk8sM2MAuthMode.readFromEnv()in k8s-utils is the single parser. An unsupported value fails the service at startup.maas.internal.addressfrom a system property or MicroProfile Config, then from theMAAS_INTERNAL_ADDRESSenvironment variable, so Spring services get the address from their chart.k8s,keycloakTokenSupplierofM2MClientis optional.Breaking API, without deprecation:
M2MClient.isK8sM2mEnabled()M2MAuthMode.readFromEnv()M2MClientBuilder.k8sM2mEnabled(boolean)M2MClientBuilder.mode(M2MAuthMode)new M2MInterceptor(boolean, ...)new M2MInterceptor(M2MAuthMode, ...)Env.apiUrl(boolean)Env.apiUrl(M2MAuthMode)