Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
chore(routesv2): Remove unused struct from package
Browse files Browse the repository at this point in the history
Reomval of unused structs from the trafficpolicy package post migration
to routesv2

Fixes #2397

Signed-off-by: Sneha Chhabria <snchh@microsoft.com>
  • Loading branch information
snehachhabria committed Mar 1, 2021
1 parent ecb1a84 commit bc831b7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 81 deletions.
1 change: 0 additions & 1 deletion pkg/envoy/route/route_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ func buildOutboundRoutes(outRoutes []*trafficpolicy.RouteWeightedClusters) []*xd
var routes []*xds_route.Route
for _, outRoute := range outRoutes {
emptyHeaders := map[string]string{}
// TODO: When implementing trafficsplit v1alpha4, buildRoute here should take in path, method, headers from trafficpolicy.HTTPRouteMatch
routes = append(routes, buildRoute(constants.RegexMatchAll, constants.WildcardHTTPMethod, emptyHeaders, outRoute.WeightedClusters, outRoute.TotalClustersWeight(), OutboundRoute))
}
return routes
Expand Down
70 changes: 0 additions & 70 deletions pkg/tests/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package tests
import (
"encoding/pem"
"errors"
"fmt"
"net"

access "github.com/servicemeshinterface/smi-sdk-go/pkg/apis/access/v1alpha3"
Expand Down Expand Up @@ -212,75 +211,6 @@ var (
Port: endpoint.Port(ServicePort),
}

// BookstoreV1TrafficPolicy is a traffic policy SMI object.
BookstoreV1TrafficPolicy = trafficpolicy.TrafficTarget{
Name: fmt.Sprintf("%s:default/bookbuyer->default/bookstore-v1", TrafficTargetName),
Destination: BookstoreV1Service,
Source: BookbuyerService,
HTTPRouteMatches: []trafficpolicy.HTTPRouteMatch{
{
PathRegex: BookstoreBuyPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
{
PathRegex: BookstoreSellPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
},
}

// BookstoreV2TrafficPolicy is a traffic policy SMI object.
BookstoreV2TrafficPolicy = trafficpolicy.TrafficTarget{
Name: fmt.Sprintf("%s:default/bookbuyer->default/bookstore-v2", BookstoreV2TrafficTargetName),
Destination: BookstoreV2Service,
Source: BookbuyerService,
HTTPRouteMatches: []trafficpolicy.HTTPRouteMatch{
{
PathRegex: BookstoreBuyPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
{
PathRegex: BookstoreSellPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
},
}

// BookstoreApexTrafficPolicy is a traffic policy SMI object.
BookstoreApexTrafficPolicy = trafficpolicy.TrafficTarget{
Name: fmt.Sprintf("%s:default/bookbuyer->default/bookstore-apex", TrafficTargetName),
Destination: BookstoreApexService,
Source: BookbuyerService,
HTTPRouteMatches: []trafficpolicy.HTTPRouteMatch{
{
PathRegex: BookstoreBuyPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
{
PathRegex: BookstoreSellPath,
Methods: []string{"GET"},
Headers: map[string]string{
"user-agent": HTTPUserAgent,
},
},
},
}

// TrafficSplit is a traffic split SMI object.
TrafficSplit = v1alpha2.TrafficSplit{
ObjectMeta: v1.ObjectMeta{
Expand Down
10 changes: 0 additions & 10 deletions pkg/trafficpolicy/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
set "github.com/deckarep/golang-set"

"github.com/openservicemesh/osm/pkg/identity"
"github.com/openservicemesh/osm/pkg/service"
)

// TrafficSpecName is the namespaced name of the SMI TrafficSpec
Expand All @@ -27,19 +26,10 @@ type TCPRouteMatch struct {
Ports []int `json:"ports:omitempty"`
}

// TrafficTarget is a struct to represent a traffic policy between a source and destination along with its routes
type TrafficTarget struct {
Name string `json:"name:omitempty"`
Destination service.MeshService `json:"destination:omitempty"`
Source service.MeshService `json:"source:omitempty"`
HTTPRouteMatches []HTTPRouteMatch `json:"http_route_matches:omitempty"`
}

// RouteWeightedClusters is a struct of an HTTPRoute, associated weighted clusters and the domains
type RouteWeightedClusters struct {
HTTPRouteMatch HTTPRouteMatch `json:"http_route_match:omitempty"`
WeightedClusters set.Set `json:"weighted_clusters:omitempty"`
Hostnames set.Set `json:"hostnames:omitempty"` // TODO remove hostnames as part of #2034
}

// InboundTrafficPolicy is a struct that associates incoming traffic on a set of Hostnames with a list of Rules
Expand Down

0 comments on commit bc831b7

Please sign in to comment.