akukhar opened a new pull request, #1234: URL: https://github.com/apache/flink-kubernetes-operator/pull/1234
## What is the purpose of the change When the autoscaler writes its ConfigMap, the write can be applied while its response is lost. The fabric8 client's retry then fails with 409, and the autoscaler records an error even though Kubernetes already holds the state it wrote. This change treats that conflict as a successful flush. ## Brief change log - On a 409 from the update or the create, `ConfigMapView.flush()` re-reads the ConfigMap and adopts it if its data and owner references equal the local state. Other conflicts are rethrown. - The mock resource in `ConfigMapViewTest` *now* returns a copy on every read, like the API server, so the existing conflict test still compares the stored ConfigMap with a separate local one. ## Verifying this change This change added tests and can be verified as follows: - `testFlushAdoptsAnUpdateAppliedBeforeTheClientRetried` and `testFlushAdoptsACreateAppliedBeforeTheClientRetried`: using the fabric8 client against the mock server, the first write is applied but its response arrives after the request timeout, *so the client retries and gets 409*. Both tests fail without this change. - `testFlushDoesNotAdoptAConflictingConfigMapOfAPreviousOwner`: *the flush still fails on a conflict* when the owner of the stored ConfigMap differs from the local one. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changes to the `CustomResourceDescriptors`: no - Core observer or reconciler logic that is regularly executed: yes – the autoscaler state flush, but only on a 409 ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable -- 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]
