Skip to content

Commit

Permalink
Merge pull request #30 from layer5io/kumarabd/feature/model
Browse files Browse the repository at this point in the history
fixed broker env and panic
  • Loading branch information
kumarabd committed Jan 22, 2021
2 parents 505ea7a + e8470b3 commit dc2a3bc
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/authorization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/destination_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/envoy_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/peer_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/request_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/service_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/virtual_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/workload_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/meshes/istio/informers/workload_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand All @@ -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{}) {
Expand All @@ -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")
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/model_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit dc2a3bc

Please sign in to comment.