csviri opened a new pull request, #707:
URL: https://github.com/apache/spark-kubernetes-operator/pull/707
### What changes were proposed in this pull request?
Reworks the dynamic-config feature so the operator no longer runs a
dedicated `Operator` instance with a ConfigMap informer. Instead, the
dynamic-config ConfigMap is mounted into the operator pod as a volume, and a
new `DynamicConfigMonitor`
periodically re-reads the properties file from disk. When the file content
changes, `SparkOperatorConfManager` is refreshed and the watched-namespaces
updater is invoked, exactly as the previous `SparkOperatorConfigMapReconciler`
did.
Key changes:
- **New `DynamicConfigMonitor`** (`config/DynamicConfigMonitor.java`) —
single-thread scheduled reader of a properties file, with `start()` / `stop()`
/ `isRunning()` lifecycle and change detection against the previously loaded
snapshot.
- **`SparkOperator`** simplified from a `List<Operator>` to a single
`Operator` plus an optional `DynamicConfigMonitor`. The second JOSDK `Operator`
instance and `overrideConfigMonitorConfigs(...)` are gone.
- **Removed** `SparkOperatorConfigMapReconciler` and its tests.
- **Config**: `spark.kubernetes.operator.dynamicConfig.selector` is
replaced by:
- `spark.kubernetes.operator.dynamicConfig.filePath` (default
`/opt/spark-operator/dynamic-conf/spark-operator-dynamic.properties`)
- `spark.kubernetes.operator.dynamicConfig.reloadIntervalSeconds`
(default `60`)
- **Helm chart**:
- Drops the `Role` / `RoleBinding` granting `configmaps: '*'` to the
operator service account (no longer needed — kubelet projects the ConfigMap
onto the pod).
- Mounts the `spark-kubernetes-operator-dynamic-configuration` ConfigMap
under `/opt/spark-operator/dynamic-conf` when
`operatorConfiguration.dynamicConfig.enable` is true.
- The dynamic ConfigMap now stores entries under the single key
`spark-operator-dynamic.properties` (a properties-formatted blob) instead of
one ConfigMap key per property.
- **Probes** (`HealthProbe`, `ReadinessProbe`, `ProbeService`,
`ProbeUtil`): switched from `List<Operator>` to a single `Operator`, and the
dynamic-config monitor's running state is now part of both `/healthz` and
`/readyz`.
`areOperatorsStarted` collapses to `isOperatorStarted`.
### Why are the changes needed?
The informer-based approach required the operator to hold
cluster/namespace RBAC on ConfigMaps and ran a second JOSDK `Operator` purely
to watch a single ConfigMap. Mounting the ConfigMap directly is simpler,
removes the RBAC requirement,
and avoids the second informer's failure modes. The kubelet already
propagates ConfigMap edits to mounted volumes, so polling the file gives
equivalent behavior with much less moving machinery.
### Does this PR introduce any user-facing change?
Yes. For users with `dynamicConfig.enable: true`:
- The dynamic ConfigMap is consumed via a volume mount, not via the API
server.
- `dynamicConfig.selector` no longer has any effect; use
`dynamicConfig.filePath` / `dynamicConfig.reloadIntervalSeconds` instead.
- The dynamic ConfigMap data layout changes — the Helm template now
renders a single `spark-operator-dynamic.properties` key. Hand-managed dynamic
ConfigMaps must be migrated to the same shape.
- The `configmaps: '*'` `Role` / `RoleBinding` previously created by the
chart is removed.
### How was this patch tested?
- New unit tests in `DynamicConfigMonitorTest` covering initial load,
no-op reload when file is unchanged, refresh + namespace-update on change, and
`isRunning()` lifecycle.
- Updated `SparkOperatorTest`, `HealthProbeTest`, `ReadinessProbeTest`,
`ProbeServiceTest` for the single-operator + monitor signatures.
- Removed `SparkOperatorConfigMapReconcilerTest`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]