Skip to content

Commit 8918780

Browse files
committed
Merge remote-tracking branch 'origin/improvement/BB-694/update_auth_config_schema' into w/9.1/improvement/BB-694/update_auth_config_schema
2 parents 153defe + 4f5c717 commit 8918780

File tree

8 files changed

+253
-79
lines changed

8 files changed

+253
-79
lines changed
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
ARG CLOUDSERVER_IMAGE=ghcr.io/scality/cloudserver:7.70.47
1+
ARG CLOUDSERVER_IMAGE=ghcr.io/scality/cloudserver:9.0.19
22

33
FROM ${CLOUDSERVER_IMAGE}
44

55
ADD ./config.json /conf/config.json
66

7-
# Update sources.list to use archive repositories for Buster
8-
RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list \
9-
&& sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list \
10-
&& sed -i '/buster-updates/d' /etc/apt/sources.list \
11-
&& apt update \
7+
RUN apt update \
128
&& apt install -y curl \
139
&& apt clean

.github/dockerfiles/ft/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ services:
2727
profiles: ['s3c']
2828
build:
2929
context: ../cloudserver
30+
args:
31+
CLOUDSERVER_IMAGE: "${CLOUDSERVER_IMAGE}"
3032
depends_on:
3133
- metadata
3234
ports:

.github/workflows/tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
fail-fast: false
224224
matrix:
225225
profile: [ 's3c' ]
226-
cloudserver_tag: [ '7.70.47' ]
226+
cloudserver_tag: [ '9.0.19' ]
227227
steps:
228228
- name: Checkout
229229
uses: actions/checkout@v4
@@ -251,7 +251,7 @@ jobs:
251251
working-directory: .github/dockerfiles/ft
252252
- name: Create Zookeeper paths for tests with metadata
253253
run: |-
254-
# Setup zookeeper paths for backbeat like we do in federation
254+
# Setup zookeeper paths for backbeat like we do in federation
255255
docker exec ft-kafka-1 /opt/kafka_2.11-0.10.1.0/bin/zookeeper-shell.sh localhost:2181 create /backbeat ""
256256
docker exec ft-kafka-1 /opt/kafka_2.11-0.10.1.0/bin/zookeeper-shell.sh localhost:2181 create /backbeat/replication-populator ""
257257
docker exec ft-kafka-1 /opt/kafka_2.11-0.10.1.0/bin/zookeeper-shell.sh localhost:2181 create /backbeat/replication-populator/raft-id-dispatcher ""

extensions/notification/NotificationConfigValidator.js

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
11
const joi = require('joi');
22
const { probeServerJoi } = require('../../lib/config/configItems.joi');
3-
43
const { MAX_QUEUED_DEFAULT } = require('../../lib/constants').backbeatConsumer;
54

6-
const authSchema = joi.object({
7-
type: joi.string(),
8-
ssl: joi.boolean(),
9-
protocol: joi.string(),
5+
const sslSchema = joi.object({
6+
ssl: joi.boolean().default(false),
107
ca: joi.string(),
118
client: joi.string(),
129
key: joi.string(),
1310
keyPassword: joi.string(),
14-
keytab: joi.string(),
15-
principal: joi.string(),
16-
serviceName: joi.string(),
1711
});
1812

13+
const saslAuthSchema = sslSchema.append({
14+
protocol: joi.string().valid('SASL_PLAINTEXT', 'SASL_SSL').required(),
15+
});
16+
17+
const kerberosAuthSchema = saslAuthSchema.append({
18+
type: joi.string().valid('kerberos').required(),
19+
keytab: joi.string().required(),
20+
principal: joi.string().required(),
21+
serviceName: joi.string().required(),
22+
});
23+
24+
const basicAuthSchema = saslAuthSchema.append({
25+
type: joi.string().valid('basic').required(),
26+
credentialsFile: joi.string().required(),
27+
});
28+
29+
const credentialsFileSchema = joi.object({
30+
username: joi.string().required(),
31+
password: joi.string().required(),
32+
});
33+
34+
const authSchema = joi.alternatives().try(sslSchema, kerberosAuthSchema, basicAuthSchema).default({});
35+
1936
const destinationSchema = joi.object({
2037
resource: joi.string().required(),
2138
type: joi.string().required(),
2239
host: joi.string().required(),
2340
port: joi.number().optional(),
2441
internalTopic: joi.string(),
2542
topic: joi.string().required(),
26-
auth: authSchema.default({}),
43+
auth: authSchema,
2744
requiredAcks: joi.number().when('type', {
2845
is: joi.string().not('kafka'),
2946
then: joi.forbidden(),
@@ -41,11 +58,11 @@ const joiSchema = joi.object({
4158
monitorNotificationFailures: joi.boolean().default(true),
4259
notificationFailedTopic: joi.string().optional(),
4360
zookeeperPath: joi.string().optional(),
44-
queueProcessor: {
61+
queueProcessor: joi.object({
4562
groupId: joi.string().required(),
4663
concurrency: joi.number().greater(0).default(1000),
4764
maxQueued: joi.number().greater(0).default(MAX_QUEUED_DEFAULT),
48-
},
65+
}),
4966
destinations: joi.array().items(destinationSchema).default([]),
5067
// TODO: BB-625 reset to being required after supporting probeserver in S3C
5168
// for bucket notification proceses
@@ -62,4 +79,8 @@ function configValidator(backbeatConfig, extConfig) {
6279
return validatedConfig;
6380
}
6481

65-
module.exports = configValidator;
82+
module.exports = {
83+
NotificationConfigValidator: configValidator,
84+
authSchema,
85+
credentialsFileSchema,
86+
};

extensions/notification/destination/KafkaProducer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
const joi = require('joi');
2+
const { authSchema } = require('../NotificationConfigValidator');
23

34
const BackbeatProducer = require('../../../lib/BackbeatProducer');
45
const authUtil = require('../utils/auth');
56

67
class KafkaProducer extends BackbeatProducer {
78

89
getConfigJoi() {
9-
return super.getConfigJoi().append(
10-
{ auth: joi.object().optional() }
11-
).keys(
12-
{ topic: joi.string() }
13-
);
10+
return super.getConfigJoi()
11+
.append({ auth: authSchema })
12+
.keys({ topic: joi.string() });
1413
}
1514

1615
getClientId() {

extensions/notification/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NotificationConfigValidator = require('./NotificationConfigValidator');
1+
const { NotificationConfigValidator } = require('./NotificationConfigValidator');
22
const NotificationOplogPopulatorUtils = require('./NotificationOplogPopulatorUtils');
33

44
module.exports = {

tests/unit/notification/KafkaNotificationDestination.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('KafkaNotificationDestination ::', () => {
1212
afterEach(() => {
1313
sinon.restore();
1414
});
15+
1516
it('should properly configure producer', done => {
1617
const destConfig = {
1718
host: 'localhost',

0 commit comments

Comments
 (0)