Skip to content

Commit

Permalink
use ptr instead of struct
Browse files Browse the repository at this point in the history
Signed-off-by: Megrez Lu <[email protected]>
  • Loading branch information
lujiajing1126 committed Jun 27, 2024
1 parent a71ed33 commit 174abd6
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type LuaData struct {
Matches []v1beta1.HttpRouteMatch
CanaryService string
StableService string
RequestHeaderModifier gatewayv1beta1.HTTPRequestHeaderFilter
RequestHeaderModifier *gatewayv1beta1.HTTPRequestHeaderFilter
}
type Data struct {
Spec interface{} `json:"spec,omitempty"`
Expand Down Expand Up @@ -270,18 +270,15 @@ func (r *customController) executeLuaForCanary(spec Data, strategy *v1beta1.Traf
// so we need to pass weight=-1 to indicate the case where weight is nil.
weight = utilpointer.Int32(-1)
}
var reqHeaderModifier gatewayv1beta1.HTTPRequestHeaderFilter
if strategy.RequestHeaderModifier != nil {
reqHeaderModifier = *strategy.RequestHeaderModifier
}

data := &LuaData{
Data: spec,
CanaryWeight: *weight,
StableWeight: 100 - *weight,
Matches: matches,
CanaryService: r.conf.CanaryService,
StableService: r.conf.StableService,
RequestHeaderModifier: reqHeaderModifier,
RequestHeaderModifier: strategy.RequestHeaderModifier,
}

unObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(data)
Expand Down

0 comments on commit 174abd6

Please sign in to comment.