@@ -160,13 +160,6 @@ async function getUUIDFromBackbeat(k8sClient: KubernetesClient, namespace: strin
160
160
`app.kubernetes.io/name=backbeat-config,app.kubernetes.io/instance=${ zenkoName } `
161
161
) ;
162
162
163
- logger . info ( 'Found secrets for UUID extraction' , {
164
- count : secrets . length ,
165
- namespace,
166
- instanceId,
167
- zenkoName
168
- } ) ;
169
-
170
163
if ( ! secrets . length ) {
171
164
throw new Error ( `No backbeat config secret found with Zenko name ${ zenkoName } (instanceId: ${ instanceId } ) in namespace ${ namespace } ` ) ;
172
165
}
@@ -175,13 +168,6 @@ async function getUUIDFromBackbeat(k8sClient: KubernetesClient, namespace: strin
175
168
const configJson = k8sClient . getSecretData ( secrets [ 0 ] , 'config.json' ) ;
176
169
const config : BackbeatConfig = JSON . parse ( configJson ) ;
177
170
178
- logger . info ( 'Backbeat config structure' , {
179
- hasKafka : ! ! config . kafka ,
180
- hasExtensions : ! ! config . extensions ,
181
- hasReplication : ! ! config . extensions ?. replication ,
182
- replicationTopic : config . extensions ?. replication ?. topic
183
- } ) ;
184
-
185
171
// Extract UUID from replication topic
186
172
let uuid = config . extensions . replication . topic . replace ( / " / g, '' ) ; // Remove quotes
187
173
logger . debug ( 'UUID before processing' , { rawUuid : uuid } ) ;
@@ -208,57 +194,48 @@ async function applyNotificationDestinations(k8sClient: KubernetesClient, namesp
208
194
const notifDestTopic = process . env [ kafkaTopicsConfig . notificationTopics [ 0 ] . envVar ] || kafkaTopicsConfig . notificationTopics [ 0 ] . default ;
209
195
const notifAltDestTopic = process . env [ kafkaTopicsConfig . notificationTopics [ 1 ] . envVar ] || kafkaTopicsConfig . notificationTopics [ 1 ] . default ;
210
196
211
- // Create notification config ConfigMap
212
- const notificationConfigMap = {
213
- apiVersion : 'v1' ,
214
- kind : 'ConfigMap' ,
197
+ // Create ZenkoNotificationTarget resources (the correct CRD that actually exists)
198
+ const zenkoName = process . env . ZENKO_NAME || 'end2end' ;
199
+ const [ kafkaHostOnly , kafkaPortOnly ] = kafkaHost . split ( ':' ) ;
200
+
201
+ const primaryNotificationTarget = {
202
+ apiVersion : 'zenko.io/v1alpha2' ,
203
+ kind : 'ZenkoNotificationTarget' ,
215
204
metadata : {
216
- name : 'notification-config' ,
217
- namespace
205
+ name : 'kafka-destination' ,
206
+ namespace,
207
+ labels : {
208
+ 'app.kubernetes.io/instance' : zenkoName
209
+ }
218
210
} ,
219
- data : {
220
- 'destinations.yaml' : `destinations:
221
- - name: kafka-destination
222
- type: kafka
223
- config:
224
- bootstrapServers: "${ kafkaHost . split ( ':' ) [ 0 ] } :${ kafkaPort } "
225
- topic: "${ notifDestTopic } "
226
- securityProtocol: PLAINTEXT
227
- - name: kafka-alt-destination
228
- type: kafka
229
- config:
230
- bootstrapServers: "${ kafkaHost . split ( ':' ) [ 0 ] } :${ kafkaPort } "
231
- topic: "${ notifAltDestTopic } "
232
- securityProtocol: PLAINTEXT`
211
+ spec : {
212
+ type : 'kafka' ,
213
+ host : kafkaHostOnly ,
214
+ port : parseInt ( kafkaPortOnly || kafkaPort , 10 ) ,
215
+ destinationTopic : notifDestTopic
233
216
}
234
217
} ;
235
218
236
- // Create BucketNotificationConfiguration custom resource
237
- const bucketNotificationConfig = {
238
- apiVersion : 'zenko.io/v1alpha1' ,
239
- kind : 'BucketNotificationConfiguration' ,
219
+ const altNotificationTarget = {
220
+ apiVersion : 'zenko.io/v1alpha2' ,
221
+ kind : 'ZenkoNotificationTarget' ,
240
222
metadata : {
241
- name : 'notification-destinations' ,
242
- namespace
223
+ name : 'kafka-alt-destination' ,
224
+ namespace,
225
+ labels : {
226
+ 'app.kubernetes.io/instance' : zenkoName
227
+ }
243
228
} ,
244
229
spec : {
245
- configurations : [
246
- {
247
- name : 'primary' ,
248
- destination : 'kafka-destination' ,
249
- events : [ 's3:ObjectCreated:*' , 's3:ObjectRemoved:*' ]
250
- } ,
251
- {
252
- name : 'alternative' ,
253
- destination : 'kafka-alt-destination' ,
254
- events : [ 's3:ObjectCreated:Put' , 's3:ObjectCreated:Post' ]
255
- }
256
- ]
230
+ type : 'kafka' ,
231
+ host : kafkaHostOnly ,
232
+ port : parseInt ( kafkaPortOnly || kafkaPort , 10 ) ,
233
+ destinationTopic : notifAltDestTopic
257
234
}
258
235
} ;
259
236
260
237
try {
261
- await k8sClient . applyManifests ( [ notificationConfigMap , bucketNotificationConfig ] , namespace ) ;
238
+ await k8sClient . applyManifests ( [ primaryNotificationTarget , altNotificationTarget ] , namespace ) ;
262
239
263
240
logger . info ( 'Notification destinations applied successfully' ) ;
264
241
} catch ( error ) {
0 commit comments