Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ public R create(R desired, P primary, Context<P> context) {
}

public R update(R actual, R desired, P primary, Context<P> context) {
boolean useSSA = useSSA(context);
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useSSA(context) method is called twice in the original code (lines 87 and 95). Caching the result in a local variable is a good optimization that eliminates the duplicate method call.

Copilot uses AI. Check for mistakes.

if (log.isDebugEnabled()) {
log.debug(
"Updating actual resource: {} version: {}",
"Updating actual resource: {} version: {}; SSA: {}",
ResourceID.fromResource(actual),
actual.getMetadata().getResourceVersion());
actual.getMetadata().getResourceVersion(),
useSSA);
}
R updatedResource;
addMetadata(false, actual, desired, primary, context);
if (useSSA(context)) {
if (useSSA) {
updatedResource =
prepare(context, desired, primary, "Updating")
.fieldManager(context.getControllerConfiguration().fieldManager())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ private P updateCustomResourceWithFinalizer(P resourceForExecution, P originalRe
}

private P patchResource(P resource, P originalResource) {
log.debug("Updating resource: {} with version: {}", getUID(resource), getVersion(resource));
log.debug(
"Updating resource: {} with version: {}; SSA: {}",
getUID(resource),
getVersion(resource),
useSSA);
log.trace("Resource before update: {}", resource);

final var finalizerName = configuration().getFinalizerName();
Expand Down