Skip to content

Commit a4c2ab0

Browse files
committed
feat: support to update SGStream spec when locked
1 parent 7bc5336 commit a4c2ab0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/validation/stream/StatusLockValidator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
@Singleton
2727
@ValidationType(ErrorType.FORBIDDEN_STREAM_UPDATE)
28-
public class LockValidator implements StreamValidator {
28+
public class StatusLockValidator implements StreamValidator {
2929

3030
final ObjectMapper objectMapper;
3131
final int duration;
3232

3333
@Inject
34-
public LockValidator(OperatorPropertyContext operatorPropertyContext,
34+
public StatusLockValidator(OperatorPropertyContext operatorPropertyContext,
3535
ObjectMapper objectMapper) {
3636
this.duration = operatorPropertyContext.getInt(OperatorProperty.LOCK_DURATION);
3737
this.objectMapper = objectMapper;
@@ -45,8 +45,8 @@ public void validate(StackGresStreamReview review) throws ValidationFailed {
4545
case UPDATE: {
4646
StackGresStream stream = review.getRequest().getObject();
4747
StackGresStream oldStream = review.getRequest().getOldObject();
48-
if (Objects.equals(objectMapper.valueToTree(stream.getSpec()),
49-
objectMapper.valueToTree(oldStream.getSpec()))) {
48+
if (Objects.equals(objectMapper.valueToTree(stream.getStatus()),
49+
objectMapper.valueToTree(oldStream.getStatus()))) {
5050
return;
5151
}
5252
String username = review.getRequest().getUserInfo().getUsername();
@@ -59,7 +59,7 @@ public void validate(StackGresStreamReview review) throws ValidationFailed {
5959
getServiceAccountFromUsername(username))
6060
)
6161
) {
62-
fail("SGStream update is forbidden. It is locked by the SGStream"
62+
fail("SGStream status update is forbidden. It is locked by the SGStream"
6363
+ " that is currently running. Please, wait for the operation to finish,"
6464
+ " stop the operation by deleting it or wait for the lock duration of "
6565
+ duration + " seconds to expire.");

0 commit comments

Comments
 (0)