Skip to content

Commit

Permalink
Adding log lines for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ffilippopoulos committed Oct 24, 2024
1 parent cd547eb commit cdb710c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
- -c
- |
/semaphore-xds-envoy-configurer > /etc/envoy/config.yaml
cat /etc/envoy/config.yaml
volumeMounts:
- name: envoy-config
mountPath: /etc/envoy
Expand Down
12 changes: 12 additions & 0 deletions xds/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ func (s *Snapshotter) updateNodeStreamResources(nodeID, typeURL string, streamID
serviceSnapVersion: node.serviceSnapVersion,
endpointsSnapVersion: node.endpointsSnapVersion,
}
log.Logger.Debug("Updating node resources", "node", nodeID, "type", typeURL, "resources", updatedNode.resources[streamID].services[typeURL])
s.nodes.Store(nodeID, updatedNode)
return nil
}
Expand All @@ -557,6 +558,7 @@ func (s *Snapshotter) updateNodeStreamEndpointsResources(nodeID, typeURL string,
if err != nil {
return fmt.Errorf("Cannot make dummy resources for localhost mode: %s", err)
}
log.Logger.Debug("Created dummy resources", "type", typeURL, "resources", newSnapResources, "count", len(newSnapResources))
} else {
newSnapResources, err = s.getResourcesFromCache(typeURL, resources)
if err != nil {
Expand Down Expand Up @@ -590,6 +592,9 @@ func (s *Snapshotter) nodeServiceSnapshot(nodeID string) error {
if err != nil {
return err
}
for t, r := range snapServices {
log.Logger.Debug("Updating node snapshot", "node", nodeID, "typeURL", t, "resources", r)
}
return s.servicesCache.SetSnapshot(ctx, nodeID, snapshot)
}

Expand All @@ -607,6 +612,9 @@ func (s *Snapshotter) nodeEndpointsSnapshot(nodeID string) error {
if err != nil {
return err
}
for t, r := range snapEndpoints {
log.Logger.Debug("Updating node snapshot", "node", nodeID, "typeURL", t, "resources", r)
}
return s.endpointsCache.SetSnapshot(ctx, nodeID, snapshot)
}

Expand Down Expand Up @@ -659,6 +667,7 @@ func (s *Snapshotter) makeDummyResources(typeURL string, resources []string) ([]
res := []types.Resource{}
if typeURL == resource.ListenerType {
for _, r := range resources {
log.Logger.Debug("Creating dummy listener resource", "name", r)
clusterName := strings.Replace(r, ":", ".", 1) // Replace expected format of name.namespace:port -> name.namespace.port to match cluster names due to xds naming
routeConfig := routeConfig(r, clusterName, r, []string{r}, nil, []*routev3.RouteAction_HashPolicy{})
manager, err := makeManager(routeConfig)
Expand All @@ -671,17 +680,20 @@ func (s *Snapshotter) makeDummyResources(typeURL string, resources []string) ([]
}
if typeURL == resource.RouteType {
for _, r := range resources {
log.Logger.Debug("Creating dummy routeConfig resource", "name", r)
clusterName := strings.Replace(r, ":", ".", 1) // Replace expected format of name.namespace:port -> name.namespace.port to match cluster names due to xds naming
res = append(res, routeConfig(r, clusterName, r, []string{r}, nil, []*routev3.RouteAction_HashPolicy{}))
}
}
if typeURL == resource.ClusterType {
for _, r := range resources {
log.Logger.Debug("Creating dummy cluster resource", "name", r)
res = append(res, cluster(r, clusterv3.Cluster_ROUND_ROBIN))
}
}
if typeURL == resource.EndpointType {
for _, r := range resources {
log.Logger.Debug("Creating dummy ClusterLoadAssignment resource", "name", r)
res = append(res, localhostClusterLoadAssignment(r))
}
}
Expand Down

0 comments on commit cdb710c

Please sign in to comment.