Skip to content

Publish refreshed FromConfigMap data as a coherent snapshot #4975

Open

Description

@brendandburns

Problem

KubernetesFromConfigMapProcessor injects a live Caffeine map, then refreshes it by putting new entries one at a time and deleting obsolete entries afterward. Readers can observe partially applied configuration, containing a mix of old/new values and obsolete keys. The implementation already contains a TODO noting that refresh should be atomic.

Location: spring/src/main/java/io/kubernetes/client/spring/extended/manifests/KubernetesFromConfigMapProcessor.java:80-89,95-110.

Reproduction

Refresh a ConfigMap that changes several related keys and removes others while another thread iterates/copies the injected map. The reader can observe an intermediate state that is neither the old nor the new ConfigMap.

Impact

Inconsistent configuration snapshots can cause application errors during refresh. Suggested priority: medium.

Requested fix and acceptance criteria

  • Publish each successfully fetched ConfigMap as a complete snapshot while keeping previously injected Map references live and updating.
  • Define the supported consistency guarantee precisely, including iteration/snapshot reads. Do not claim transactional consistency across unrelated Map.get calls that straddle a refresh.
  • Preserve existing supported Map behavior, or explicitly document and test any necessary compatibility change. Avoid a one-time field replacement that leaves retained Map references permanently stale.
  • Keep deletion/null-data behavior correct.
  • Add deterministic concurrency/regression coverage demonstrating coherent snapshot observation and continued visibility of later updates through the original injected reference.
  • Separate issues address refresh exception recovery, cadence, and polling cache isolation. Keep this PR focused on publication semantics.

Agent instructions

Implement the simplest complete fix, run relevant tests, and open a pull request referencing and closing this issue. Follow the repository's PR template and contribution conventions. Other agents may change this processor; keep the patch focused and account for overlap when integrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions