dongjoon-hyun opened a new pull request, #853:
URL: https://github.com/apache/spark-kubernetes-operator/pull/853

   ### What changes were proposed in this pull request?
   
   This PR makes the initial lookup of 
`ReconcilerUtils.getOrCreateSecondaryResource` strict. A new private 
`getResourceStrictly` returns an empty `Optional` only for `HTTP_NOT_FOUND` and 
rethrows every other `KubernetesClientException`.
   
   The two reads inside the retry loop stay lenient, since a failed read there 
only means that the create has to be retried. The public 
`ReconcilerUtils.getResource` keeps its lenient contract and now logs a warning 
instead of swallowing the failure silently.
   
   This was raised by @peter-toth while reviewing #847.
   
   ### Why are the changes needed?
   
   `getResource` returned an empty `Optional` for a 404 and then fell through 
to `return Optional.ofNullable(resource)` for every other code, so a 403, a 500 
or a network failure was indistinguishable from "not found". 
`getOrCreateSecondaryResource` then went on to create a resource whose state it 
had not been able to read. Not knowing whether a resource exists is not the 
same as knowing that it does not.
   
   `ReconcilerUtils` is annotated with `@SuppressWarnings("PMD.GodClass")` 
because the class already sits exactly at the rule's WMC threshold, so adding 
any method to it trips `GodClass`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Pass the. Is.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5


-- 
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]

Reply via email to