Skip to content

Commit

Permalink
fix: replace update with patch calls
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Laprun <[email protected]>
  • Loading branch information
metacosm committed Apr 25, 2024
1 parent 06d8f09 commit 2548b92
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public UpdateControl<Secret> reconcile(Secret secret, Context context) {
final String foo = data.putIfAbsent("quarkus-operator-sdk.added-value",
Base64.getEncoder().encodeToString("quarkus-operator-sdk rocks!".getBytes()));
if (foo == null) {
return UpdateControl.updateResource(secret);
return UpdateControl.patchResource(secret);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public UpdateControl<ExposedApp> reconcile(ExposedApp exposedApp, Context<Expose
context.getSecondaryResource(Ingress.class).orElseThrow());
exposedApp.setStatus(new ExposedAppStatus(url, exposedApp.getSpec().getEndpoint()));
log.info("App {} is exposed and ready to be used at {}", name, exposedApp.getStatus().getHost());
return UpdateControl.updateStatus(exposedApp);
return UpdateControl.patchStatus(exposedApp);
} else {
final var duration = Duration.ofSeconds(1);
log.info("App {} is not ready yet, rescheduling reconciliation after {}s", name, duration.toSeconds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ public UpdateControl<JokeRequest> reconcile(JokeRequest jr, Context<JokeRequest>
}

jr.setStatus(status);
return UpdateControl.updateStatus(jr);
return UpdateControl.patchStatus(jr);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public UpdateControl<MySQLSchema> reconcile(MySQLSchema schema, Context<MySQLSch
updateStatusPojo(schema, secret.getMetadata().getName(),
decode(secret.getData().get(MYSQL_SECRET_USERNAME)));
Log.infof("Schema %s created - updating CR status", s.getName());
return UpdateControl.updateStatus(schema);
return UpdateControl.patchStatus(schema);
}).orElse(UpdateControl.noUpdate()))
.orElse(UpdateControl.noUpdate());
}
Expand All @@ -58,7 +58,7 @@ public ErrorStatusUpdateControl<MySQLSchema> updateErrorStatus(MySQLSchema schem
status.setStatus("ERROR: " + e.getMessage());
schema.setStatus(status);

return ErrorStatusUpdateControl.updateStatus(schema);
return ErrorStatusUpdateControl.patchStatus(schema);
}

private void updateStatusPojo(MySQLSchema schema, String secretName, String userName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public UpdateControl<Ping> reconcile(Ping ping, Context<Ping> context) {
}

ping.setStatus(new Status(Status.State.PROCESSED));
return UpdateControl.updateStatus(ping);
return UpdateControl.patchStatus(ping);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;

@SuppressWarnings("unused")
@ControllerConfiguration(namespaces = WATCH_CURRENT_NAMESPACE)
public class PongReconciler implements Reconciler<Pong> {

Expand All @@ -32,6 +33,6 @@ public UpdateControl<Pong> reconcile(Pong pong, Context<Pong> context) {
}

pong.setStatus(new Status(Status.State.PROCESSED));
return UpdateControl.updateStatus(pong);
return UpdateControl.patchStatus(pong);
}
}

0 comments on commit 2548b92

Please sign in to comment.