Skip to content

Commit a4b6378

Browse files
authored
Merge branch 'main' into issues/729
2 parents cda283f + ed49499 commit a4b6378

File tree

24 files changed

+531
-55
lines changed

24 files changed

+531
-55
lines changed

.dev/dev_arm64.yaml renamed to .dev/dev.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# This is a compose file designed for arm64/Apple Silicon systems
2-
# To adapt this to x86 please find and replace ".arm64" with empty
3-
4-
# ARM64 supported images for kafka can be found here
5-
# https://hub.docker.com/r/confluentinc/cp-kafka/tags?page=1&name=arm64
6-
---
71
version: '3.8'
82
name: "kafbat-ui-dev"
93

@@ -32,7 +26,7 @@ services:
3226
KAFKA_CLUSTERS_0_AUDIT_CONSOLEAUDITENABLED: 'true'
3327

3428
kafka0:
35-
image: confluentinc/cp-kafka:7.8.0.arm64
29+
image: confluentinc/cp-kafka:7.8.0
3630
user: "0:0"
3731
hostname: kafka0
3832
container_name: kafka0
@@ -60,7 +54,7 @@ services:
6054
CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk'
6155

6256
schema-registry0:
63-
image: confluentinc/cp-schema-registry:7.8.0.arm64
57+
image: confluentinc/cp-schema-registry:7.8.0
6458
ports:
6559
- 8085:8085
6660
depends_on:
@@ -76,7 +70,7 @@ services:
7670
SCHEMA_REGISTRY_KAFKASTORE_TOPIC: _schemas
7771

7872
kafka-connect0:
79-
image: confluentinc/cp-kafka-connect:7.8.0.arm64
73+
image: confluentinc/cp-kafka-connect:7.8.0
8074
ports:
8175
- 8083:8083
8276
depends_on:
@@ -101,7 +95,7 @@ services:
10195
CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components,/usr/local/share/kafka/plugins,/usr/share/filestream-connectors"
10296

10397
ksqldb0:
104-
image: confluentinc/cp-ksqldb-server:7.8.0.arm64
98+
image: confluentinc/cp-ksqldb-server:7.8.0
10599
depends_on:
106100
- kafka0
107101
- kafka-connect0
@@ -119,7 +113,7 @@ services:
119113
KSQL_CACHE_MAX_BYTES_BUFFERING: 0
120114

121115
kafka-init-topics:
122-
image: confluentinc/cp-kafka:7.8.0.arm64
116+
image: confluentinc/cp-kafka:7.8.0
123117
volumes:
124118
- ../documentation/compose/data/message.json:/data/message.json
125119
depends_on:

.github/workflows/cve_checks.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: "Infra: CVE checks"
22
on:
3+
pull_request:
4+
types: [ "opened", "reopened", "synchronize" ]
5+
push:
6+
branches: [ "main" ]
37
workflow_dispatch:
48
schedule:
59
# * is a special character in YAML so you have to quote this string
@@ -71,7 +75,7 @@ jobs:
7175

7276
notify:
7377
needs: check-cves
74-
if: ${{ always() && needs.build-and-test.result == 'failure' }}
78+
if: ${{ always() && needs.build-and-test.result == 'failure' && github.event_name == 'schedule' }}
7579
uses: ./.github/workflows/infra_discord_hook.yml
7680
with:
7781
message: "Attention! CVE checks run failed! Please fix them CVEs :("

.mvn/jvm.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Djava.net.useSystemProxies=true

api/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@
492492
</goals>
493493
<configuration>
494494
<arguments>build</arguments>
495+
<pnpmInheritsProxyConfigFromMaven>false</pnpmInheritsProxyConfigFromMaven>
495496
</configuration>
496497
</execution>
497498
</executions>

api/src/main/java/io/kafbat/ui/client/RetryingKafkaConnectClient.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ public Mono<ResponseEntity<Void>> pauseConnectorWithHttpInfo(String connectorNam
238238
return withRetryOnConflictOrRebalance(super.pauseConnectorWithHttpInfo(connectorName));
239239
}
240240

241+
@Override
242+
public Mono<Void> stopConnector(String connectorName) throws WebClientResponseException {
243+
return withRetryOnConflictOrRebalance(super.stopConnector(connectorName));
244+
}
245+
246+
@Override
247+
public Mono<ResponseEntity<Void>> stopConnectorWithHttpInfo(String connectorName) throws WebClientResponseException {
248+
return withRetryOnConflictOrRebalance(super.stopConnectorWithHttpInfo(connectorName));
249+
}
250+
241251
@Override
242252
public Mono<Void> restartConnector(String connectorName, Boolean includeTasks, Boolean onlyFailed)
243253
throws WebClientResponseException {
@@ -261,6 +271,18 @@ public Mono<ResponseEntity<Void>> restartConnectorTaskWithHttpInfo(String connec
261271
return withRetryOnConflictOrRebalance(super.restartConnectorTaskWithHttpInfo(connectorName, taskId));
262272
}
263273

274+
@Override
275+
public Mono<Void> resetConnectorOffsets(String connectorName)
276+
throws WebClientResponseException {
277+
return withRetryOnConflictOrRebalance(super.resetConnectorOffsets(connectorName));
278+
}
279+
280+
@Override
281+
public Mono<ResponseEntity<Void>> resetConnectorOffsetsWithHttpInfo(String connectorName)
282+
throws WebClientResponseException {
283+
return withRetryOnConflictOrRebalance(super.resetConnectorOffsetsWithHttpInfo(connectorName));
284+
}
285+
264286
@Override
265287
public Mono<Void> resumeConnector(String connectorName) throws WebClientResponseException {
266288
return withRetryOnRebalance(super.resumeConnector(connectorName));

api/src/main/java/io/kafbat/ui/config/auth/LdapSecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public AbstractLdapAuthenticationProvider authenticationProvider(LdapAuthorities
8080
}
8181

8282
@Bean
83-
@ConditionalOnProperty(value = "oauth2.ldap.activeDirectory", havingValue = "false")
83+
@ConditionalOnProperty(value = "oauth2.ldap.activeDirectory", havingValue = "false", matchIfMissing = true)
8484
public BindAuthenticator ldapBindAuthentication(LdapContextSource ldapContextSource) {
8585
BindAuthenticator ba = new BindAuthenticator(ldapContextSource);
8686

api/src/main/java/io/kafbat/ui/controller/KafkaConnectController.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import static io.kafbat.ui.model.ConnectorActionDTO.RESTART;
44
import static io.kafbat.ui.model.ConnectorActionDTO.RESTART_ALL_TASKS;
55
import static io.kafbat.ui.model.ConnectorActionDTO.RESTART_FAILED_TASKS;
6+
import static io.kafbat.ui.model.rbac.permission.ConnectAction.RESET_OFFSETS;
7+
import static io.kafbat.ui.model.rbac.permission.ConnectAction.VIEW;
68

79
import io.kafbat.ui.api.KafkaConnectApi;
810
import io.kafbat.ui.model.ConnectDTO;
@@ -285,4 +287,23 @@ private Comparator<FullConnectorInfoDTO> getConnectorsComparator(ConnectorColumn
285287
default -> defaultComparator;
286288
};
287289
}
290+
291+
@Override
292+
public Mono<ResponseEntity<Void>> resetConnectorOffsets(String clusterName, String connectName,
293+
String connectorName,
294+
ServerWebExchange exchange) {
295+
296+
var context = AccessContext.builder()
297+
.cluster(clusterName)
298+
.connectActions(connectName, VIEW, RESET_OFFSETS)
299+
.operationName("resetConnectorOffsets")
300+
.operationParams(Map.of(CONNECTOR_NAME, connectorName))
301+
.build();
302+
303+
return validateAccess(context).then(
304+
kafkaConnectService
305+
.resetConnectorOffsets(getCluster(clusterName), connectName, connectorName)
306+
.map(ResponseEntity::ok))
307+
.doOnEach(sig -> audit(context, sig));
308+
}
288309
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.kafbat.ui.exception;
2+
3+
public class ConnectorOffsetsResetException extends CustomBaseException {
4+
5+
public ConnectorOffsetsResetException(String message) {
6+
super(message);
7+
}
8+
9+
@Override
10+
public ErrorCode getErrorCode() {
11+
return ErrorCode.CONNECTOR_OFFSETS_RESET_ERROR;
12+
}
13+
}

api/src/main/java/io/kafbat/ui/exception/ErrorCode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public enum ErrorCode {
3232
TOPIC_ANALYSIS_ERROR(4018, HttpStatus.BAD_REQUEST),
3333
FILE_UPLOAD_EXCEPTION(4019, HttpStatus.INTERNAL_SERVER_ERROR),
3434
CEL_ERROR(4020, HttpStatus.BAD_REQUEST),
35+
CONNECTOR_OFFSETS_RESET_ERROR(4021, HttpStatus.BAD_REQUEST),
3536
;
3637

3738
static {

api/src/main/java/io/kafbat/ui/model/rbac/permission/ConnectAction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public enum ConnectAction implements PermissibleAction {
1010
EDIT(VIEW),
1111
CREATE(VIEW),
1212
RESTART(VIEW),
13-
DELETE(VIEW)
13+
DELETE(VIEW),
14+
RESET_OFFSETS(VIEW)
1415

1516
;
1617

@@ -20,7 +21,7 @@ public enum ConnectAction implements PermissibleAction {
2021
this.dependantActions = dependantActions;
2122
}
2223

23-
public static final Set<ConnectAction> ALTER_ACTIONS = Set.of(CREATE, EDIT, DELETE, RESTART);
24+
public static final Set<ConnectAction> ALTER_ACTIONS = Set.of(CREATE, EDIT, DELETE, RESTART, RESET_OFFSETS);
2425

2526
@Nullable
2627
public static ConnectAction fromString(String name) {

0 commit comments

Comments
 (0)