From e8470b3f0d59b4b6bb7a6f04797f607c34d65700 Mon Sep 17 00:00:00 2001 From: kumarabd Date: Fri, 22 Jan 2021 14:32:29 +0530 Subject: [PATCH] fixed broker env and panic Signed-off-by: kumarabd --- internal/config/config.go | 2 +- internal/meshes/istio/informers/authorization_policy.go | 6 +++--- internal/meshes/istio/informers/destination_rule.go | 6 +++--- internal/meshes/istio/informers/envoy_filter.go | 6 +++--- internal/meshes/istio/informers/gateway.go | 6 +++--- internal/meshes/istio/informers/peer_authentication.go | 6 +++--- internal/meshes/istio/informers/request_authentication.go | 6 +++--- internal/meshes/istio/informers/service_entry.go | 6 +++--- internal/meshes/istio/informers/sidecar.go | 6 +++--- internal/meshes/istio/informers/virtual_services.go | 6 +++--- internal/meshes/istio/informers/workload_entry.go | 6 +++--- internal/meshes/istio/informers/workload_group.go | 6 +++--- pkg/model/model_converter.go | 4 ++-- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 25d34fec..abea27ee 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -55,7 +55,7 @@ func New(provider string) (config.Handler, error) { } func initConfig(cfg config.Handler) error { - cfg.SetKey(BrokerURL, os.Getenv("NATS_ENDPOINT")) + cfg.SetKey(BrokerURL, os.Getenv("BROKER_URL")) err := cfg.SetObject(ServerConfig, server) if err != nil { return err diff --git a/internal/meshes/istio/informers/authorization_policy.go b/internal/meshes/istio/informers/authorization_policy.go index 01590e4a..6b9197fa 100644 --- a/internal/meshes/istio/informers/authorization_policy.go +++ b/internal/meshes/istio/informers/authorization_policy.go @@ -27,7 +27,7 @@ func (i *Istio) AuthorizationPolicyInformer() cache.SharedIndexInformer { AuthorizationPolicy.Status, )}) if err != nil { - log.Println("NATS: Error publishing AuthorizationPolicy") + log.Println("BROKER: Error publishing AuthorizationPolicy") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) AuthorizationPolicyInformer() cache.SharedIndexInformer { AuthorizationPolicy.Status, )}) if err != nil { - log.Println("NATS: Error publishing AuthorizationPolicy") + log.Println("BROKER: Error publishing AuthorizationPolicy") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) AuthorizationPolicyInformer() cache.SharedIndexInformer { AuthorizationPolicy.Status, )}) if err != nil { - log.Println("NATS: Error publishing AuthorizationPolicy") + log.Println("BROKER: Error publishing AuthorizationPolicy") } }, }, diff --git a/internal/meshes/istio/informers/destination_rule.go b/internal/meshes/istio/informers/destination_rule.go index c513d4cd..135e311c 100644 --- a/internal/meshes/istio/informers/destination_rule.go +++ b/internal/meshes/istio/informers/destination_rule.go @@ -27,7 +27,7 @@ func (i *Istio) DestinationRuleInformer() cache.SharedIndexInformer { DestinationRule.Status, )}) if err != nil { - log.Println("NATS: Error publishing DestinationRule") + log.Println("BROKER: Error publishing DestinationRule") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) DestinationRuleInformer() cache.SharedIndexInformer { DestinationRule.Status, )}) if err != nil { - log.Println("NATS: Error publishing DestinationRule") + log.Println("BROKER: Error publishing DestinationRule") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) DestinationRuleInformer() cache.SharedIndexInformer { DestinationRule.Status, )}) if err != nil { - log.Println("NATS: Error publishing DestinationRule") + log.Println("BROKER: Error publishing DestinationRule") } }, }, diff --git a/internal/meshes/istio/informers/envoy_filter.go b/internal/meshes/istio/informers/envoy_filter.go index 498f0394..bea57855 100644 --- a/internal/meshes/istio/informers/envoy_filter.go +++ b/internal/meshes/istio/informers/envoy_filter.go @@ -27,7 +27,7 @@ func (i *Istio) EnvoyFilterInformer() cache.SharedIndexInformer { EnvoyFilter.Status, )}) if err != nil { - log.Println("NATS: Error publishing EnvoyFilter") + log.Println("BROKER: Error publishing EnvoyFilter") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) EnvoyFilterInformer() cache.SharedIndexInformer { EnvoyFilter.Status, )}) if err != nil { - log.Println("NATS: Error publishing EnvoyFilter") + log.Println("BROKER: Error publishing EnvoyFilter") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) EnvoyFilterInformer() cache.SharedIndexInformer { EnvoyFilter.Status, )}) if err != nil { - log.Println("NATS: Error publishing EnvoyFilter") + log.Println("BROKER: Error publishing EnvoyFilter") } }, }, diff --git a/internal/meshes/istio/informers/gateway.go b/internal/meshes/istio/informers/gateway.go index 80c3e504..9e8ad516 100644 --- a/internal/meshes/istio/informers/gateway.go +++ b/internal/meshes/istio/informers/gateway.go @@ -27,7 +27,7 @@ func (i *Istio) GatewayInformer() cache.SharedIndexInformer { Gateway.Status, )}) if err != nil { - log.Println("NATS: Error publishing Gateway") + log.Println("BROKER: Error publishing Gateway") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) GatewayInformer() cache.SharedIndexInformer { Gateway.Status, )}) if err != nil { - log.Println("NATS: Error publishing Gateway") + log.Println("BROKER: Error publishing Gateway") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) GatewayInformer() cache.SharedIndexInformer { Gateway.Status, )}) if err != nil { - log.Println("NATS: Error publishing Gateway") + log.Println("BROKER: Error publishing Gateway") } }, }, diff --git a/internal/meshes/istio/informers/peer_authentication.go b/internal/meshes/istio/informers/peer_authentication.go index 17773e0e..ecb01c36 100644 --- a/internal/meshes/istio/informers/peer_authentication.go +++ b/internal/meshes/istio/informers/peer_authentication.go @@ -27,7 +27,7 @@ func (i *Istio) PeerAuthenticationInformer() cache.SharedIndexInformer { PeerAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing PeerAuthentication") + log.Println("BROKER: Error publishing PeerAuthentication") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) PeerAuthenticationInformer() cache.SharedIndexInformer { PeerAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing PeerAuthentication") + log.Println("BROKER: Error publishing PeerAuthentication") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) PeerAuthenticationInformer() cache.SharedIndexInformer { PeerAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing PeerAuthentication") + log.Println("BROKER: Error publishing PeerAuthentication") } }, }, diff --git a/internal/meshes/istio/informers/request_authentication.go b/internal/meshes/istio/informers/request_authentication.go index a415394b..e8de9fc9 100644 --- a/internal/meshes/istio/informers/request_authentication.go +++ b/internal/meshes/istio/informers/request_authentication.go @@ -27,7 +27,7 @@ func (i *Istio) RequestAuthenticationInformer() cache.SharedIndexInformer { RequestAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing RequestAuthentication") + log.Println("BROKER: Error publishing RequestAuthentication") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) RequestAuthenticationInformer() cache.SharedIndexInformer { RequestAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing RequestAuthentication") + log.Println("BROKER: Error publishing RequestAuthentication") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) RequestAuthenticationInformer() cache.SharedIndexInformer { RequestAuthentication.Status, )}) if err != nil { - log.Println("NATS: Error publishing RequestAuthentication") + log.Println("BROKER: Error publishing RequestAuthentication") } }, }, diff --git a/internal/meshes/istio/informers/service_entry.go b/internal/meshes/istio/informers/service_entry.go index b138ad41..de74eab3 100644 --- a/internal/meshes/istio/informers/service_entry.go +++ b/internal/meshes/istio/informers/service_entry.go @@ -27,7 +27,7 @@ func (i *Istio) ServiceEntryInformer() cache.SharedIndexInformer { ServiceEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing ServiceEntry") + log.Println("BROKER: Error publishing ServiceEntry") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) ServiceEntryInformer() cache.SharedIndexInformer { ServiceEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing ServiceEntry") + log.Println("BROKER: Error publishing ServiceEntry") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) ServiceEntryInformer() cache.SharedIndexInformer { ServiceEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing ServiceEntry") + log.Println("BROKER: Error publishing ServiceEntry") } }, }, diff --git a/internal/meshes/istio/informers/sidecar.go b/internal/meshes/istio/informers/sidecar.go index e0726bdd..d9029584 100644 --- a/internal/meshes/istio/informers/sidecar.go +++ b/internal/meshes/istio/informers/sidecar.go @@ -27,7 +27,7 @@ func (i *Istio) SidecarInformer() cache.SharedIndexInformer { Sidecar.Status, )}) if err != nil { - log.Println("NATS: Error publishing Sidecar") + log.Println("BROKER: Error publishing Sidecar") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) SidecarInformer() cache.SharedIndexInformer { Sidecar.Status, )}) if err != nil { - log.Println("NATS: Error publishing Sidecar") + log.Println("BROKER: Error publishing Sidecar") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) SidecarInformer() cache.SharedIndexInformer { Sidecar.Status, )}) if err != nil { - log.Println("NATS: Error publishing Sidecar") + log.Println("BROKER: Error publishing Sidecar") } }, }, diff --git a/internal/meshes/istio/informers/virtual_services.go b/internal/meshes/istio/informers/virtual_services.go index 9fea9fc7..afe263df 100644 --- a/internal/meshes/istio/informers/virtual_services.go +++ b/internal/meshes/istio/informers/virtual_services.go @@ -27,7 +27,7 @@ func (i *Istio) VirtualServiceInformer() cache.SharedIndexInformer { VirtualService.Status, )}) if err != nil { - log.Println("NATS: Error publishing VirtualService") + log.Println("BROKER: Error publishing VirtualService") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) VirtualServiceInformer() cache.SharedIndexInformer { VirtualService.Status, )}) if err != nil { - log.Println("NATS: Error publishing VirtualService") + log.Println("BROKER: Error publishing VirtualService") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) VirtualServiceInformer() cache.SharedIndexInformer { VirtualService.Status, )}) if err != nil { - log.Println("NATS: Error publishing VirtualService") + log.Println("BROKER: Error publishing VirtualService") } }, }, diff --git a/internal/meshes/istio/informers/workload_entry.go b/internal/meshes/istio/informers/workload_entry.go index 24edc496..b19de90e 100644 --- a/internal/meshes/istio/informers/workload_entry.go +++ b/internal/meshes/istio/informers/workload_entry.go @@ -27,7 +27,7 @@ func (i *Istio) WorkloadEntryInformer() cache.SharedIndexInformer { WorkloadEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadEntry") + log.Println("BROKER: Error publishing WorkloadEntry") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) WorkloadEntryInformer() cache.SharedIndexInformer { WorkloadEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadEntry") + log.Println("BROKER: Error publishing WorkloadEntry") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) WorkloadEntryInformer() cache.SharedIndexInformer { WorkloadEntry.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadEntry") + log.Println("BROKER: Error publishing WorkloadEntry") } }, }, diff --git a/internal/meshes/istio/informers/workload_group.go b/internal/meshes/istio/informers/workload_group.go index 81792b52..d98539b5 100644 --- a/internal/meshes/istio/informers/workload_group.go +++ b/internal/meshes/istio/informers/workload_group.go @@ -27,7 +27,7 @@ func (i *Istio) WorkloadGroupInformer() cache.SharedIndexInformer { WorkloadGroup.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadGroup") + log.Println("BROKER: Error publishing WorkloadGroup") } }, UpdateFunc: func(new interface{}, old interface{}) { @@ -41,7 +41,7 @@ func (i *Istio) WorkloadGroupInformer() cache.SharedIndexInformer { WorkloadGroup.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadGroup") + log.Println("BROKER: Error publishing WorkloadGroup") } }, DeleteFunc: func(obj interface{}) { @@ -55,7 +55,7 @@ func (i *Istio) WorkloadGroupInformer() cache.SharedIndexInformer { WorkloadGroup.Status, )}) if err != nil { - log.Println("NATS: Error publishing WorkloadGroup") + log.Println("BROKER: Error publishing WorkloadGroup") } }, }, diff --git a/pkg/model/model_converter.go b/pkg/model/model_converter.go index 7723c34d..be667fc5 100644 --- a/pkg/model/model_converter.go +++ b/pkg/model/model_converter.go @@ -50,10 +50,10 @@ func makeObjectMeta(resource metav1.ObjectMeta, id string) ResourceObjectMeta { var creationTime string var deletionTime string - if resource.CreationTimestamp.IsZero() { + if !resource.CreationTimestamp.IsZero() { creationTime = resource.CreationTimestamp.String() } - if resource.DeletionTimestamp.IsZero() { + if !resource.DeletionTimestamp.IsZero() { deletionTime = resource.DeletionTimestamp.String() }