[SPARK-57131] Provide configuration option to specify ConfigMap name for dynamic configs#695
Open
csviri wants to merge 3 commits into
Open
[SPARK-57131] Provide configuration option to specify ConfigMap name for dynamic configs#695csviri wants to merge 3 commits into
csviri wants to merge 3 commits into
Conversation
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you, @csviri .
Could you clarify in the documentation that this makes spark.kubernetes.operator.dynamicConfig.selector obsolete? When we allow only one name exactly, why do we make a redundant and inefficient API call with selector. Technically, this PR proposes to make spark.kubernetes.operator.dynamicConfig.selector have no meaning.
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.
What changes were proposed in this pull request?
This PR makes the dynamic-config ConfigMap name an explicit, configurable property and enforces it in the reconciler:
spark.kubernetes.operator.dynamicConfig.name(default:spark-kubernetes-operator-dynamic-configuration) inSparkOperatorConf.SparkOperatorConfigMapReconciler#reconcile, short-circuits withUpdateControl.noUpdate()when the incoming ConfigMap's name does not match the configured value — so only the operator's intended ConfigMap can mutateSparkOperatorConfManagerstate and trigger a watched-namespace update.docs/config_properties.md.Why are the changes needed?
Previously the reconciler trusted any ConfigMap that matched the label selector configured via
spark.kubernetes.operator.dynamicConfig.selectorin the operator namespace. A user withcreate configmappermission in theoperator namespace (but no broader operator privileges) could create a ConfigMap that matches the selector to:
spark.kubernetes.operator.watchedNamespacesand force the operator to start watching/reconciling namespaces it should not have access to.Pinning the reconciler to a specific, configurable ConfigMap name closes this privilege-escalation path: a rogue ConfigMap with the right labels but a different name is now ignored.
Does this PR introduce any user-facing change?
Yes (configuration). A new property is added:
spark.kubernetes.operator.dynamicConfig.namespark-kubernetes-operator-dynamic-configurationOperators that previously relied on a differently-named ConfigMap matching the dynamic-config selector must either rename their ConfigMap to the default value or set
spark.kubernetes.operator.dynamicConfig.nameto theexisting name. The default matches the name used by the project's Helm chart, so standard deployments are unaffected.
How was this patch tested?
Added unit tests in
SparkOperatorConfigMapReconcilerTest:reconcileSkipsConfigMapWithNonMatchingName— a ConfigMap with a non-matching name is reconciled; verifies neithernamespaceUpdaternorwatchedNamespacesGetterare invoked and the rogue data does not leak intoSparkOperatorConfManager.configOverrides.reconcileRefreshesConfigForMatchingName— a ConfigMap with the configured name triggers the refresh path and the namespace-update callbacks; verifies the override is applied.reconcileHonorsCustomConfiguredConfigMapName— whendynamicConfig.nameis set to a custom value, the default-named ConfigMap is rejected and the custom-named one is processed.sanityTest, usingEnableKubeAPIServer) was updated to use the matching ConfigMap name so it continues to exercise the end-to-end refresh path.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)