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 646aa92
Show file tree
Hide file tree
Showing 2 changed files with 12 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
11 changes: 11 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 Down Expand Up @@ -590,6 +591,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 +611,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 +666,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 +679,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 646aa92

Please sign in to comment.