This repository has been archived by the owner on Jun 19, 2022. It is now read-only.
/
pullsubscription.go
611 lines (519 loc) · 20.2 KB
/
pullsubscription.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/*
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package pullsubscription
import (
"context"
"encoding/json"
"time"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
"knative.dev/pkg/resolver"
tracingconfig "knative.dev/pkg/tracing/config"
"knative.dev/pkg/metrics"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
apierrors "k8s.io/apimachinery/pkg/api/errors"
apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
appsv1listers "k8s.io/client-go/listers/apps/v1"
"k8s.io/client-go/tools/cache"
"github.com/google/go-cmp/cmp"
"github.com/google/knative-gcp/pkg/apis/pubsub/v1alpha1"
listers "github.com/google/knative-gcp/pkg/client/listers/pubsub/v1alpha1"
ops "github.com/google/knative-gcp/pkg/operations"
pubsubOps "github.com/google/knative-gcp/pkg/operations/pubsub"
"github.com/google/knative-gcp/pkg/reconciler/pubsub"
"github.com/google/knative-gcp/pkg/reconciler/pullsubscription/resources"
"github.com/google/knative-gcp/pkg/tracing"
"go.uber.org/zap"
"knative.dev/pkg/controller"
"knative.dev/pkg/logging"
)
const (
// ReconcilerName is the name of the reconciler
ReconcilerName = "PullSubscriptions"
// Component names for metrics.
sourceComponent = "source"
channelComponent = "channel"
finalizerName = controllerAgentName
// Custom secret finalizer requires at least one slash
secretFinalizerName = controllerAgentName + "/secret"
)
// Reconciler implements controller.Reconciler for PullSubscription resources.
type Reconciler struct {
*pubsub.PubSubBase
// Listers index properties about resources.
deploymentLister appsv1listers.DeploymentLister
sourceLister listers.PullSubscriptionLister
uriResolver *resolver.URIResolver
receiveAdapterImage string
loggingConfig *logging.Config
metricsConfig *metrics.ExporterOptions
tracingConfig *tracingconfig.Config
// eventTypeReconciler eventtype.Reconciler // TODO: event types.
}
// Check that our Reconciler implements controller.Reconciler
var _ controller.Reconciler = (*Reconciler)(nil)
// Reconcile compares the actual state with the desired, and attempts to
// converge the two. It then updates the Status block of the Service resource
// with the current status of the resource.
func (c *Reconciler) Reconcile(ctx context.Context, key string) error {
// Convert the namespace/name string into a distinct namespace and name
namespace, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
c.Logger.Errorf("invalid resource key: %s", key)
return nil
}
logger := logging.FromContext(ctx)
// Get the PullSubscription resource with this namespace/name
original, err := c.sourceLister.PullSubscriptions(namespace).Get(name)
if apierrs.IsNotFound(err) {
// The resource may no longer exist, in which case we stop processing.
logger.Errorf("service %q in work queue no longer exists", key)
return nil
} else if err != nil {
return err
}
// Don't modify the informers copy
source := original.DeepCopy()
// Reconcile this copy of the source and then write back any status
// updates regardless of whether the reconciliation errored out.
var reconcileErr = c.reconcile(ctx, source)
// If no error is returned, mark the observed generation.
// This has to be done before updateStatus is called.
if reconcileErr == nil {
source.Status.ObservedGeneration = source.Generation
}
if equality.Semantic.DeepEqual(original.Finalizers, source.Finalizers) {
// If we didn't change finalizers then don't call updateFinalizers.
} else if _, updated, fErr := c.updateFinalizers(ctx, source); fErr != nil {
logger.Warnw("Failed to update PullSubscription finalizers", zap.Error(fErr))
c.Recorder.Eventf(source, corev1.EventTypeWarning, "UpdateFailed",
"Failed to update finalizers for PullSubscription %q: %v", source.Name, fErr)
return fErr
} else if updated {
// There was a difference and updateFinalizers said it updated and did not return an error.
c.Recorder.Eventf(source, corev1.EventTypeNormal, "Updated", "Updated PullSubscription %q finalizers", source.GetName())
}
if equality.Semantic.DeepEqual(original.Status, source.Status) {
// If we didn't change anything then don't call updateStatus.
// This is important because the copy we loaded from the informer's
// cache may be stale and we don't want to overwrite a prior update
// to status with this stale state.
} else if _, uErr := c.updateStatus(ctx, source); uErr != nil {
logger.Warnw("Failed to update source status", zap.Error(uErr))
c.Recorder.Eventf(source, corev1.EventTypeWarning, "UpdateFailed",
"Failed to update status for PullSubscription %q: %v", source.Name, uErr)
return uErr
} else if reconcileErr == nil {
// There was a difference and updateStatus did not return an error.
c.Recorder.Eventf(source, corev1.EventTypeNormal, "Updated", "Updated PullSubscription %q", source.GetName())
}
if reconcileErr != nil {
c.Recorder.Event(source, corev1.EventTypeWarning, "InternalError", reconcileErr.Error())
}
return reconcileErr
}
func (c *Reconciler) reconcile(ctx context.Context, source *v1alpha1.PullSubscription) error {
logger := logging.FromContext(ctx)
source.Status.ObservedGeneration = source.Generation
source.Status.InitializeConditions()
if source.GetDeletionTimestamp() != nil {
if !subscriptionExists(source) {
removeFinalizer(source)
return c.updateSecretFinalizer(ctx, source, false)
}
logger.Info("Source Deleting.")
state, err := c.EnsureSubscriptionDeleted(ctx, source, *source.Spec.Secret, source.Spec.Project, source.Spec.Topic, source.Status.SubscriptionID)
switch state {
case ops.OpsJobGetFailed:
logger.Error("Failed to get subscription ops job.", zap.Any("state", state), zap.Error(err))
return err
case ops.OpsJobCreated:
// If we created a job to make a subscription, then add the finalizer and update the status.
source.Status.MarkSubscriptionOperation(
"Deleting",
"Created Job to delete Subscription %q.",
source.Status.SubscriptionID)
return nil
case ops.OpsJobCompleteSuccessful:
source.Status.MarkNoSubscription(
"Deleted",
"Successfully deleted Subscription %q.",
source.Status.SubscriptionID)
source.Status.SubscriptionID = ""
removeFinalizer(source)
return c.updateSecretFinalizer(ctx, source, false)
case ops.OpsJobCreateFailed, ops.OpsJobCompleteFailed:
logger.Error("Failed to delete subscription.", zap.Any("state", state), zap.Error(err))
msg := "unknown"
if err != nil {
msg = err.Error()
}
source.Status.MarkNoSubscription(
"DeleteFailed",
"Failed to delete Subscription: %q",
msg)
return err
}
return nil
}
// Sink is required.
sinkURI, err := c.resolveDestination(ctx, source.Spec.Sink, source)
if err != nil {
source.Status.MarkNoSink("InvalidSink", err.Error())
return err
} else {
source.Status.MarkSink(sinkURI)
}
// Transformer is optional.
if source.Spec.Transformer != nil {
transformerURI, err := c.resolveDestination(ctx, *source.Spec.Transformer, source)
if err != nil {
source.Status.MarkNoTransformer("InvalidTransformer", err.Error())
} else {
source.Status.MarkTransformer(transformerURI)
}
}
source.Status.SubscriptionID = resources.GenerateSubscriptionName(source)
state, err := c.EnsureSubscriptionCreated(ctx, source, *source.Spec.Secret, source.Spec.Project, source.Spec.Topic,
source.Status.SubscriptionID, source.Spec.GetAckDeadline(), source.Spec.RetainAckedMessages, source.Spec.GetRetentionDuration())
switch state {
case ops.OpsJobGetFailed:
logger.Error("Failed to get subscription ops job.", zap.Any("state", state), zap.Error(err))
return err
case ops.OpsJobCreated:
// If we created a job to make a subscription, then add the finalizer and update the status.
addFinalizer(source)
source.Status.MarkSubscriptionOperation("Creating",
"Created Job to create Subscription %q.",
source.Status.SubscriptionID)
return c.updateSecretFinalizer(ctx, source, true)
case ops.OpsJobCompleteSuccessful:
source.Status.MarkSubscribed()
// Now that the job completed, grab the pod status for it.
// Note that since it's not yet currently relied upon, don't hard
// fail this if we can't fetch it. Just warn
jobName := pubsubOps.SubscriptionJobName(source, "create")
logger.Info("Finding job pods for", zap.String("jobName", jobName))
var sar pubsubOps.SubActionResult
if err := c.UnmarshalJobTerminationMessage(ctx, source.Namespace, jobName, &sar); err != nil {
logger.Error("Failed to unmarshal termination message", zap.Error(err))
} else {
c.Logger.Infof("Topic project: %q", sar.ProjectId)
source.Status.ProjectID = sar.ProjectId
}
case ops.OpsJobCreateFailed, ops.OpsJobCompleteFailed:
logger.Error("Failed to create subscription.", zap.Any("state", state), zap.Error(err))
msg := "unknown"
if err != nil {
msg = err.Error()
}
source.Status.MarkNoSubscription(
"CreateFailed",
"Failed to create Subscription: %q.",
msg)
return err
}
_, err = c.createOrUpdateReceiveAdapter(ctx, source)
if err != nil {
logger.Error("Unable to create the receive adapter", zap.Error(err))
return err
}
source.Status.MarkDeployed()
// TODO: Registry
//// Only create EventTypes for Broker sinks.
//if source.Spec.Sink.Kind == "Broker" {
// err = r.reconcileEventTypes(ctx, src)
// if err != nil {
// logger.Error("Unable to reconcile the event types", zap.Error(err))
// return err
// }
// src.Status.MarkEventTypes()
//}
return nil
}
func subscriptionExists(sub *v1alpha1.PullSubscription) bool {
for _, c := range sub.Status.Conditions {
if c.Type == v1alpha1.PullSubscriptionConditionSubscribed && !c.IsFalse() {
return true
}
}
return false
}
func (c *Reconciler) resolveDestination(ctx context.Context, destination duckv1.Destination, source *v1alpha1.PullSubscription) (string, error) {
dest := duckv1beta1.Destination{
Ref: destination.GetRef(),
URI: destination.URI,
}
if dest.Ref != nil {
dest.Ref.Namespace = source.Namespace
}
return c.uriResolver.URIFromDestination(dest, source)
}
func (c *Reconciler) updateStatus(ctx context.Context, desired *v1alpha1.PullSubscription) (*v1alpha1.PullSubscription, error) {
source, err := c.sourceLister.PullSubscriptions(desired.Namespace).Get(desired.Name)
if err != nil {
return nil, err
}
// If there's nothing to update, just return.
if equality.Semantic.DeepEqual(source.Status, desired.Status) {
return source, nil
}
becomesReady := desired.Status.IsReady() && !source.Status.IsReady()
// Don't modify the informers copy.
existing := source.DeepCopy()
existing.Status = desired.Status
src, err := c.RunClientSet.PubsubV1alpha1().PullSubscriptions(desired.Namespace).UpdateStatus(existing)
if err == nil && becomesReady {
duration := time.Since(src.ObjectMeta.CreationTimestamp.Time)
c.Logger.Infof("PullSubscription %q became ready after %v", source.Name, duration)
if err := c.StatsReporter.ReportReady("PullSubscription", source.Namespace, source.Name, duration); err != nil {
logging.FromContext(ctx).Infof("failed to record ready for PullSubscription, %v", err)
}
}
return src, err
}
// updateSecretFinalizer adds or deletes the finalizer on the secret used by the PullSubscription.
func (c *Reconciler) updateSecretFinalizer(ctx context.Context, desired *v1alpha1.PullSubscription, ensureFinalizer bool) error {
psl, err := c.sourceLister.PullSubscriptions(desired.Namespace).List(labels.Everything())
if err != nil {
return err
}
// Only delete the finalizer if this PullSubscription is the last one
// references the Secret.
if !ensureFinalizer && !(len(psl) == 1 && psl[0].Name == desired.Name) {
return nil
}
secret, err := c.KubeClientSet.CoreV1().Secrets(desired.Namespace).Get(desired.Spec.Secret.Name, metav1.GetOptions{})
if err != nil {
return err
}
existing := secret.DeepCopy()
existingFinalizers := sets.NewString(existing.Finalizers...)
hasFinalizer := existingFinalizers.Has(secretFinalizerName)
if ensureFinalizer == hasFinalizer {
return nil
}
var desiredFinalizers []string
if ensureFinalizer {
desiredFinalizers = append(existing.Finalizers, secretFinalizerName)
} else {
existingFinalizers.Delete(secretFinalizerName)
desiredFinalizers = existingFinalizers.List()
}
mergePatch := map[string]interface{}{
"metadata": map[string]interface{}{
"finalizers": desiredFinalizers,
"resourceVersion": existing.ResourceVersion,
},
}
patch, err := json.Marshal(mergePatch)
if err != nil {
return err
}
_, err = c.KubeClientSet.CoreV1().Secrets(existing.GetNamespace()).Patch(existing.GetName(), types.MergePatchType, patch)
if err != nil {
logging.FromContext(ctx).Errorf("Failed to update PullSubscription Secret's finalizers", zap.Error(err))
}
return err
}
// updateFinalizers is a generic method for future compatibility with a
// reconciler SDK.
func (c *Reconciler) updateFinalizers(ctx context.Context, desired *v1alpha1.PullSubscription) (*v1alpha1.PullSubscription, bool, error) {
source, err := c.sourceLister.PullSubscriptions(desired.Namespace).Get(desired.Name)
if err != nil {
return nil, false, err
}
// Don't modify the informers copy.
existing := source.DeepCopy()
var finalizers []string
// If there's nothing to update, just return.
existingFinalizers := sets.NewString(existing.Finalizers...)
desiredFinalizers := sets.NewString(desired.Finalizers...)
if desiredFinalizers.Has(finalizerName) {
if existingFinalizers.Has(finalizerName) {
// Nothing to do.
return desired, false, nil
}
// Add the finalizer.
finalizers = append(existing.Finalizers, finalizerName)
} else {
if !existingFinalizers.Has(finalizerName) {
// Nothing to do.
return desired, false, nil
}
// Remove the finalizer.
existingFinalizers.Delete(finalizerName)
finalizers = existingFinalizers.List()
}
mergePatch := map[string]interface{}{
"metadata": map[string]interface{}{
"finalizers": finalizers,
"resourceVersion": existing.ResourceVersion,
},
}
patch, err := json.Marshal(mergePatch)
if err != nil {
return desired, false, err
}
update, err := c.RunClientSet.PubsubV1alpha1().PullSubscriptions(existing.Namespace).Patch(existing.Name, types.MergePatchType, patch)
return update, true, err
}
func addFinalizer(s *v1alpha1.PullSubscription) {
finalizers := sets.NewString(s.Finalizers...)
finalizers.Insert(finalizerName)
s.Finalizers = finalizers.List()
}
func removeFinalizer(s *v1alpha1.PullSubscription) {
finalizers := sets.NewString(s.Finalizers...)
finalizers.Delete(finalizerName)
s.Finalizers = finalizers.List()
}
func (r *Reconciler) createOrUpdateReceiveAdapter(ctx context.Context, src *v1alpha1.PullSubscription) (*appsv1.Deployment, error) {
existing, err := r.getReceiveAdapter(ctx, src)
if err != nil && !apierrors.IsNotFound(err) {
logging.FromContext(ctx).Error("Unable to get an existing receive adapter", zap.Error(err))
return nil, err
}
loggingConfig, err := logging.LoggingConfigToJson(r.loggingConfig)
if err != nil {
logging.FromContext(ctx).Error("Error serializing existing logging config", zap.Error(err))
}
if r.metricsConfig != nil {
component := sourceComponent
// Set the metric component based on PullSubscription label.
if _, ok := src.Labels["events.cloud.google.com/channel"]; ok {
component = channelComponent
}
r.metricsConfig.Component = component
}
metricsConfig, err := metrics.MetricsOptionsToJson(r.metricsConfig)
if err != nil {
logging.FromContext(ctx).Errorw("Error serializing metrics config", zap.Error(err))
}
tracingConfig, err := tracing.ConfigToJSON(r.tracingConfig)
if err != nil {
logging.FromContext(ctx).Errorw("Error serializing tracing config", zap.Error(err))
}
desired := resources.MakeReceiveAdapter(ctx, &resources.ReceiveAdapterArgs{
Image: r.receiveAdapterImage,
Source: src,
Labels: resources.GetLabels(controllerAgentName, src.Name),
SubscriptionID: src.Status.SubscriptionID,
SinkURI: src.Status.SinkURI,
TransformerURI: src.Status.TransformerURI,
LoggingConfig: loggingConfig,
MetricsConfig: metricsConfig,
TracingConfig: tracingConfig,
})
if existing == nil {
ra, err := r.KubeClientSet.AppsV1().Deployments(src.Namespace).Create(desired)
logging.FromContext(ctx).Desugar().Info("Receive Adapter created.", zap.Error(err), zap.Any("receiveAdapter", ra))
return ra, err
}
if diff := cmp.Diff(desired.Spec, existing.Spec); diff != "" {
existing.Spec = desired.Spec
ra, err := r.KubeClientSet.AppsV1().Deployments(src.Namespace).Update(existing)
logging.FromContext(ctx).Desugar().Info("Receive Adapter updated.",
zap.Error(err), zap.Any("receiveAdapter", ra), zap.String("diff", diff))
return ra, err
}
logging.FromContext(ctx).Desugar().Info("Reusing existing Receive Adapter", zap.Any("receiveAdapter", existing))
return existing, nil
}
func (r *Reconciler) getReceiveAdapter(ctx context.Context, src *v1alpha1.PullSubscription) (*appsv1.Deployment, error) {
dl, err := r.KubeClientSet.AppsV1().Deployments(src.Namespace).List(metav1.ListOptions{
LabelSelector: resources.GetLabelSelector(controllerAgentName, src.Name).String(),
TypeMeta: metav1.TypeMeta{
APIVersion: appsv1.SchemeGroupVersion.String(),
Kind: "Deployment",
},
})
if err != nil {
logging.FromContext(ctx).Desugar().Error("Unable to list deployments: %v", zap.Error(err))
return nil, err
}
for _, dep := range dl.Items {
if metav1.IsControlledBy(&dep, src) {
return &dep, nil
}
}
return nil, apierrors.NewNotFound(schema.GroupResource{}, "")
}
func (r *Reconciler) UpdateFromLoggingConfigMap(cfg *corev1.ConfigMap) {
if cfg != nil {
delete(cfg.Data, "_example")
}
logcfg, err := logging.NewConfigFromConfigMap(cfg)
if err != nil {
r.Logger.Warnw("failed to create logging config from configmap", zap.String("cfg.Name", cfg.Name))
return
}
r.loggingConfig = logcfg
r.Logger.Infow("Update from logging ConfigMap", zap.Any("ConfigMap", cfg))
// TODO: requeue all pullsubscriptions
}
func (r *Reconciler) UpdateFromMetricsConfigMap(cfg *corev1.ConfigMap) {
if cfg != nil {
delete(cfg.Data, "_example")
}
// Cannot set the component here as we don't know if its a source or a channel.
// Will set that up dynamically before creating the receive adapter.
// Won't be able to requeue the PullSubscriptions.
r.metricsConfig = &metrics.ExporterOptions{
Domain: metrics.Domain(),
ConfigMap: cfg.Data,
}
r.Logger.Infow("Update from metrics ConfigMap", zap.Any("ConfigMap", cfg))
}
func (r *Reconciler) UpdateFromTracingConfigMap(cfg *corev1.ConfigMap) {
if cfg == nil {
r.Logger.Error("Tracing ConfigMap is nil")
return
}
delete(cfg.Data, "_example")
tracingCfg, err := tracingconfig.NewTracingConfigFromConfigMap(cfg)
if err != nil {
r.Logger.Warnw("failed to create tracing config from configmap", zap.String("cfg.Name", cfg.Name))
return
}
r.tracingConfig = tracingCfg
r.Logger.Infow("Updated Tracing config", zap.Any("tracingCfg", r.tracingConfig))
// TODO: requeue all PullSubscriptions.
}
// TODO: Registry
//func (r *Reconciler) reconcileEventTypes(ctx context.Context, src *v1alpha1.PullSubscription) error {
// args := r.newEventTypeReconcilerArgs(src)
// return r.eventTypeReconciler.Reconcile(ctx, src, args)
//}
//
//func (r *Reconciler) newEventTypeReconcilerArgs(src *v1alpha1.PubSub) *eventtype.ReconcilerArgs {
// spec := eventingv1alpha1.EventTypeSpec{
// Type: v1alpha1.PubSubEventType,
// Source: v1alpha1.GetPubSub(src.Status.ProjectID, src.Spec.Topic),
// Broker: src.Spec.Sink.Name,
// }
// specs := make([]eventingv1alpha1.EventTypeSpec, 0, 1)
// specs = append(specs, spec)
// return &eventtype.ReconcilerArgs{
// Specs: specs,
// Namespace: src.Namespace,
// Labels: getLabels(src),
// }
//}