Skip to content

Commit

Permalink
fix: omitempty, review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
michaelbeaumont committed Jan 5, 2023
1 parent 70916e8 commit 99c30d0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ type To struct {
}

type Rule struct {
Matches []Match `json:"matches,omitempty"`
Matches []Match `json:"matches"`
// Default holds routing rules that can be merged with rules from other
// policies.
Default RuleConf `json:"default,omitempty"`
Default RuleConf `json:"default"`
}

type Match struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugins/policies/meshhttproute/api/v1alpha1/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ properties:
type: object
type: object
type: array
required:
- default
- matches
type: object
type: array
targetRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ spec:
type: object
type: object
type: array
required:
- default
- matches
type: object
type: array
targetRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func makeClusters(
name = envoy_names.GetSplitClusterName(service, splitCounter.getAndIncrement())
}

// The mesh tag is present here if this destination is generated
// from a cross-mesh MeshGateway listener virtual outbound.
// It is not part of the service tags.
if mesh, ok := ref.Tags[mesh_proto.MeshTag]; ok {
// The name should be distinct to the service & mesh combination
name = fmt.Sprintf("%s_%s", name, mesh)
Expand All @@ -206,9 +209,6 @@ func makeClusters(
envoy_common.WithService(service),
envoy_common.WithName(name),
envoy_common.WithWeight(uint32(ref.Weight)),
// The mesh tag is set here if this destination is generated
// from a MeshGateway virtual outbound and is not part of the
// service tags
envoy_common.WithTags(allTags.WithoutTags(mesh_proto.MeshTag)),
envoy_common.WithExternalService(isExternalService),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (p plugin) MatchedPolicies(dataplane *core_mesh.DataplaneResource, resource
}

func (p plugin) Apply(rs *core_xds.ResourceSet, ctx xds_context.Context, proxy *core_xds.Proxy) error {
// These policies have alreadu been merged using the custom `GetDefault`
// These policies have already been merged using the custom `GetDefault`
// method and therefore are of the
// `ToRouteRule` type, where rules have been appended together.
policies := proxy.Policies.Dynamic[api.MeshHTTPRouteType]
Expand Down

0 comments on commit 99c30d0

Please sign in to comment.