Skip to content

Commit

Permalink
update moduleset handling for edges
Browse files Browse the repository at this point in the history
Signed-off-by: Alice-Lilith <[email protected]>
  • Loading branch information
Alice-Lilith committed Jan 13, 2025
1 parent 261a43d commit 0471bc9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/managerdriver/edges.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package managerdriver

import (
"context"
"encoding/json"
"fmt"
"reflect"
"strings"
Expand Down Expand Up @@ -206,10 +207,18 @@ func (d *Driver) calculateHTTPSEdgesFromIngress(edgeMap map[string]ingressv1alph
continue
}

policyJSON, err := d.getTrafficPolicyJSON(ingress, modSet)
if err != nil {
d.log.Error(err, "error marshalling JSON Policy for ingress", "ingress", ingress)
continue
var policyJSON json.RawMessage
if modSet != nil {
policyJSON, err = d.getTrafficPolicyJSON(ingress, modSet)
if err != nil {
d.log.Error(err, "error marshalling JSON Policy for ingress", "ingress", ingress)
continue
}
}

// If there is no moduleset, initialize an empty one
if modSet == nil {
modSet = &ingressv1alpha1.NgrokModuleSet{}
}

for _, rule := range ingress.Spec.Rules {
Expand Down
4 changes: 4 additions & 0 deletions pkg/managerdriver/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (t *translator) Translate() *TranslationResult {

// TODO (Alice): implement Gateway API support for endpoints

t.log.Info("Alice, translation result",
"irVHosts", ingressVHosts,
)

cloudEndpoints, agentEndpoints := t.IRToEndpoints(ingressVHosts)

return &TranslationResult{
Expand Down

0 comments on commit 0471bc9

Please sign in to comment.