From 0fb7ef9cb5df53545e77a7edbaf47699ededb63e Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Thu, 6 Sep 2018 18:15:51 +0000 Subject: [PATCH] Set (cluster)bus.Kind ourselves This property is not set in the new version of a bus when UpdateFunc is called from an informer. Fixes #417 --- pkg/buses/reconciler.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/buses/reconciler.go b/pkg/buses/reconciler.go index 31cef13b30e..295abea85ab 100644 --- a/pkg/buses/reconciler.go +++ b/pkg/buses/reconciler.go @@ -447,6 +447,9 @@ func (r *Reconciler) syncBus(namespace string, name string) error { return err } + // TODO: Figure out why kind is set to nil on updates but not on create + bus.Kind = busKind + // Sync the Bus err = r.createOrUpdateBus(bus) if err != nil { @@ -469,6 +472,9 @@ func (r *Reconciler) syncClusterBus(name string) error { return err } + // TODO: Figure out why kind is set to nil on updates but not on create + clusterBus.Kind = clusterBusKind + // Sync the ClusterBus err = r.createOrUpdateClusterBus(clusterBus) if err != nil { @@ -535,6 +541,7 @@ func (r *Reconciler) createOrUpdateBus(bus *channelsv1alpha1.Bus) error { bus.Namespace != r.bus.GetObjectMeta().GetNamespace() || bus.Name != r.bus.GetObjectMeta().GetName() { // this is not our bus + r.logger.Infof("Ignoring update for bus (%v/%v) that is not ours.", bus.Namespace, bus.Name) return nil } @@ -554,6 +561,7 @@ func (r *Reconciler) createOrUpdateClusterBus(clusterBus *channelsv1alpha1.Clust if r.bus.GetObjectKind().GroupVersionKind().Kind != clusterBus.Kind || clusterBus.Name != r.bus.GetObjectMeta().GetName() { // this is not our clusterbus + r.logger.Infof("Ignoring update for bus (%v/%v) that is not ours.", clusterBus.Namespace, clusterBus.Name) return nil }